FEATURE #2048: prepare routes for ACL, add some more permissions

This commit is contained in:
Michal Kváček
2017-08-11 02:07:31 +02:00
parent cccdbda543
commit 335ec4a167
41 changed files with 836 additions and 489 deletions
+6 -3
View File
@@ -21,9 +21,12 @@
</div>
@if ($historySize > 0)
<div class="columns text-right col-lg-6">
<a class="btn btn-secondary" href="{{route('content.history', ['id' => $page->id])}}">@lang('admin/contents.showHistory', ['count' => $historySize])</a>
</div>
@can('viewHistory', $page)
<div class="columns text-right col-lg-6">
<a class="btn btn-secondary"
href="{{route('content.history', ['id' => $page->id])}}">@lang('admin/contents.showHistory', ['count' => $historySize])</a>
</div>
@endcan
@endif
</div>
</form>
@@ -4,9 +4,11 @@
@section('headerButtons')
@if($module->exists === true)
<a href="{{route('content.new', ['module' => $module])}}" class="btn btn-primary btn-sm rounded">
<i class="fa fa-plus"></i>
</a>
@can('create', $module)
<a href="{{route('content.new', ['module' => $module])}}" class="btn btn-primary btn-sm rounded">
<i class="fa fa-plus"></i>
</a>
@endcan
@endif
@endsection
@@ -36,26 +38,38 @@
@foreach($pages as $page)
<div class="row p-tb-15">
<div class="col-md-1 hidden-sm-down text-center with-placeholder">
<a href="{{route('content.edit', ['page' => $page])}}">
@if(!view()->exists(template_name($page->template, false)))
<i class="fa fa-2x text-warning fa-warning" data-toggle="tooltip"
title="@lang('admin/contents.invalidTemplateSelected')"></i>
@else
@if(!empty($page->titlePhoto))
<img src="@thumbnail($page->titlePhoto)" class="placeholder"
alt="{{$page->title}}" />
@can('update', $page)
<a href="{{route('content.edit', ['page' => $page])}}">
@if(!view()->exists(template_name($page->template, false)))
<i class="fa fa-2x text-warning fa-warning" data-toggle="tooltip"
title="@lang('admin/contents.invalidTemplateSelected')"></i>
@else
<img src="{{asset('resources/assets/admin/img/placeholder.png')}}"
class="placeholder"
alt="{{$page->title}}" />
@if(!empty($page->titlePhoto))
<img src="@thumbnail($page->titlePhoto)" class="placeholder"
alt="{{$page->title}}" />
@else
<img src="{{asset('resources/assets/admin/img/placeholder.png')}}"
class="placeholder"
alt="{{$page->title}}" />
@endif
@endif
</a>
@else
@if(!empty($page->titlePhoto))
<img src="@thumbnail($page->titlePhoto)" class="placeholder"
alt="{{$page->title}}" />
@endif
</a>
@endcannot
</div>
<div class="col-xs-10 col-md-3 col-lg-4">
<a href="{{route('content.edit', ['page' => $page])}}">
@can('update', $page)
<a href="{{route('content.edit', ['page' => $page])}}">
{{$page->title}}
</a>
@else
{{$page->title}}
</a>
@endcan
@if($page->isHomepage) <span
class="m-l-10 tag tag-primary">@lang('admin/contents.homepage')</span> @endif
@@ -85,38 +99,45 @@
<ul class="item-actions-list">
@if(!$page->isHomepage)
<li>
<a href="{{route('content.setHomepage', ['page' => $page])}}"
data-toggle="tooltip"
title="@lang('admin/contents.setHomepage')">
<i class="fa fa-home"></i>
</a>
</li>
@can('set-homepage', $page)
<li>
<a href="{{route('content.setHomepage', ['page' => $page])}}"
data-toggle="tooltip"
title="@lang('admin/contents.setHomepage')">
<i class="fa fa-home"></i>
</a>
</li>
@endcan
@endif
<li>
<a class="edit" href="{{route('content.edit', ['page' => $page])}}"
data-toggle="tooltip" title="@lang('admin/contents.editPlain')">
<i class="fa fa-pencil"></i>
</a>
</li>
@can('update', $page)
<li>
<a class="edit" href="{{route('content.edit', ['page' => $page])}}"
data-toggle="tooltip" title="@lang('admin/contents.editPlain')">
<i class="fa fa-pencil"></i>
</a>
</li>
@endcan
@if($page->isDraft())
<li>
<a href="{{route('content.changeStatus', ['page' => $page, 'status' => 'public'])}}"
class="confirm" data-toggle="tooltip"
title="@lang('admin/contents.makePublic')">
<i class="fa fa-eye"></i>
</a>
</li>
<li>
<a href="{{route('content.changeStatus', ['page' => $page, 'status' => 'protected'])}}"
class="confirm" data-toggle="tooltip"
title="@lang('admin/contents.makeProtected')">
<i class="fa fa-lock"></i>
</a>
</li>
@can('publish', $page)
<li>
<a href="{{route('content.changeStatus', ['page' => $page, 'status' => 'public'])}}"
class="confirm" data-toggle="tooltip"
title="@lang('admin/contents.makePublic')">
<i class="fa fa-eye"></i>
</a>
</li>
@endcan
@can('protect', $page)
<li>
<a href="{{route('content.changeStatus', ['page' => $page, 'status' => 'protected'])}}"
class="confirm" data-toggle="tooltip"
title="@lang('admin/contents.makeProtected')">
<i class="fa fa-lock"></i>
</a>
</li>
@endcan
@else
<li>
<a href="{{route('page.content', ['url' => $page->url])}}"
@@ -125,26 +146,30 @@
class="button tiny secondary"><i class="fa fa-globe"></i>
</a>
</li>
<li>
<a href="{{route('content.changeStatus', ['page' => $page, 'status' => 'draft'])}}"
class="button tiny warning confirm" data-toggle="tooltip"
title="@lang('admin/contents.makeDraft')">
<i class="fa fa-eye-slash"></i>
</a>
</li>
@can('draft', $page)
<li>
<a href="{{route('content.changeStatus', ['page' => $page, 'status' => 'draft'])}}"
class="button tiny warning confirm" data-toggle="tooltip"
title="@lang('admin/contents.makeDraft')">
<i class="fa fa-eye-slash"></i>
</a>
</li>
@endcan
@endif
<li>
<a href="{{route('content.delete', ['page' => $page])}}"
class="button tiny alert remove confirm" data-toggle="tooltip"
title="@lang('admin/contents.deletePage')"><i
class="fa fa-trash-o"></i>
</a>
</li>
@can('delete', $page)
<li>
<a href="{{route('content.delete', ['page' => $page])}}"
class="button tiny alert remove confirm" data-toggle="tooltip"
title="@lang('admin/contents.deletePage')"><i
class="fa fa-trash-o"></i>
</a>
</li>
@endcan
</ul>
</div>
</div>
</div>
</div>
@endforeach