FEATURE: make templates not-editable
This commit is contained in:
@@ -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)) {
|
||||
|
||||
@@ -12,8 +12,7 @@ class EditTemplateRequest extends Request
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|max:128',
|
||||
'templateContent' => 'required'
|
||||
'name' => 'required|max:128',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,19 @@
|
||||
{!! csrf_field() !!}
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
@include('admin.snippets.aceEditor', [
|
||||
'value' => old('templateContent', $templateContent),
|
||||
'theme' => 'xcode',
|
||||
'mode' => 'html',
|
||||
'name' => 'templateContent',
|
||||
'rows' => '20'
|
||||
])
|
||||
@if($template->editable)
|
||||
@include('admin.snippets.aceEditor', [
|
||||
'value' => old('templateContent', $templateContent),
|
||||
'theme' => 'xcode',
|
||||
'mode' => 'html',
|
||||
'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])">
|
||||
<i class="fa fa-edit"></i>
|
||||
@if ($template->editable)
|
||||
<i class="fa fa-edit"></i>
|
||||
@else
|
||||
<i class="fa fa-info"></i>
|
||||
@endif
|
||||
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
@empty
|
||||
<div class="alert alert-info">
|
||||
|
||||
Reference in New Issue
Block a user