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',
'newTemplateNameSuffix' => 'copy',
'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="item" data-equalizer-watch>
<div class="detail row text-center">
<div class="highlight">
<div class="highlight" title="{{$template->name}}">
{{str_limit($template->name, 15)}}
</div>
<div>
@@ -12,15 +12,23 @@
</div>
<div class="controls row">
@if($isWritable)
<a data-template-id="{{$template->id}}" data-template-name="{{$template->template_name}}"
class="button primary column large-6 copy-template"
title="@lang('admin/templates.copy')">
<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)
<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>
</a>
@endif
@@ -39,6 +47,7 @@
var link = $ (this);
var templateId = link.data ('template-id');
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')");