FEATURE: add basic funcionality for template copies.

This commit contains only basic funcionality.
This commit is contained in:
Michal Kváček
2016-02-29 18:02:22 +01:00
parent 57e08b76a8
commit fa97ccc032
5 changed files with 76 additions and 19 deletions
@@ -12,12 +12,15 @@
</div>
<div class="controls row">
<a href="{{route('templates.copy', ['id' => $template->id])}}" class="button text-center primary column large-6" title="@lang('admin/templates.copy')">
<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>
@if ($template->editable)
<a href="{{route('templates.edit', ['id' => $template->id])}}" class="button text-center success column large-6" title="@lang('admin/templates.edit')">
<a href="{{route('templates.edit', ['id' => $template->id])}}"
class="button success column large-6" title="@lang('admin/templates.edit')">
<i class="fa fa-edit"></i>
</a>
@endif
@@ -28,4 +31,22 @@
@empty
<em>@lang('admin/templates.noTemplates')</em>
@endforelse
</div>
</div>
@section('javascripts')
<script type="text/javascript">
$ ('.copy-template').click (function () {
var link = $ (this);
var templateId = link.data ('template-id');
var templateName = link.data ('template-name');
var newTemplateName = prompt ("@lang('admin/templates.newTemplateName')", templateName + "_"+"@lang('admin/templates.newTemplateNameSuffix')");
if (newTemplateName == null) return;
$.ajax({
'url': '{{route('templates.copy')}}}'
});
});
</script>
@endsection