75 lines
2.9 KiB
PHP
75 lines
2.9 KiB
PHP
<div class="tile-overview sameheight-container">
|
|
@forelse($templates as $template)
|
|
<div class="col-lg-3">
|
|
<div class="text-center bold" data-toggle="tooltip" title="{{$template->name}}">
|
|
{{str_limit($template->name, 15)}}
|
|
</div>
|
|
<div class="text-center sameheight-item">
|
|
{{str_limit($template->description, 150)}}
|
|
</div>
|
|
|
|
@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>
|
|
@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
|
|
<i class="fa fa-info"></i>
|
|
@endif
|
|
|
|
</a>
|
|
@endcan
|
|
</div>
|
|
@empty
|
|
<div class="alert alert-info">
|
|
<em>@lang('admin/templates.noTemplates')</em>
|
|
</div>
|
|
@endforelse
|
|
</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');
|
|
templateName = templateName.substr (templateName.search ('::') + 2, templateName.length);
|
|
|
|
var newTemplateName = prompt ("@lang('admin/templates.newTemplateName')", templateName + "_" + "@lang('admin/templates.newTemplateNameSuffix')");
|
|
|
|
// 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 ();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
@endsection |