FEATURE: allow copying only when directory is wirtable

This commit is contained in:
Michal Kváček
2016-03-09 22:09:24 +01:00
parent fe9e76bf28
commit fc58a4d31c
2 changed files with 18 additions and 8 deletions
+2 -1
View File
@@ -17,5 +17,6 @@ return [
'newTemplateName' => 'Template name used in Blade templates', 'newTemplateName' => 'Template name used in Blade templates',
'newTemplateNameSuffix' => 'copy', 'newTemplateNameSuffix' => 'copy',
'copySuccessfull' => 'Template :name successfully created by copying from other template.', 'copySuccessfull' => 'Template :name successfully created by copying from other template.',
'copyFailed' => 'Cannot copy template into :name. Check write permissions to proper template path.' 'copyFailed' => 'Cannot copy template into :name. Check write permissions to proper template path.',
'cannotCopy' => 'Directory does not have permissions for writing. Copy is not available.'
]; ];
@@ -3,7 +3,7 @@
<div class="columns large-3"> <div class="columns large-3">
<div class="item" data-equalizer-watch> <div class="item" data-equalizer-watch>
<div class="detail row text-center"> <div class="detail row text-center">
<div class="highlight"> <div class="highlight" title="{{$template->name}}">
{{str_limit($template->name, 15)}} {{str_limit($template->name, 15)}}
</div> </div>
<div> <div>
@@ -12,15 +12,23 @@
</div> </div>
<div class="controls row"> <div class="controls row">
<a data-template-id="{{$template->id}}" data-template-name="{{$template->template_name}}" @if($isWritable)
class="button primary column large-6 copy-template" <a data-template-id="{{$template->id}}" data-template-name="{{$template->template_name}}"
title="@lang('admin/templates.copy')"> class="button primary column large-6 copy-template"
<i class="fa fa-copy"></i> title="@lang('admin/templates.copy')">
</a> <i class="fa fa-copy"></i>
</a>
@else
<a href="#" class="button primary disabled column large-6"
title="@lang('admin/templates.cannotCopy')">
<i class="fa fa-copy"></i>
</a>
@endif
@if ($template->editable) @if ($template->editable)
<a href="{{route('templates.edit', ['id' => $template->id])}}" <a href="{{route('templates.edit', ['id' => $template->id])}}"
class="button success column large-6" title="@lang('admin/templates.edit')"> class="button success column large-6"
title="@lang('admin/templates.edit', ['name' => $template->name])">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</a> </a>
@endif @endif
@@ -39,6 +47,7 @@
var link = $ (this); var link = $ (this);
var templateId = link.data ('template-id'); var templateId = link.data ('template-id');
var templateName = link.data ('template-name'); var templateName = link.data ('template-name');
templateName = templateName.substr (templateName.search ('::') + 2, templateName.length);
var newTemplateName = prompt ("@lang('admin/templates.newTemplateName')", templateName + "_" + "@lang('admin/templates.newTemplateNameSuffix')"); var newTemplateName = prompt ("@lang('admin/templates.newTemplateName')", templateName + "_" + "@lang('admin/templates.newTemplateNameSuffix')");