FEATURE #2048: add missing policies
This commit is contained in:
@@ -8,28 +8,37 @@
|
||||
{{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-secondary col-lg-6 copy-template" data-toggle="tooltip"
|
||||
title="@lang('admin/templates.copy')">
|
||||
<i class="fa fa-copy"></i>
|
||||
</a>
|
||||
@can('copy', $template)
|
||||
@if($isWritable)
|
||||
<a data-template-id="{{$template->id}}" data-template-name="{{$template->template_name}}"
|
||||
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-secondary disabled col-lg-6" data-toggle="tooltip"
|
||||
title="@lang('admin/templates.cannotCopy')">
|
||||
<i class="fa fa-copy"></i>
|
||||
</a>
|
||||
@endif
|
||||
@else
|
||||
<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
|
||||
@endcan
|
||||
@can('update', $template)
|
||||
<a href="{{route('templates.edit', ['id' => $template->id])}}"
|
||||
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>
|
||||
@else
|
||||
@else
|
||||
<i class="fa fa-info"></i>
|
||||
@endif
|
||||
|
||||
</a>
|
||||
@endcan
|
||||
</div>
|
||||
@empty
|
||||
<div class="alert alert-info">
|
||||
@@ -40,27 +49,27 @@
|
||||
|
||||
@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');
|
||||
templateName = templateName.substr (templateName.search ('::') + 2, templateName.length);
|
||||
$ ('.copy-template').click (function () {
|
||||
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')");
|
||||
var newTemplateName = prompt ("@lang('admin/templates.newTemplateName')", templateName + "_" + "@lang('admin/templates.newTemplateNameSuffix')");
|
||||
|
||||
// no name given - give up
|
||||
if (newTemplateName === null) return;
|
||||
// no name given - give up
|
||||
if (newTemplateName === null) return;
|
||||
|
||||
// copy given template
|
||||
$.post ('{{route('templates.postCopy')}}', {
|
||||
template: templateId,
|
||||
newName: newTemplateName,
|
||||
_token: "{{csrf_token()}}"
|
||||
}, function (data) {
|
||||
if (data.status === 'success') {
|
||||
location.reload ();
|
||||
}
|
||||
});
|
||||
});
|
||||
// copy given template
|
||||
$.post ('{{route('templates.postCopy')}}', {
|
||||
template: templateId,
|
||||
newName: newTemplateName,
|
||||
_token: "{{csrf_token()}}"
|
||||
}, function (data) {
|
||||
if (data.status === 'success') {
|
||||
location.reload ();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user