FEATURE: make templates not-editable

This commit is contained in:
Michal Kváček
2016-09-21 00:58:03 +02:00
parent f5e1e24df8
commit 7d051d1f6a
4 changed files with 26 additions and 19 deletions
+1 -1
View File
@@ -89,7 +89,7 @@ class EditTemplate extends Controller
}
// save new content only if something was changed
if ($this->isContentDifferent($originalTemplate, $customTemplate, $request->templateContent)) {
if ($template->editable && $this->isContentDifferent($originalTemplate, $customTemplate, $request->templateContent)) {
// create directory for custom updates
if (!is_dir($customDir)) {
@@ -13,7 +13,6 @@ class EditTemplateRequest extends Request
{
return [
'name' => 'required|max:128',
'templateContent' => 'required'
];
}
}
@@ -8,6 +8,7 @@
{!! csrf_field() !!}
<div class="row">
<div class="col-lg-8">
@if($template->editable)
@include('admin.snippets.aceEditor', [
'value' => old('templateContent', $templateContent),
'theme' => 'xcode',
@@ -15,6 +16,11 @@
'name' => 'templateContent',
'rows' => '20'
])
@else
<code>
<pre>{{$templateContent}}</pre>
</code>
@endif
</div>
<div class="col-lg-4">
@@ -1,33 +1,35 @@
<div class="tile-overview">
@forelse($templates as $template)
<div class="col-lg-3">
<div class="text-center" title="{{$template->name}}">
<div class="text-center bold" data-toggle="tooltip" title="{{$template->name}}">
{{str_limit($template->name, 15)}}
</div>
<div>
<div class="text-center">
{{str_limit($template->description, 150)}}
</div>
@if($isWritable)
<a data-template-id="{{$template->id}}" data-template-name="{{$template->template_name}}"
class="btn btn-pill-left btn-primary col-lg-6 copy-template"
class="btn btn-pill-left btn-secondary col-lg-6 copy-template" data-toggle="tooltip"
title="@lang('admin/templates.copy')">
<i class="fa fa-copy"></i>
</a>
@else
<a href="#" class="btn btn-pill-left btn-primary disabled col-lg-6"
<a href="#" class="btn btn-pill-left btn-secondary disabled col-lg-6" data-toggle="tooltip"
title="@lang('admin/templates.cannotCopy')">
<i class="fa fa-copy"></i>
</a>
@endif
@if ($template->editable)
<a href="{{route('templates.edit', ['id' => $template->id])}}"
class="btn btn-primary btn-pill-right col-lg-6"
class="btn btn-primary btn-pill-right col-lg-6" data-toggle="tooltip"
title="@lang('admin/templates.edit', ['name' => $template->name])">
@if ($template->editable)
<i class="fa fa-edit"></i>
</a>
@else
<i class="fa fa-info"></i>
@endif
</a>
</div>
@empty
<div class="alert alert-info">