From 5abd7d915138bae8cbb482ebaafe9a6930b362aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Thu, 24 Aug 2017 02:50:30 +0200 Subject: [PATCH] FIX: fix content dependency on categories --- .gitignore | 7 +- app/CMS/Handlers/History.php | 7 +- .../Commands/Modules/InstallModule.php | 21 +- app/Console/Commands/SetTemplate.php | 2 +- .../Admin/Contents/ContentOverview.php | 3 + .../Admin/Contents/CreateNewContent.php | 19 +- .../Admin/Contents/EditContent.php | 25 +- app/Models/Content/ContentHistory.php | 6 +- app/Policies/BasicPolicy.php | 3 +- app/Policies/ContentPolicy.php | 19 +- resources/lang/cs/admin/contents.php | 2 +- resources/lang/cs/admin/history.php | 3 +- .../views/admin/content/overview.blade.php | 24 +- .../views/vendor/mail/html/button.blade.php | 19 ++ .../views/vendor/mail/html/footer.blade.php | 11 + .../views/vendor/mail/html/header.blade.php | 7 + .../views/vendor/mail/html/layout.blade.php | 54 ++++ .../views/vendor/mail/html/message.blade.php | 27 ++ .../views/vendor/mail/html/panel.blade.php | 13 + .../vendor/mail/html/promotion.blade.php | 7 + .../mail/html/promotion/button.blade.php | 13 + .../views/vendor/mail/html/subcopy.blade.php | 7 + .../views/vendor/mail/html/table.blade.php | 3 + .../views/vendor/mail/html/themes/default.css | 285 ++++++++++++++++++ .../vendor/mail/markdown/button.blade.php | 1 + .../vendor/mail/markdown/footer.blade.php | 1 + .../vendor/mail/markdown/header.blade.php | 1 + .../vendor/mail/markdown/layout.blade.php | 9 + .../vendor/mail/markdown/message.blade.php | 27 ++ .../vendor/mail/markdown/panel.blade.php | 1 + .../vendor/mail/markdown/promotion.blade.php | 1 + .../mail/markdown/promotion/button.blade.php | 1 + .../vendor/mail/markdown/subcopy.blade.php | 1 + .../vendor/mail/markdown/table.blade.php | 1 + routes/admin/contents.php | 11 +- templates/Binarity/Handler.php | 3 + 36 files changed, 574 insertions(+), 71 deletions(-) create mode 100644 resources/views/vendor/mail/html/button.blade.php create mode 100644 resources/views/vendor/mail/html/footer.blade.php create mode 100644 resources/views/vendor/mail/html/header.blade.php create mode 100644 resources/views/vendor/mail/html/layout.blade.php create mode 100644 resources/views/vendor/mail/html/message.blade.php create mode 100644 resources/views/vendor/mail/html/panel.blade.php create mode 100644 resources/views/vendor/mail/html/promotion.blade.php create mode 100644 resources/views/vendor/mail/html/promotion/button.blade.php create mode 100644 resources/views/vendor/mail/html/subcopy.blade.php create mode 100644 resources/views/vendor/mail/html/table.blade.php create mode 100644 resources/views/vendor/mail/html/themes/default.css create mode 100644 resources/views/vendor/mail/markdown/button.blade.php create mode 100644 resources/views/vendor/mail/markdown/footer.blade.php create mode 100644 resources/views/vendor/mail/markdown/header.blade.php create mode 100644 resources/views/vendor/mail/markdown/layout.blade.php create mode 100644 resources/views/vendor/mail/markdown/message.blade.php create mode 100644 resources/views/vendor/mail/markdown/panel.blade.php create mode 100644 resources/views/vendor/mail/markdown/promotion.blade.php create mode 100644 resources/views/vendor/mail/markdown/promotion/button.blade.php create mode 100644 resources/views/vendor/mail/markdown/subcopy.blade.php create mode 100644 resources/views/vendor/mail/markdown/table.blade.php diff --git a/.gitignore b/.gitignore index c18f8a20..0189cb63 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ -# published files from modules /modules +/templates + +# published files from modules /public/modules /public/assets /resources/views/modules @@ -10,9 +12,6 @@ **/views/**/custom/* !**/views/**/custom/.gitkeep -# module config - generated in ModuleManager service provider -**/module.json - # uploaded files /public/uploads/* !/public/uploads/.gitkeep diff --git a/app/CMS/Handlers/History.php b/app/CMS/Handlers/History.php index c7d8973e..5f787e43 100644 --- a/app/CMS/Handlers/History.php +++ b/app/CMS/Handlers/History.php @@ -17,8 +17,7 @@ class History implements HistoryHandler switch ($changeset->column) { case 'pageContent': $route = route('history.diff', [ - 'revision' => $changeset->edit_batch, - 'id' => $changeset->id + 'revision' => $changeset->id ]); return "(" . trans('admin/history.diff') . ")"; @@ -48,8 +47,8 @@ class History implements HistoryHandler break; default: return trans('admin/history.changedFromTo', [ - 'from' => is_null($changeset->old_value) ? trans('admin/history.emptyValue') : $changeset->old_value, - 'to' => is_null($changeset->new_value) ? trans('admin/history.emptyValue') : $changeset->new_value, + 'from' => empty($changeset->old_value) ? trans('admin/history.emptyValue') : $changeset->old_value, + 'to' => empty($changeset->new_value) ? trans('admin/history.emptyValue') : $changeset->new_value, ]); break; } diff --git a/app/Console/Commands/Modules/InstallModule.php b/app/Console/Commands/Modules/InstallModule.php index 7dca198b..3f2836c3 100644 --- a/app/Console/Commands/Modules/InstallModule.php +++ b/app/Console/Commands/Modules/InstallModule.php @@ -15,13 +15,11 @@ class InstallModule extends Command { /** * The name and signature of the console command. - * * @var string */ protected $signature = 'module:install {name} {parentModuleId?}'; /** * The console command description. - * * @var string */ protected $description = 'Custom installation of CMS module. Name given as directory name in /modules.'; @@ -31,7 +29,6 @@ class InstallModule extends Command /** * Create a new command instance. - * * @return void */ public function __construct() @@ -56,8 +53,9 @@ class InstallModule extends Command // get config $config = $this->loadConfig(); - if (empty($config)) + if (empty($config)) { return; + } // check if it is valid $this->checkMandatoryFields($config); @@ -69,14 +67,15 @@ class InstallModule extends Command Cache::forget('enabled-modules'); Cache::forget('module-handler-to-id-enumeration'); + exec('composer dump-autoload'); + // inform user - $this->line('Module ' . $name . ' successfuly installed'); + $this->line('Module ' . $name . ' successfuly installed.'); } /** * Load config from Config/config.php in module files. We cannot use config() because the file have not published * yet. - * * @return array * @throws FileNotFoundException */ @@ -85,8 +84,9 @@ class InstallModule extends Command $basePath = $this->modulesPath . DIRECTORY_SEPARATOR . $this->moduleName . DIRECTORY_SEPARATOR; $path = $basePath . 'Config' . DIRECTORY_SEPARATOR . 'config.php'; - if (basename($basePath) == 'Database') + if (basename($basePath) == 'Database') { return []; + } // check if module has Config/config.php file if (!file_exists($path)) { @@ -121,7 +121,6 @@ class InstallModule extends Command /** * Installs module into database. - * * This method calls Module::install, which handles specific installation of module. In this way we should be able * to install any module even with some other database structures. * @@ -155,9 +154,9 @@ class InstallModule extends Command if (is_null($module)) { // insert module into database $settings = [ - 'providers' => $providers, - 'order' => isset($config['order']) ? $config['order'] : 0, - 'files' => isset($config['files']) ? $config['files'] : [] + 'providers' => $providers, + 'order' => isset($config['order']) ? $config['order'] : 0, + 'files' => isset($config['files']) ? $config['files'] : [] ]; $module = Installer::install($name, $alias, $this->moduleName, $description, $handler, $this->parentModuleId, $settings); diff --git a/app/Console/Commands/SetTemplate.php b/app/Console/Commands/SetTemplate.php index a3192998..a196257c 100644 --- a/app/Console/Commands/SetTemplate.php +++ b/app/Console/Commands/SetTemplate.php @@ -59,7 +59,7 @@ class SetTemplate extends Command } try { - Installer::install($config['name'], $config['alias'], $current->static_name, $config['description'], $config['handler'], false, $config); + Installer::install($config['name'], $config['alias'], $config['staticName'], $config['description'], $config['handler'], false, $config); } catch (\Exception $e) { $this->error('Cannot install template ' . $template . '. Message: ' . $e->getMessage()); return; diff --git a/app/Http/Controllers/Admin/Contents/ContentOverview.php b/app/Http/Controllers/Admin/Contents/ContentOverview.php index 5a88e708..8a9a76a9 100644 --- a/app/Http/Controllers/Admin/Contents/ContentOverview.php +++ b/app/Http/Controllers/Admin/Contents/ContentOverview.php @@ -46,10 +46,13 @@ class ContentOverview extends Controller // get homepage - for checking if homepage is set and available $homepage = $this->content->getHomepage(); + $contentModules = app(\App\CMS\Repositories\Module::class)->getContentModules(); + return view('admin.content.overview', [ 'pages' => $pages, 'homepage' => $homepage, 'pageHeading' => $pageHeading, + 'contentModules' => $contentModules, 'statuses' => ContentStatuses::getWithTranslations(), 'module' => isset($module) ? $module : null ]); diff --git a/app/Http/Controllers/Admin/Contents/CreateNewContent.php b/app/Http/Controllers/Admin/Contents/CreateNewContent.php index a1e7eeda..24e047cc 100644 --- a/app/Http/Controllers/Admin/Contents/CreateNewContent.php +++ b/app/Http/Controllers/Admin/Contents/CreateNewContent.php @@ -1,4 +1,5 @@ content = $content; $this->module = $module; - $this->category = $category; $this->template = $template; } @@ -73,7 +66,11 @@ class CreateNewContent extends Controller $statuses = ContentStatuses::getWithTranslations(); $pageHeading = $this->module->getCreateContentTitle($module); $templates = $this->template->getForModule($module); - $categories = $this->category->getForModule($module); + + $categories = new Collection(); + if (class_exists(ICategory::class)) { + $categories = app(ICategory::class)->getForModule($module); + } $page = $this->content->getOne(); diff --git a/app/Http/Controllers/Admin/Contents/EditContent.php b/app/Http/Controllers/Admin/Contents/EditContent.php index 4d628a37..294b987e 100644 --- a/app/Http/Controllers/Admin/Contents/EditContent.php +++ b/app/Http/Controllers/Admin/Contents/EditContent.php @@ -1,4 +1,5 @@ history = $history; $this->file = $file; $this->content = $content; $this->module = $module; - $this->category = $category; $this->template = $template; } @@ -85,9 +75,13 @@ class EditContent extends Controller $module = $this->module->getByHandler($page->moduleHandler); $pageHeading = $this->module->getUpdateContentTitle($module, $page); $templates = $this->template->getForModule($module); - $categories = $this->category->getForModule($module); $history = $this->history->getStructuredHistoryOf($page); + $categories = new Collection(); + if (class_exists(ICategory::class)) { + $categories = app(ICategory::class)->getForModule($module); + } + // render view return view('admin.content.edit', [ 'pageHeading' => $pageHeading, @@ -95,7 +89,8 @@ class EditContent extends Controller 'page' => $page, 'module' => $module, 'categories' => $categories, - 'rootPages' => $this->content->getOverview()->get(), + 'rootPages' => $this->content->getOverview() + ->get(), 'templates' => $templates, 'formSectionNames' => $this->module->call($module, 'getExtendedFormSections'), 'formSections' => $this->module->call($module, 'getExtendedFormInputsEdit'), diff --git a/app/Models/Content/ContentHistory.php b/app/Models/Content/ContentHistory.php index 8b989674..b81d4c59 100644 --- a/app/Models/Content/ContentHistory.php +++ b/app/Models/Content/ContentHistory.php @@ -22,8 +22,12 @@ class ContentHistory extends Model 'new_value', 'old_value' ]; - protected $guarded = []; + /** + * Author of the change + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ public function author() { return $this->belongsTo(User::class, 'user_id'); diff --git a/app/Policies/BasicPolicy.php b/app/Policies/BasicPolicy.php index b3f3943a..eb18ce69 100644 --- a/app/Policies/BasicPolicy.php +++ b/app/Policies/BasicPolicy.php @@ -20,12 +20,11 @@ abstract class BasicPolicy */ public function before(User $user, $ability) { + // check if user can operate on given entity if (!$this->manage($user)) { return false; } - - return null; } /** diff --git a/app/Policies/ContentPolicy.php b/app/Policies/ContentPolicy.php index 86f5fb3e..dc1f7c7d 100644 --- a/app/Policies/ContentPolicy.php +++ b/app/Policies/ContentPolicy.php @@ -21,10 +21,6 @@ class ContentPolicy extends BasicPolicy */ public function update(User $user, Content $content) { -// if (!$user->hasAbility('update-contents-' . $content->module->alias)) { -// return false; -// } - if ($user->id != $content->user_id) { return $user->hasAbility('update-contents') && $user->hasAbility('update-all-contents'); }; @@ -32,21 +28,28 @@ class ContentPolicy extends BasicPolicy return $user->hasAbility('update-contents'); } - public function create(User $user, Content $content) { + /** + * Does given user has permissions to create new content page? + * + * @param User $user + * + * @return bool + */ + public function create(User $user) { return $user->hasAbility('create-contents'); } - public function publish(User $user, Content $content) + public function publish(User $user) { return $user->hasAbility('publish-contents'); } - public function setHomepage(User $user, Content $content) + public function setHomepage(User $user) { return $user->hasAbility('set-homepage-contents'); } - public function viewHistory(User $user, Content $content) { + public function viewHistory(User $user) { return $user->hasAbility('view-history-contents'); } } diff --git a/resources/lang/cs/admin/contents.php b/resources/lang/cs/admin/contents.php index 81a374e6..a48dd961 100644 --- a/resources/lang/cs/admin/contents.php +++ b/resources/lang/cs/admin/contents.php @@ -35,7 +35,7 @@ return [ "noHomepage" => "Domovská stránka není nastavena (a nebo je nastavena jako Koncept)! Vyberte prosím jinou stránku, nebo stávající publikujte.", "noPagesAvailable" => "Nejsou dostupné žádné stránky. Pro zobrazení přehledu nejprve nějakou vytvořte.", "noParentPage" => "-- Nadřazená stránka nevybrána --", - "noTemplates" => "Nelze vytvořit stránku. Pro tento modul neexistuje žádná šablona, která by šla použít pro vykreslení obsahu.", + "noTemplates" => "Pro tento modul neexistuje žádná šablona, která by šla použít pro vykreslení obsahu. Nebude možné tuto stránku zobrazit!", "nothingToEdit" => "Nebyly provedeny žádné změny, proto nedošlo k editaci.", "overview" => "Seznam všech obsahových stránek", "pageDeleted" => "Stránka :name úspěšně smazána.", diff --git a/resources/lang/cs/admin/history.php b/resources/lang/cs/admin/history.php index f0191438..72ed3fa5 100644 --- a/resources/lang/cs/admin/history.php +++ b/resources/lang/cs/admin/history.php @@ -6,7 +6,7 @@ return [ "changedFromTo" => "Změna z :from na :to", "columnCategory" => "Kategorie", "columnFile" => "Přiřazené soubory", - "columnIs_homepage" => "Domovská stránka", + "columnIsHomepage" => "Domovská stránka", "columnMetaDescription" => "Popis", "columnMetaKeywords" => "Klíčová slova", "columnPageContent" => "Obsah stránky", @@ -14,6 +14,7 @@ return [ "columnStatus" => "Viditelnost stránky", "columnTemplate" => "Šablona", "columnTitle" => "Titulek", + "columnTitlePhoto" => "Titulní obrázek", "columnTitlePhotoFilename" => "Titulní obrázek", "columnUrl" => "URL", "deletedFile" => "Odebrán soubor :file.", diff --git a/resources/views/admin/content/overview.blade.php b/resources/views/admin/content/overview.blade.php index ce84dd0c..cc78d006 100644 --- a/resources/views/admin/content/overview.blade.php +++ b/resources/views/admin/content/overview.blade.php @@ -3,13 +3,23 @@ @section('pageHeading', @trans($pageHeading)) @section('headerButtons') - @if($module->exists === true) - @can('create', $module) - - - - @endcan - @endif + @can('create', \App\Models\Content\Content::class) + @if (!empty($contentModules)) + + + @endif + @endcan @endsection @section('content') diff --git a/resources/views/vendor/mail/html/button.blade.php b/resources/views/vendor/mail/html/button.blade.php new file mode 100644 index 00000000..c7aae1b8 --- /dev/null +++ b/resources/views/vendor/mail/html/button.blade.php @@ -0,0 +1,19 @@ + + + + +
+ + + + +
+ + + + +
+ {{ $slot }} +
+
+
diff --git a/resources/views/vendor/mail/html/footer.blade.php b/resources/views/vendor/mail/html/footer.blade.php new file mode 100644 index 00000000..c3f9360a --- /dev/null +++ b/resources/views/vendor/mail/html/footer.blade.php @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/resources/views/vendor/mail/html/header.blade.php b/resources/views/vendor/mail/html/header.blade.php new file mode 100644 index 00000000..eefabab9 --- /dev/null +++ b/resources/views/vendor/mail/html/header.blade.php @@ -0,0 +1,7 @@ + + + + {{ $slot }} + + + diff --git a/resources/views/vendor/mail/html/layout.blade.php b/resources/views/vendor/mail/html/layout.blade.php new file mode 100644 index 00000000..991ae52a --- /dev/null +++ b/resources/views/vendor/mail/html/layout.blade.php @@ -0,0 +1,54 @@ + + + + + + + + + + + + + +
+ + {{ $header or '' }} + + + + + + + {{ $footer or '' }} +
+ + + + + +
+ {{ Illuminate\Mail\Markdown::parse($slot) }} + + {{ $subcopy or '' }} +
+
+
+ + diff --git a/resources/views/vendor/mail/html/message.blade.php b/resources/views/vendor/mail/html/message.blade.php new file mode 100644 index 00000000..2ad23a66 --- /dev/null +++ b/resources/views/vendor/mail/html/message.blade.php @@ -0,0 +1,27 @@ +@component('mail::layout') + {{-- Header --}} + @slot('header') + @component('mail::header', ['url' => config('app.url')]) + {{ config('app.name') }} + @endcomponent + @endslot + + {{-- Body --}} + {{ $slot }} + + {{-- Subcopy --}} + @isset($subcopy) + @slot('subcopy') + @component('mail::subcopy') + {{ $subcopy }} + @endcomponent + @endslot + @endisset + + {{-- Footer --}} + @slot('footer') + @component('mail::footer') + © {{ date('Y') }} {{ config('app.name') }}. All rights reserved. + @endcomponent + @endslot +@endcomponent diff --git a/resources/views/vendor/mail/html/panel.blade.php b/resources/views/vendor/mail/html/panel.blade.php new file mode 100644 index 00000000..f3970802 --- /dev/null +++ b/resources/views/vendor/mail/html/panel.blade.php @@ -0,0 +1,13 @@ + + + + +
+ + + + +
+ {{ Illuminate\Mail\Markdown::parse($slot) }} +
+
diff --git a/resources/views/vendor/mail/html/promotion.blade.php b/resources/views/vendor/mail/html/promotion.blade.php new file mode 100644 index 00000000..0debcf8a --- /dev/null +++ b/resources/views/vendor/mail/html/promotion.blade.php @@ -0,0 +1,7 @@ + + + + +
+ {{ Illuminate\Mail\Markdown::parse($slot) }} +
diff --git a/resources/views/vendor/mail/html/promotion/button.blade.php b/resources/views/vendor/mail/html/promotion/button.blade.php new file mode 100644 index 00000000..8e79081c --- /dev/null +++ b/resources/views/vendor/mail/html/promotion/button.blade.php @@ -0,0 +1,13 @@ + + + + +
+ + + + +
+ {{ $slot }} +
+
diff --git a/resources/views/vendor/mail/html/subcopy.blade.php b/resources/views/vendor/mail/html/subcopy.blade.php new file mode 100644 index 00000000..c3df7b4c --- /dev/null +++ b/resources/views/vendor/mail/html/subcopy.blade.php @@ -0,0 +1,7 @@ + + + + +
+ {{ Illuminate\Mail\Markdown::parse($slot) }} +
diff --git a/resources/views/vendor/mail/html/table.blade.php b/resources/views/vendor/mail/html/table.blade.php new file mode 100644 index 00000000..a5f3348b --- /dev/null +++ b/resources/views/vendor/mail/html/table.blade.php @@ -0,0 +1,3 @@ +
+{{ Illuminate\Mail\Markdown::parse($slot) }} +
diff --git a/resources/views/vendor/mail/html/themes/default.css b/resources/views/vendor/mail/html/themes/default.css new file mode 100644 index 00000000..20659933 --- /dev/null +++ b/resources/views/vendor/mail/html/themes/default.css @@ -0,0 +1,285 @@ +/* Base */ + +body, body *:not(html):not(style):not(br):not(tr):not(code) { + font-family: Avenir, Helvetica, sans-serif; + box-sizing: border-box; +} + +body { + background-color: #f5f8fa; + color: #74787E; + height: 100%; + hyphens: auto; + line-height: 1.4; + margin: 0; + -moz-hyphens: auto; + -ms-word-break: break-all; + width: 100% !important; + -webkit-hyphens: auto; + -webkit-text-size-adjust: none; + word-break: break-all; + word-break: break-word; +} + +p, +ul, +ol, +blockquote { + line-height: 1.4; + text-align: left; +} + +a { + color: #3869D4; +} + +a img { + border: none; +} + +/* Typography */ + +h1 { + color: #2F3133; + font-size: 19px; + font-weight: bold; + margin-top: 0; + text-align: left; +} + +h2 { + color: #2F3133; + font-size: 16px; + font-weight: bold; + margin-top: 0; + text-align: left; +} + +h3 { + color: #2F3133; + font-size: 14px; + font-weight: bold; + margin-top: 0; + text-align: left; +} + +p { + color: #74787E; + font-size: 16px; + line-height: 1.5em; + margin-top: 0; + text-align: left; +} + +p.sub { + font-size: 12px; +} + +img { + max-width: 100%; +} + +/* Layout */ + +.wrapper { + background-color: #f5f8fa; + margin: 0; + padding: 0; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.content { + margin: 0; + padding: 0; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +/* Header */ + +.header { + padding: 25px 0; + text-align: center; +} + +.header a { + color: #bbbfc3; + font-size: 19px; + font-weight: bold; + text-decoration: none; + text-shadow: 0 1px 0 white; +} + +/* Body */ + +.body { + background-color: #FFFFFF; + border-bottom: 1px solid #EDEFF2; + border-top: 1px solid #EDEFF2; + margin: 0; + padding: 0; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.inner-body { + background-color: #FFFFFF; + margin: 0 auto; + padding: 0; + width: 570px; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 570px; +} + +/* Subcopy */ + +.subcopy { + border-top: 1px solid #EDEFF2; + margin-top: 25px; + padding-top: 25px; +} + +.subcopy p { + font-size: 12px; +} + +/* Footer */ + +.footer { + margin: 0 auto; + padding: 0; + text-align: center; + width: 570px; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 570px; +} + +.footer p { + color: #AEAEAE; + font-size: 12px; + text-align: center; +} + +/* Tables */ + +.table table { + margin: 30px auto; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.table th { + border-bottom: 1px solid #EDEFF2; + padding-bottom: 8px; +} + +.table td { + color: #74787E; + font-size: 15px; + line-height: 18px; + padding: 10px 0; +} + +.content-cell { + padding: 35px; +} + +/* Buttons */ + +.action { + margin: 30px auto; + padding: 0; + text-align: center; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.button { + border-radius: 3px; + box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16); + color: #FFF; + display: inline-block; + text-decoration: none; + -webkit-text-size-adjust: none; +} + +.button-blue { + background-color: #3097D1; + border-top: 10px solid #3097D1; + border-right: 18px solid #3097D1; + border-bottom: 10px solid #3097D1; + border-left: 18px solid #3097D1; +} + +.button-green { + background-color: #2ab27b; + border-top: 10px solid #2ab27b; + border-right: 18px solid #2ab27b; + border-bottom: 10px solid #2ab27b; + border-left: 18px solid #2ab27b; +} + +.button-red { + background-color: #bf5329; + border-top: 10px solid #bf5329; + border-right: 18px solid #bf5329; + border-bottom: 10px solid #bf5329; + border-left: 18px solid #bf5329; +} + +/* Panels */ + +.panel { + margin: 0 0 21px; +} + +.panel-content { + background-color: #EDEFF2; + padding: 16px; +} + +.panel-item { + padding: 0; +} + +.panel-item p:last-of-type { + margin-bottom: 0; + padding-bottom: 0; +} + +/* Promotions */ + +.promotion { + background-color: #FFFFFF; + border: 2px dashed #9BA2AB; + margin: 0; + margin-bottom: 25px; + margin-top: 25px; + padding: 24px; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.promotion h1 { + text-align: center; +} + +.promotion p { + font-size: 15px; + text-align: center; +} diff --git a/resources/views/vendor/mail/markdown/button.blade.php b/resources/views/vendor/mail/markdown/button.blade.php new file mode 100644 index 00000000..97444ebd --- /dev/null +++ b/resources/views/vendor/mail/markdown/button.blade.php @@ -0,0 +1 @@ +{{ $slot }}: {{ $url }} diff --git a/resources/views/vendor/mail/markdown/footer.blade.php b/resources/views/vendor/mail/markdown/footer.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/resources/views/vendor/mail/markdown/footer.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/resources/views/vendor/mail/markdown/header.blade.php b/resources/views/vendor/mail/markdown/header.blade.php new file mode 100644 index 00000000..aaa3e575 --- /dev/null +++ b/resources/views/vendor/mail/markdown/header.blade.php @@ -0,0 +1 @@ +[{{ $slot }}]({{ $url }}) diff --git a/resources/views/vendor/mail/markdown/layout.blade.php b/resources/views/vendor/mail/markdown/layout.blade.php new file mode 100644 index 00000000..9378baa0 --- /dev/null +++ b/resources/views/vendor/mail/markdown/layout.blade.php @@ -0,0 +1,9 @@ +{!! strip_tags($header) !!} + +{!! strip_tags($slot) !!} +@isset($subcopy) + +{!! strip_tags($subcopy) !!} +@endisset + +{!! strip_tags($footer) !!} diff --git a/resources/views/vendor/mail/markdown/message.blade.php b/resources/views/vendor/mail/markdown/message.blade.php new file mode 100644 index 00000000..b409c71c --- /dev/null +++ b/resources/views/vendor/mail/markdown/message.blade.php @@ -0,0 +1,27 @@ +@component('mail::layout') + {{-- Header --}} + @slot('header') + @component('mail::header', ['url' => config('app.url')]) + {{ config('app.name') }} + @endcomponent + @endslot + + {{-- Body --}} + {{ $slot }} + + {{-- Subcopy --}} + @isset($subcopy) + @slot('subcopy') + @component('mail::subcopy') + {{ $subcopy }} + @endcomponent + @endslot + @endisset + + {{-- Footer --}} + @slot('footer') + @component('mail::footer') + © {{ date('Y') }} {{ config('app.name') }}. All rights reserved. + @endcomponent + @endslot +@endcomponent diff --git a/resources/views/vendor/mail/markdown/panel.blade.php b/resources/views/vendor/mail/markdown/panel.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/resources/views/vendor/mail/markdown/panel.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/resources/views/vendor/mail/markdown/promotion.blade.php b/resources/views/vendor/mail/markdown/promotion.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/resources/views/vendor/mail/markdown/promotion.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/resources/views/vendor/mail/markdown/promotion/button.blade.php b/resources/views/vendor/mail/markdown/promotion/button.blade.php new file mode 100644 index 00000000..aaa3e575 --- /dev/null +++ b/resources/views/vendor/mail/markdown/promotion/button.blade.php @@ -0,0 +1 @@ +[{{ $slot }}]({{ $url }}) diff --git a/resources/views/vendor/mail/markdown/subcopy.blade.php b/resources/views/vendor/mail/markdown/subcopy.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/resources/views/vendor/mail/markdown/subcopy.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/resources/views/vendor/mail/markdown/table.blade.php b/resources/views/vendor/mail/markdown/table.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/resources/views/vendor/mail/markdown/table.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/routes/admin/contents.php b/routes/admin/contents.php index 4adcfea1..75cf1a08 100644 --- a/routes/admin/contents.php +++ b/routes/admin/contents.php @@ -7,8 +7,8 @@ Route::group(['namespace' => 'Contents'], function () { // form for creating new static page Route::get('content/new/{module}', 'CreateNewContent@create') - ->name('content.new') - ->middleware(['can:create,module', 'can:create,' . \App\Models\Content\Content::class]); + ->name('content.new')// ->middleware(['can:create,module', 'can:create,' . \App\Models\Content\Content::class]); + ->middleware('can:create,' . \App\Models\Content\Content::class); // form for editing existing static page Route::get('content/edit/{page}', 'EditContent@edit') @@ -18,7 +18,8 @@ Route::group(['namespace' => 'Contents'], function () { // post method for creating new static page Route::post('content/new/{module}', 'CreateNewContent@store') ->name('content.newPost') - ->middleware('can:create,module'); + ->middleware('can:create,' . \App\Models\Content\Content::class); + // ->middleware('can:create,module'); // post method for creating new static page Route::post('content/edit/{page}', 'EditContent@update') @@ -46,7 +47,7 @@ Route::group(['namespace' => 'Contents'], function () { ->middleware('can:viewHistory,page'); // history of changes for specified page - Route::get('history/{revision}', 'History@getDiff') + Route::get('history/diff/{revision}', 'History@getDiff') ->name('history.diff') - ->middleware('can:viewHistory,page'); + ->middleware('can:viewHistory,'.\App\Models\Content\Content::class); }); \ No newline at end of file diff --git a/templates/Binarity/Handler.php b/templates/Binarity/Handler.php index 8b4e98e0..88ffaec8 100644 --- a/templates/Binarity/Handler.php +++ b/templates/Binarity/Handler.php @@ -30,6 +30,9 @@ class Handler implements TemplateHandler */ public static function install() { + WidgetArea::where('code', 'mainMenu') + ->delete(); + WidgetArea::create(['deletable' => 0, 'code' => 'mainMenu', 'name' => 'Menu']); }