FEATURE: add template check on content overview
This commit is contained in:
@@ -13,7 +13,7 @@ class Template
|
|||||||
*
|
*
|
||||||
* @return null|string
|
* @return null|string
|
||||||
*/
|
*/
|
||||||
public static function name($template)
|
public static function name($template, $throwExceptions = true)
|
||||||
{
|
{
|
||||||
$namespace = null;
|
$namespace = null;
|
||||||
if (strpos($template, '::')) {
|
if (strpos($template, '::')) {
|
||||||
@@ -32,9 +32,13 @@ class Template
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($throwExceptions) {
|
||||||
if (is_null($view)) {
|
if (is_null($view)) {
|
||||||
throw new InvalidArgumentException('Cannot find template for ' . $namespace . $template);
|
throw new InvalidArgumentException('Cannot find template for ' . $namespace . $template);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,5 +52,6 @@ return [
|
|||||||
'createdAt' => 'Created at',
|
'createdAt' => 'Created at',
|
||||||
'status' => 'Status',
|
'status' => 'Status',
|
||||||
'moduleName' => 'Module',
|
'moduleName' => 'Module',
|
||||||
'actions' => 'Actions'
|
'actions' => 'Actions',
|
||||||
|
'invalidTemplateSelected' => 'Invalid template selected! This page cannot be rendered!'
|
||||||
];
|
];
|
||||||
@@ -4,6 +4,12 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
|
@if(!count($templates))
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
@lang('admin/contents.noTemplates')
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
<form method="POST" enctype="multipart/form-data" action="{{route('content.editPost', ['pageId' => $page->id])}}">
|
<form method="POST" enctype="multipart/form-data" action="{{route('content.editPost', ['pageId' => $page->id])}}">
|
||||||
{!! csrf_field() !!}
|
{!! csrf_field() !!}
|
||||||
|
|
||||||
|
|||||||
@@ -35,12 +35,18 @@
|
|||||||
<div class="row p-tb-15">
|
<div class="row p-tb-15">
|
||||||
<div class="col-md-1 hidden-sm-down text-center with-placeholder">
|
<div class="col-md-1 hidden-sm-down text-center with-placeholder">
|
||||||
<a href="{{route('content.edit', ['id' => $page->id])}}">
|
<a href="{{route('content.edit', ['id' => $page->id])}}">
|
||||||
|
@if(!view()->exists(\App\Helpers\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->title_photo))
|
@if(!empty($page->title_photo))
|
||||||
<img src="@upload($page->title_photo)" class="placeholder" alt="{{$page->title}}" />
|
<img src="@upload($page->title_photo)" class="placeholder" alt="{{$page->title}}" />
|
||||||
@else
|
@else
|
||||||
<img src="{{asset('resources/assets/admin/img/placeholder.png')}}" class="placeholder"
|
<img src="{{asset('resources/assets/admin/img/placeholder.png')}}"
|
||||||
|
class="placeholder"
|
||||||
alt="{{$page->title}}" />
|
alt="{{$page->title}}" />
|
||||||
@endif
|
@endif
|
||||||
|
@endif
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-10 col-md-3 col-lg-4">
|
<div class="col-xs-10 col-md-3 col-lg-4">
|
||||||
@@ -71,14 +77,16 @@
|
|||||||
@if(!$page->is_homepage)
|
@if(!$page->is_homepage)
|
||||||
<li>
|
<li>
|
||||||
|
|
||||||
<a href="{{route('content.setHomepage', ['id' => $page->id])}}" data-toggle="tooltip" title="@lang('admin/contents.setHomepage')">
|
<a href="{{route('content.setHomepage', ['id' => $page->id])}}"
|
||||||
|
data-toggle="tooltip" title="@lang('admin/contents.setHomepage')">
|
||||||
<i class="fa fa-home"></i>
|
<i class="fa fa-home"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a class="edit" href="{{route('content.edit', ['id' => $page->id])}}" data-toggle="tooltip" title="@lang('admin/contents.editPlain')">
|
<a class="edit" href="{{route('content.edit', ['id' => $page->id])}}"
|
||||||
|
data-toggle="tooltip" title="@lang('admin/contents.editPlain')">
|
||||||
<i class="fa fa-pencil"></i>
|
<i class="fa fa-pencil"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@@ -86,7 +94,8 @@
|
|||||||
@if($page->status == \App\Models\Content::STATUS_DRAFT)
|
@if($page->status == \App\Models\Content::STATUS_DRAFT)
|
||||||
<li>
|
<li>
|
||||||
<a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => \App\Models\Content::STATUS_PUBLIC])}}"
|
<a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => \App\Models\Content::STATUS_PUBLIC])}}"
|
||||||
class="confirm" data-toggle="tooltip" title="@lang('admin/contents.makePublic')">
|
class="confirm" data-toggle="tooltip"
|
||||||
|
title="@lang('admin/contents.makePublic')">
|
||||||
<i class="fa fa-eye"></i>
|
<i class="fa fa-eye"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@@ -115,7 +124,8 @@
|
|||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="{{route('content.delete', ['id' => $page->id])}}"
|
<a href="{{route('content.delete', ['id' => $page->id])}}"
|
||||||
class="button tiny alert remove confirm" data-toggle="tooltip" title="@lang('admin/contents.deletePage')"><i
|
class="button tiny alert remove confirm" data-toggle="tooltip"
|
||||||
|
title="@lang('admin/contents.deletePage')"><i
|
||||||
class="fa fa-trash-o"></i>
|
class="fa fa-trash-o"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user