diff --git a/app/Helpers/Template.php b/app/Helpers/Template.php index b4fe197a..65e03ec3 100644 --- a/app/Helpers/Template.php +++ b/app/Helpers/Template.php @@ -13,7 +13,7 @@ class Template * * @return null|string */ - public static function name($template) + public static function name($template, $throwExceptions = true) { $namespace = null; if (strpos($template, '::')) { @@ -32,8 +32,12 @@ class Template } } - if (is_null($view)) { - throw new InvalidArgumentException('Cannot find template for ' . $namespace . $template); + if ($throwExceptions) { + if (is_null($view)) { + throw new InvalidArgumentException('Cannot find template for ' . $namespace . $template); + } + } else { + return false; } return $view; diff --git a/resources/lang/en/admin/contents.php b/resources/lang/en/admin/contents.php index 4a5a158c..ee8093f6 100644 --- a/resources/lang/en/admin/contents.php +++ b/resources/lang/en/admin/contents.php @@ -1,56 +1,57 @@ 'Deleted', - 'status_draft' => 'Draft', - 'status_protected' => 'Protected', - 'status_public' => 'Public', - 'new' => 'Create new :name', - 'category' => 'Category', - 'edit' => 'Edit :name', - 'editPlain' => 'Edit', - 'content' => 'Page content', - 'save' => 'Save page', - 'basicInfo' => 'Basic information', - 'metaOptions' => 'Meta information', - 'publicationOptions' => 'Publication setup', - 'field_title' => 'Page title', - 'field_url' => 'URL', - 'field_meta_keywords' => 'Keywords', - 'field_meta_description' => 'Page description', - 'field_published_from' => 'Published from', - 'field_published_to' => 'Published to', - 'successfullyCreated' => 'Page successfully created', - 'noPagesAvailable' => 'No static pages available. Try to create one first.', - 'viewPage' => 'View', - 'deletePage' => 'Delete', - 'makePublic' => 'Publish', - 'makeProtected' => 'Logged users only', - 'makeDraft' => 'Make draft', - 'invalidStatus' => 'Cannot change status to something undefined.', - 'statusChanged' => 'Status successfully changed.', - 'invalidPage' => 'Specified page does not exist.', - 'pageDeleted' => 'Page :name (:url) successfully deleted.', - 'nothingToEdit' => 'You did not submit any changes. Nothing was edited.', - 'successfullyEdited' => 'Edit successfull', - 'showHistory' => 'History (:count)', - 'appearance' => 'Appearance', - 'template' => 'Template of this page', - 'overview' => 'List of all content pages', - 'homepageSetup' => 'Homepage successfully set up.', - 'setHomepage' => 'Set page as homepage', - 'noParentPage' => ' -- No parent page -- ', - 'uploadTitleImage' => 'Upload title image', - 'noHomepage' => 'You have not set up your homepage yet, or your current homepage is draft! Try to select another one.', - 'homepageProtected' => 'Your homepage is displayed only for logged in users. This may or may not be an error.', - 'parentPage' => 'Parent page', - 'alreadyHomepage' => 'Homepage', - 'files' => 'Files', - 'lockUrl' => 'Keep URL', - 'noCategory' => ' -- No category -- ', - 'noTemplates' => 'Cannot create content page. There are no available templates for this module.', - 'title' => 'Title', - 'createdAt' => 'Created at', - 'status' => 'Status', - 'moduleName' => 'Module', - 'actions' => 'Actions' + 'status_deleted' => 'Deleted', + 'status_draft' => 'Draft', + 'status_protected' => 'Protected', + 'status_public' => 'Public', + 'new' => 'Create new :name', + 'category' => 'Category', + 'edit' => 'Edit :name', + 'editPlain' => 'Edit', + 'content' => 'Page content', + 'save' => 'Save page', + 'basicInfo' => 'Basic information', + 'metaOptions' => 'Meta information', + 'publicationOptions' => 'Publication setup', + 'field_title' => 'Page title', + 'field_url' => 'URL', + 'field_meta_keywords' => 'Keywords', + 'field_meta_description' => 'Page description', + 'field_published_from' => 'Published from', + 'field_published_to' => 'Published to', + 'successfullyCreated' => 'Page successfully created', + 'noPagesAvailable' => 'No static pages available. Try to create one first.', + 'viewPage' => 'View', + 'deletePage' => 'Delete', + 'makePublic' => 'Publish', + 'makeProtected' => 'Logged users only', + 'makeDraft' => 'Make draft', + 'invalidStatus' => 'Cannot change status to something undefined.', + 'statusChanged' => 'Status successfully changed.', + 'invalidPage' => 'Specified page does not exist.', + 'pageDeleted' => 'Page :name (:url) successfully deleted.', + 'nothingToEdit' => 'You did not submit any changes. Nothing was edited.', + 'successfullyEdited' => 'Edit successfull', + 'showHistory' => 'History (:count)', + 'appearance' => 'Appearance', + 'template' => 'Template of this page', + 'overview' => 'List of all content pages', + 'homepageSetup' => 'Homepage successfully set up.', + 'setHomepage' => 'Set page as homepage', + 'noParentPage' => ' -- No parent page -- ', + 'uploadTitleImage' => 'Upload title image', + 'noHomepage' => 'You have not set up your homepage yet, or your current homepage is draft! Try to select another one.', + 'homepageProtected' => 'Your homepage is displayed only for logged in users. This may or may not be an error.', + 'parentPage' => 'Parent page', + 'alreadyHomepage' => 'Homepage', + 'files' => 'Files', + 'lockUrl' => 'Keep URL', + 'noCategory' => ' -- No category -- ', + 'noTemplates' => 'Cannot create content page. There are no available templates for this module.', + 'title' => 'Title', + 'createdAt' => 'Created at', + 'status' => 'Status', + 'moduleName' => 'Module', + 'actions' => 'Actions', + 'invalidTemplateSelected' => 'Invalid template selected! This page cannot be rendered!' ]; \ No newline at end of file diff --git a/resources/views/admin/content/edit.blade.php b/resources/views/admin/content/edit.blade.php index 2ba104ed..1db5761f 100644 --- a/resources/views/admin/content/edit.blade.php +++ b/resources/views/admin/content/edit.blade.php @@ -4,6 +4,12 @@ @section('content') + @if(!count($templates)) +
+ @lang('admin/contents.noTemplates') +
+ @endif +
{!! csrf_field() !!} diff --git a/resources/views/admin/content/overview.blade.php b/resources/views/admin/content/overview.blade.php index e12746a3..a9ffe8c5 100644 --- a/resources/views/admin/content/overview.blade.php +++ b/resources/views/admin/content/overview.blade.php @@ -35,11 +35,17 @@
@@ -71,14 +77,16 @@ @if(!$page->is_homepage)
  • - +
  • @endif
  • - +
  • @@ -86,7 +94,8 @@ @if($page->status == \App\Models\Content::STATUS_DRAFT)
  • + class="confirm" data-toggle="tooltip" + title="@lang('admin/contents.makePublic')">
  • @@ -115,7 +124,8 @@