FIX: fix content dependency on categories

This commit is contained in:
Michal Kváček
2017-08-24 02:50:30 +02:00
parent ac8e3aeacc
commit 5abd7d9151
36 changed files with 574 additions and 71 deletions
+3 -4
View File
@@ -1,5 +1,7 @@
# published files from modules
/modules /modules
/templates
# published files from modules
/public/modules /public/modules
/public/assets /public/assets
/resources/views/modules /resources/views/modules
@@ -10,9 +12,6 @@
**/views/**/custom/* **/views/**/custom/*
!**/views/**/custom/.gitkeep !**/views/**/custom/.gitkeep
# module config - generated in ModuleManager service provider
**/module.json
# uploaded files # uploaded files
/public/uploads/* /public/uploads/*
!/public/uploads/.gitkeep !/public/uploads/.gitkeep
+3 -4
View File
@@ -17,8 +17,7 @@ class History implements HistoryHandler
switch ($changeset->column) { switch ($changeset->column) {
case 'pageContent': case 'pageContent':
$route = route('history.diff', [ $route = route('history.diff', [
'revision' => $changeset->edit_batch, 'revision' => $changeset->id
'id' => $changeset->id
]); ]);
return "(<a href='" . $route . "'>" . trans('admin/history.diff') . "</a>)"; return "(<a href='" . $route . "'>" . trans('admin/history.diff') . "</a>)";
@@ -48,8 +47,8 @@ class History implements HistoryHandler
break; break;
default: default:
return trans('admin/history.changedFromTo', [ return trans('admin/history.changedFromTo', [
'from' => is_null($changeset->old_value) ? trans('admin/history.emptyValue') : $changeset->old_value, 'from' => empty($changeset->old_value) ? trans('admin/history.emptyValue') : $changeset->old_value,
'to' => is_null($changeset->new_value) ? trans('admin/history.emptyValue') : $changeset->new_value, 'to' => empty($changeset->new_value) ? trans('admin/history.emptyValue') : $changeset->new_value,
]); ]);
break; break;
} }
+10 -11
View File
@@ -15,13 +15,11 @@ class InstallModule extends Command
{ {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
*
* @var string * @var string
*/ */
protected $signature = 'module:install {name} {parentModuleId?}'; protected $signature = 'module:install {name} {parentModuleId?}';
/** /**
* The console command description. * The console command description.
*
* @var string * @var string
*/ */
protected $description = 'Custom installation of CMS module. Name given as directory name in /modules.'; 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. * Create a new command instance.
*
* @return void * @return void
*/ */
public function __construct() public function __construct()
@@ -56,8 +53,9 @@ class InstallModule extends Command
// get config // get config
$config = $this->loadConfig(); $config = $this->loadConfig();
if (empty($config)) if (empty($config)) {
return; return;
}
// check if it is valid // check if it is valid
$this->checkMandatoryFields($config); $this->checkMandatoryFields($config);
@@ -69,14 +67,15 @@ class InstallModule extends Command
Cache::forget('enabled-modules'); Cache::forget('enabled-modules');
Cache::forget('module-handler-to-id-enumeration'); Cache::forget('module-handler-to-id-enumeration');
exec('composer dump-autoload');
// inform user // 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 * Load config from Config/config.php in module files. We cannot use config() because the file have not published
* yet. * yet.
*
* @return array * @return array
* @throws FileNotFoundException * @throws FileNotFoundException
*/ */
@@ -85,8 +84,9 @@ class InstallModule extends Command
$basePath = $this->modulesPath . DIRECTORY_SEPARATOR . $this->moduleName . DIRECTORY_SEPARATOR; $basePath = $this->modulesPath . DIRECTORY_SEPARATOR . $this->moduleName . DIRECTORY_SEPARATOR;
$path = $basePath . 'Config' . DIRECTORY_SEPARATOR . 'config.php'; $path = $basePath . 'Config' . DIRECTORY_SEPARATOR . 'config.php';
if (basename($basePath) == 'Database') if (basename($basePath) == 'Database') {
return []; return [];
}
// check if module has Config/config.php file // check if module has Config/config.php file
if (!file_exists($path)) { if (!file_exists($path)) {
@@ -121,7 +121,6 @@ class InstallModule extends Command
/** /**
* Installs module into database. * Installs module into database.
*
* This method calls Module::install, which handles specific installation of module. In this way we should be able * 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. * to install any module even with some other database structures.
* *
@@ -155,9 +154,9 @@ class InstallModule extends Command
if (is_null($module)) { if (is_null($module)) {
// insert module into database // insert module into database
$settings = [ $settings = [
'providers' => $providers, 'providers' => $providers,
'order' => isset($config['order']) ? $config['order'] : 0, 'order' => isset($config['order']) ? $config['order'] : 0,
'files' => isset($config['files']) ? $config['files'] : [] 'files' => isset($config['files']) ? $config['files'] : []
]; ];
$module = Installer::install($name, $alias, $this->moduleName, $description, $handler, $this->parentModuleId, $settings); $module = Installer::install($name, $alias, $this->moduleName, $description, $handler, $this->parentModuleId, $settings);
+1 -1
View File
@@ -59,7 +59,7 @@ class SetTemplate extends Command
} }
try { 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) { } catch (\Exception $e) {
$this->error('Cannot install template ' . $template . '. Message: ' . $e->getMessage()); $this->error('Cannot install template ' . $template . '. Message: ' . $e->getMessage());
return; return;
@@ -46,10 +46,13 @@ class ContentOverview extends Controller
// get homepage - for checking if homepage is set and available // get homepage - for checking if homepage is set and available
$homepage = $this->content->getHomepage(); $homepage = $this->content->getHomepage();
$contentModules = app(\App\CMS\Repositories\Module::class)->getContentModules();
return view('admin.content.overview', [ return view('admin.content.overview', [
'pages' => $pages, 'pages' => $pages,
'homepage' => $homepage, 'homepage' => $homepage,
'pageHeading' => $pageHeading, 'pageHeading' => $pageHeading,
'contentModules' => $contentModules,
'statuses' => ContentStatuses::getWithTranslations(), 'statuses' => ContentStatuses::getWithTranslations(),
'module' => isset($module) ? $module : null 'module' => isset($module) ? $module : null
]); ]);
@@ -1,4 +1,5 @@
<?php <?php
namespace App\Http\Controllers\Admin\Contents; namespace App\Http\Controllers\Admin\Contents;
use App\CMS\Contracts\Repositories\Content as IContent; use App\CMS\Contracts\Repositories\Content as IContent;
@@ -11,13 +12,12 @@ use App\Http\Controllers\Admin\Controller;
use App\Http\Requests\CreateNewContentRequest; use App\Http\Requests\CreateNewContentRequest;
use App\Http\Requests\Request; use App\Http\Requests\Request;
use App\Models\Module; use App\Models\Module;
use Illuminate\Support\Collection;
use Modules\Categories\Contracts\Repositories\Category as ICategory; use Modules\Categories\Contracts\Repositories\Category as ICategory;
/** /**
* Class CreateNewContent * Class CreateNewContent
*
* Controller for creating new content page. * Controller for creating new content page.
*
* @package App\Http\Controllers\Admin\Contents * @package App\Http\Controllers\Admin\Contents
*/ */
class CreateNewContent extends Controller class CreateNewContent extends Controller
@@ -30,10 +30,6 @@ class CreateNewContent extends Controller
* @var IModuleRepository * @var IModuleRepository
*/ */
private $module; private $module;
/**
* @var ICategory
*/
private $category;
/** /**
* @var ITemplate * @var ITemplate
*/ */
@@ -41,23 +37,20 @@ class CreateNewContent extends Controller
/** /**
* CreateNewContent constructor. * CreateNewContent constructor.
*
* Sets File and Content models into class variables * Sets File and Content models into class variables
* *
* @param IContent|Content $content * @param IContent|Content $content
* @param IModuleRepository $module * @param IModuleRepository $module
* @param ICategory $category * @param ICategory $category
*
* @param ITemplate $template * @param ITemplate $template
* *
* @internal param File $file * @internal param File $file
*/ */
public function __construct(IContent $content, IModuleRepository $module, ICategory $category, ITemplate $template) public function __construct(IContent $content, IModuleRepository $module, ITemplate $template)
{ {
parent::__construct(); parent::__construct();
$this->content = $content; $this->content = $content;
$this->module = $module; $this->module = $module;
$this->category = $category;
$this->template = $template; $this->template = $template;
} }
@@ -73,7 +66,11 @@ class CreateNewContent extends Controller
$statuses = ContentStatuses::getWithTranslations(); $statuses = ContentStatuses::getWithTranslations();
$pageHeading = $this->module->getCreateContentTitle($module); $pageHeading = $this->module->getCreateContentTitle($module);
$templates = $this->template->getForModule($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(); $page = $this->content->getOne();
@@ -1,4 +1,5 @@
<?php <?php
namespace App\Http\Controllers\Admin\Contents; namespace App\Http\Controllers\Admin\Contents;
use App\CMS\Contracts\Repositories\Content as IContent; use App\CMS\Contracts\Repositories\Content as IContent;
@@ -6,20 +7,15 @@ use App\CMS\Contracts\Repositories\Module as IModuleRepository;
use App\CMS\Contracts\Repositories\Template as ITemplate; use App\CMS\Contracts\Repositories\Template as ITemplate;
use App\CMS\Enumerations\ContentStatuses; use App\CMS\Enumerations\ContentStatuses;
use App\Cms\Handlers\Interactions\Interaction; use App\Cms\Handlers\Interactions\Interaction;
use App\CMS\Helpers\CurrentTemplate;
use App\Cms\Interactions\Admin\Content\EditContent as EditContentInteraction; use App\Cms\Interactions\Admin\Content\EditContent as EditContentInteraction;
use App\Events\AttemptToEditInvalidContent;
use App\Http\Controllers\Admin\Controller; use App\Http\Controllers\Admin\Controller;
use App\Http\Requests\EditContentRequest; use App\Http\Requests\EditContentRequest;
use App\Http\Requests\Request; use App\Http\Requests\Request;
use App\Models\Content\Content; use App\Models\Content\Content;
use App\Models\Content\ContentHistory; use App\Models\Content\ContentHistory;
use App\Models\FileManager\File; use App\Models\FileManager\File;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Gate;
use Modules\Categories\Contracts\Repositories\Category as ICategory; use Modules\Categories\Contracts\Repositories\Category as ICategory;
use Modules\Categories\Repositories\Category;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class EditContent extends Controller class EditContent extends Controller
{ {
@@ -39,10 +35,6 @@ class EditContent extends Controller
* @var IModuleRepository * @var IModuleRepository
*/ */
private $module; private $module;
/**
* @var ICategory
*/
private $category;
/** /**
* @var ITemplate * @var ITemplate
*/ */
@@ -50,7 +42,6 @@ class EditContent extends Controller
/** /**
* EditContent constructor. * EditContent constructor.
*
* Load ContentHistory and File into this controller * Load ContentHistory and File into this controller
* *
* @param ContentHistory $history * @param ContentHistory $history
@@ -60,13 +51,12 @@ class EditContent extends Controller
* @param ICategory $category * @param ICategory $category
* @param ITemplate $template * @param ITemplate $template
*/ */
public function __construct(ContentHistory $history, File $file, IContent $content, IModuleRepository $module, Category $category, ITemplate $template) public function __construct(ContentHistory $history, File $file, IContent $content, IModuleRepository $module, ITemplate $template)
{ {
$this->history = $history; $this->history = $history;
$this->file = $file; $this->file = $file;
$this->content = $content; $this->content = $content;
$this->module = $module; $this->module = $module;
$this->category = $category;
$this->template = $template; $this->template = $template;
} }
@@ -85,9 +75,13 @@ class EditContent extends Controller
$module = $this->module->getByHandler($page->moduleHandler); $module = $this->module->getByHandler($page->moduleHandler);
$pageHeading = $this->module->getUpdateContentTitle($module, $page); $pageHeading = $this->module->getUpdateContentTitle($module, $page);
$templates = $this->template->getForModule($module); $templates = $this->template->getForModule($module);
$categories = $this->category->getForModule($module);
$history = $this->history->getStructuredHistoryOf($page); $history = $this->history->getStructuredHistoryOf($page);
$categories = new Collection();
if (class_exists(ICategory::class)) {
$categories = app(ICategory::class)->getForModule($module);
}
// render view // render view
return view('admin.content.edit', [ return view('admin.content.edit', [
'pageHeading' => $pageHeading, 'pageHeading' => $pageHeading,
@@ -95,7 +89,8 @@ class EditContent extends Controller
'page' => $page, 'page' => $page,
'module' => $module, 'module' => $module,
'categories' => $categories, 'categories' => $categories,
'rootPages' => $this->content->getOverview()->get(), 'rootPages' => $this->content->getOverview()
->get(),
'templates' => $templates, 'templates' => $templates,
'formSectionNames' => $this->module->call($module, 'getExtendedFormSections'), 'formSectionNames' => $this->module->call($module, 'getExtendedFormSections'),
'formSections' => $this->module->call($module, 'getExtendedFormInputsEdit'), 'formSections' => $this->module->call($module, 'getExtendedFormInputsEdit'),
+5 -1
View File
@@ -22,8 +22,12 @@ class ContentHistory extends Model
'new_value', 'new_value',
'old_value' 'old_value'
]; ];
protected $guarded = [];
/**
* Author of the change
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function author() public function author()
{ {
return $this->belongsTo(User::class, 'user_id'); return $this->belongsTo(User::class, 'user_id');
+1 -2
View File
@@ -20,12 +20,11 @@ abstract class BasicPolicy
*/ */
public function before(User $user, $ability) public function before(User $user, $ability)
{ {
// check if user can operate on given entity // check if user can operate on given entity
if (!$this->manage($user)) { if (!$this->manage($user)) {
return false; return false;
} }
return null;
} }
/** /**
+11 -8
View File
@@ -21,10 +21,6 @@ class ContentPolicy extends BasicPolicy
*/ */
public function update(User $user, Content $content) public function update(User $user, Content $content)
{ {
// if (!$user->hasAbility('update-contents-' . $content->module->alias)) {
// return false;
// }
if ($user->id != $content->user_id) { if ($user->id != $content->user_id) {
return $user->hasAbility('update-contents') && $user->hasAbility('update-all-contents'); return $user->hasAbility('update-contents') && $user->hasAbility('update-all-contents');
}; };
@@ -32,21 +28,28 @@ class ContentPolicy extends BasicPolicy
return $user->hasAbility('update-contents'); 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'); return $user->hasAbility('create-contents');
} }
public function publish(User $user, Content $content) public function publish(User $user)
{ {
return $user->hasAbility('publish-contents'); return $user->hasAbility('publish-contents');
} }
public function setHomepage(User $user, Content $content) public function setHomepage(User $user)
{ {
return $user->hasAbility('set-homepage-contents'); return $user->hasAbility('set-homepage-contents');
} }
public function viewHistory(User $user, Content $content) { public function viewHistory(User $user) {
return $user->hasAbility('view-history-contents'); return $user->hasAbility('view-history-contents');
} }
} }
+1 -1
View File
@@ -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.", "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.", "noPagesAvailable" => "Nejsou dostupné žádné stránky. Pro zobrazení přehledu nejprve nějakou vytvořte.",
"noParentPage" => "-- Nadřazená stránka nevybrána --", "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.", "nothingToEdit" => "Nebyly provedeny žádné změny, proto nedošlo k editaci.",
"overview" => "Seznam všech obsahových stránek", "overview" => "Seznam všech obsahových stránek",
"pageDeleted" => "Stránka :name úspěšně smazána.", "pageDeleted" => "Stránka :name úspěšně smazána.",
+2 -1
View File
@@ -6,7 +6,7 @@ return [
"changedFromTo" => "Změna z <del>:from</del> na <ins>:to</ins>", "changedFromTo" => "Změna z <del>:from</del> na <ins>:to</ins>",
"columnCategory" => "Kategorie", "columnCategory" => "Kategorie",
"columnFile" => "Přiřazené soubory", "columnFile" => "Přiřazené soubory",
"columnIs_homepage" => "Domovská stránka", "columnIsHomepage" => "Domovská stránka",
"columnMetaDescription" => "Popis", "columnMetaDescription" => "Popis",
"columnMetaKeywords" => "Klíčová slova", "columnMetaKeywords" => "Klíčová slova",
"columnPageContent" => "Obsah stránky", "columnPageContent" => "Obsah stránky",
@@ -14,6 +14,7 @@ return [
"columnStatus" => "Viditelnost stránky", "columnStatus" => "Viditelnost stránky",
"columnTemplate" => "Šablona", "columnTemplate" => "Šablona",
"columnTitle" => "Titulek", "columnTitle" => "Titulek",
"columnTitlePhoto" => "Titulní obrázek",
"columnTitlePhotoFilename" => "Titulní obrázek", "columnTitlePhotoFilename" => "Titulní obrázek",
"columnUrl" => "URL", "columnUrl" => "URL",
"deletedFile" => "Odebrán soubor <del>:file</del>.", "deletedFile" => "Odebrán soubor <del>:file</del>.",
@@ -3,13 +3,23 @@
@section('pageHeading', @trans($pageHeading)) @section('pageHeading', @trans($pageHeading))
@section('headerButtons') @section('headerButtons')
@if($module->exists === true) @can('create', \App\Models\Content\Content::class)
@can('create', $module) @if (!empty($contentModules))
<a href="{{route('content.new', ['module' => $module])}}" class="btn btn-primary btn-sm rounded"> <div class="dropdown show d-inline">
<i class="fa fa-plus"></i> <a class="btn btn-secondary rounded btn-sm dropdown-toggle" href="#" id="contentModulesDropdown"
</a> data-toggle="dropdown" aria-expanded="false"><i class="fa fa-plus"></i></a>
@endcan
@endif <div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
@foreach ($contentModules as $contentModule)
<a class="dropdown-item"
href="{{route('content.new', ['module' => $contentModule])}}">{{trans($contentModule->name)}}</a>
@endforeach
</div>
</div>
@endif
@endcan
@endsection @endsection
@section('content') @section('content')
+19
View File
@@ -0,0 +1,19 @@
<table class="action" align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<a href="{{ $url }}" class="button button-{{ $color or 'blue' }}" target="_blank">{{ $slot }}</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
+11
View File
@@ -0,0 +1,11 @@
<tr>
<td>
<table class="footer" align="center" width="570" cellpadding="0" cellspacing="0">
<tr>
<td class="content-cell" align="center">
{{ Illuminate\Mail\Markdown::parse($slot) }}
</td>
</tr>
</table>
</td>
</tr>
+7
View File
@@ -0,0 +1,7 @@
<tr>
<td class="header">
<a href="{{ $url }}">
{{ $slot }}
</a>
</td>
</tr>
+54
View File
@@ -0,0 +1,54 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<style>
@media only screen and (max-width: 600px) {
.inner-body {
width: 100% !important;
}
.footer {
width: 100% !important;
}
}
@media only screen and (max-width: 500px) {
.button {
width: 100% !important;
}
}
</style>
<table class="wrapper" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<table class="content" width="100%" cellpadding="0" cellspacing="0">
{{ $header or '' }}
<!-- Email Body -->
<tr>
<td class="body" width="100%" cellpadding="0" cellspacing="0">
<table class="inner-body" align="center" width="570" cellpadding="0" cellspacing="0">
<!-- Body content -->
<tr>
<td class="content-cell">
{{ Illuminate\Mail\Markdown::parse($slot) }}
{{ $subcopy or '' }}
</td>
</tr>
</table>
</td>
</tr>
{{ $footer or '' }}
</table>
</td>
</tr>
</table>
</body>
</html>
+27
View File
@@ -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')
&copy; {{ date('Y') }} {{ config('app.name') }}. All rights reserved.
@endcomponent
@endslot
@endcomponent
+13
View File
@@ -0,0 +1,13 @@
<table class="panel" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="panel-content">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="panel-item">
{{ Illuminate\Mail\Markdown::parse($slot) }}
</td>
</tr>
</table>
</td>
</tr>
</table>
+7
View File
@@ -0,0 +1,7 @@
<table class="promotion" align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
{{ Illuminate\Mail\Markdown::parse($slot) }}
</td>
</tr>
</table>
@@ -0,0 +1,13 @@
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<a href="{{ $url }}" class="button button-green" target="_blank">{{ $slot }}</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
+7
View File
@@ -0,0 +1,7 @@
<table class="subcopy" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
{{ Illuminate\Mail\Markdown::parse($slot) }}
</td>
</tr>
</table>
+3
View File
@@ -0,0 +1,3 @@
<div class="table">
{{ Illuminate\Mail\Markdown::parse($slot) }}
</div>
+285
View File
@@ -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;
}
+1
View File
@@ -0,0 +1 @@
{{ $slot }}: {{ $url }}
+1
View File
@@ -0,0 +1 @@
{{ $slot }}
+1
View File
@@ -0,0 +1 @@
[{{ $slot }}]({{ $url }})
+9
View File
@@ -0,0 +1,9 @@
{!! strip_tags($header) !!}
{!! strip_tags($slot) !!}
@isset($subcopy)
{!! strip_tags($subcopy) !!}
@endisset
{!! strip_tags($footer) !!}
+27
View File
@@ -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
+1
View File
@@ -0,0 +1 @@
{{ $slot }}
@@ -0,0 +1 @@
{{ $slot }}
@@ -0,0 +1 @@
[{{ $slot }}]({{ $url }})
@@ -0,0 +1 @@
{{ $slot }}
+1
View File
@@ -0,0 +1 @@
{{ $slot }}
+6 -5
View File
@@ -7,8 +7,8 @@ Route::group(['namespace' => 'Contents'], function () {
// form for creating new static page // form for creating new static page
Route::get('content/new/{module}', 'CreateNewContent@create') Route::get('content/new/{module}', 'CreateNewContent@create')
->name('content.new') ->name('content.new')// ->middleware(['can:create,module', 'can:create,' . \App\Models\Content\Content::class]);
->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 // form for editing existing static page
Route::get('content/edit/{page}', 'EditContent@edit') Route::get('content/edit/{page}', 'EditContent@edit')
@@ -18,7 +18,8 @@ Route::group(['namespace' => 'Contents'], function () {
// post method for creating new static page // post method for creating new static page
Route::post('content/new/{module}', 'CreateNewContent@store') Route::post('content/new/{module}', 'CreateNewContent@store')
->name('content.newPost') ->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 // post method for creating new static page
Route::post('content/edit/{page}', 'EditContent@update') Route::post('content/edit/{page}', 'EditContent@update')
@@ -46,7 +47,7 @@ Route::group(['namespace' => 'Contents'], function () {
->middleware('can:viewHistory,page'); ->middleware('can:viewHistory,page');
// history of changes for specified page // history of changes for specified page
Route::get('history/{revision}', 'History@getDiff') Route::get('history/diff/{revision}', 'History@getDiff')
->name('history.diff') ->name('history.diff')
->middleware('can:viewHistory,page'); ->middleware('can:viewHistory,'.\App\Models\Content\Content::class);
}); });
+3
View File
@@ -30,6 +30,9 @@ class Handler implements TemplateHandler
*/ */
public static function install() public static function install()
{ {
WidgetArea::where('code', 'mainMenu')
->delete();
WidgetArea::create(['deletable' => 0, 'code' => 'mainMenu', 'name' => 'Menu']); WidgetArea::create(['deletable' => 0, 'code' => 'mainMenu', 'name' => 'Menu']);
} }