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
|
||||
@@ -36,6 +36,7 @@
|
||||
href="{{route('widgetareas.edit', ['id' => $area->id])}}"><i
|
||||
class="fa fa-pencil"></i></a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="{{route('widgets.associate', ['widgetArea' => $area->id])}}"
|
||||
data-toggle="tooltip"
|
||||
@@ -66,18 +67,20 @@
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="card items">
|
||||
<div class="card-header">
|
||||
<div class="header-block">
|
||||
<h3 class="title">@lang('admin/widgetAreas.new')</h3>
|
||||
@can('create', \App\Models\Widgets\WidgetArea::class)
|
||||
<div class="col-lg-4">
|
||||
<div class="card items">
|
||||
<div class="card-header">
|
||||
<div class="header-block">
|
||||
<h3 class="title">@lang('admin/widgetAreas.new')</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
@include('admin.widgets.area.form', ['action' => route('widgetareas.postNew'), 'area' => new \App\Models\Widgets\WidgetArea()])
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
@include('admin.widgets.area.form', ['action' => route('widgetareas.postNew'), 'area' => new \App\Models\Widgets\WidgetArea()])
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endcan
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -23,38 +23,48 @@
|
||||
</tr>
|
||||
@foreach($widgets as $widget)
|
||||
<tr>
|
||||
<td><a href="{{route('widgets.edit', ['id' => $widget->id])}}">{{$widget->name}}</a></td>
|
||||
<td>
|
||||
@can('update', $widget)
|
||||
<a href="{{route('widgets.edit', ['id' => $widget->id])}}">{{$widget->name}}</a>
|
||||
@else
|
||||
{{$widget->name}}
|
||||
@endcan
|
||||
</td>
|
||||
<td>{{trans(call_user_func([$widget->widget_type_handler, 'getName']))}}</td>
|
||||
<td>{{$widget->description}}</td>
|
||||
<td class="text-center">
|
||||
|
||||
|
||||
<div class="item-actions-dropdown">
|
||||
<a class="item-actions-toggle-btn">
|
||||
<span class="inactive"><i class="fa fa-cog"></i></span>
|
||||
<span class="active"><i class="fa fa-chevron-circle-right"></i></span>
|
||||
</a>
|
||||
<div class="item-actions-block">
|
||||
<ul class="item-actions-list">
|
||||
<li>
|
||||
<a class="edit" data-toggle="tooltip"
|
||||
title="@lang('admin/widgets.editTooltip')"
|
||||
href="{{route('widgets.edit', ['id' => $widget->id])}}"><i
|
||||
class="fa fa-pencil"></i></a>
|
||||
</li>
|
||||
@if(\Auth::user()->can('update', $widget) || $widget->deletable)
|
||||
<div class="item-actions-dropdown">
|
||||
<a class="item-actions-toggle-btn">
|
||||
<span class="inactive"><i class="fa fa-cog"></i></span>
|
||||
<span class="active"><i class="fa fa-chevron-circle-right"></i></span>
|
||||
</a>
|
||||
<div class="item-actions-block">
|
||||
<ul class="item-actions-list">
|
||||
@can('update', $widget)
|
||||
<li>
|
||||
<a class="edit" data-toggle="tooltip"
|
||||
title="@lang('admin/widgets.editTooltip')"
|
||||
href="{{route('widgets.edit', ['id' => $widget->id])}}"><i
|
||||
class="fa fa-pencil"></i></a>
|
||||
</li>
|
||||
@endcan
|
||||
|
||||
@if($widget->deletable)
|
||||
<li>
|
||||
<a class="confirm remove" data-toggle="tooltip"
|
||||
title="@lang('admin/widgets.delete')"
|
||||
href="{{route('widgets.delete', ['id' => $widget->id])}}"><i
|
||||
class="fa fa-trash"></i></a>
|
||||
</li>
|
||||
@endif
|
||||
@if($widget->deletable)
|
||||
<li>
|
||||
<a class="confirm remove" data-toggle="tooltip"
|
||||
title="@lang('admin/widgets.delete')"
|
||||
href="{{route('widgets.delete', ['id' => $widget->id])}}"><i
|
||||
class="fa fa-trash"></i></a>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user