diff --git a/app/Handlers/Search/Files.php b/app/Handlers/Search/Files.php index 5105b3c5..79d66bce 100644 --- a/app/Handlers/Search/Files.php +++ b/app/Handlers/Search/Files.php @@ -27,6 +27,7 @@ class Files extends Search $token = $this->tokenize($term); return File::where('original_filename', 'LIKE', $token) + ->orWhere('name', 'LIKE', $token) ->orWhere('keywords', 'LIKE', $token) ->orWhere('description', 'LIKE', $token) ->orWhere('mime_type', 'LIKE', $token) diff --git a/app/Helpers/CurrentTemplate.php b/app/Helpers/CurrentTemplate.php index ff6900cf..9f88dd88 100644 --- a/app/Helpers/CurrentTemplate.php +++ b/app/Helpers/CurrentTemplate.php @@ -46,4 +46,12 @@ class CurrentTemplate return $template->handler; } + + /** + * Reset currently set template and load another one on next call of get() method. + */ + public static function reset() + { + self::$initialized = false; + } } \ No newline at end of file diff --git a/app/Http/Controllers/Admin/Contents/CreateNewContent.php b/app/Http/Controllers/Admin/Contents/CreateNewContent.php index ef1e9dd8..2ccd4ba4 100644 --- a/app/Http/Controllers/Admin/Contents/CreateNewContent.php +++ b/app/Http/Controllers/Admin/Contents/CreateNewContent.php @@ -149,12 +149,12 @@ class CreateNewContent extends Controller $page->title_photo = $file ? $file['filename'] : null; - // let template to modify request and content page - call_user_func_array([CurrentTemplate::handler(), 'beforeSave'], [&$page, $request]); - // save module-specific stuff call_user_func_array([$module->handler, 'createNew'], [&$page, $request]); + // let template to modify request and content page + call_user_func_array([CurrentTemplate::handler(), 'beforeSave'], [&$page, $request]); + // save content of page before (possible) uploading related files $page->save(); diff --git a/app/Http/Controllers/Admin/Contents/EditContent.php b/app/Http/Controllers/Admin/Contents/EditContent.php index 9e5cbe59..f0db70e7 100644 --- a/app/Http/Controllers/Admin/Contents/EditContent.php +++ b/app/Http/Controllers/Admin/Contents/EditContent.php @@ -189,7 +189,7 @@ class EditContent extends Controller // something was changed, inform user return redirect() - ->route('content.edit', ['id' => $page->id]) + ->route('content.overview') ->with('success', trans('admin/contents.successfullyEdited')); } diff --git a/app/Http/Controllers/Admin/Users/EditUser.php b/app/Http/Controllers/Admin/Users/EditUser.php index 71aff98b..c64521f6 100644 --- a/app/Http/Controllers/Admin/Users/EditUser.php +++ b/app/Http/Controllers/Admin/Users/EditUser.php @@ -83,7 +83,7 @@ class EditUser extends Controller Event::fire(new EditUserEvent($user)); return redirect() - ->route('users.detail', ['id' => $id]) + ->back() ->with('success', trans('admin/userManagement.userSuccessfullyEdited')); } } \ No newline at end of file diff --git a/app/Http/Requests/CreateNewContentRequest.php b/app/Http/Requests/CreateNewContentRequest.php index 7284b6ae..df25858b 100644 --- a/app/Http/Requests/CreateNewContentRequest.php +++ b/app/Http/Requests/CreateNewContentRequest.php @@ -15,7 +15,6 @@ class CreateNewContentRequest extends Request 'titlePhoto' => 'image', 'title' => 'required', 'url' => 'required|unique:contents,url', - 'template' => 'required|exists:templates,template_name', 'status' => 'required|in:draft,protected,public', 'title_photo' => 'exists:files,id', 'parentPage' => 'exists:contents,id', diff --git a/app/Http/Requests/EditContentRequest.php b/app/Http/Requests/EditContentRequest.php index f92504b4..e04878e6 100644 --- a/app/Http/Requests/EditContentRequest.php +++ b/app/Http/Requests/EditContentRequest.php @@ -20,7 +20,6 @@ class EditContentRequest extends Request return [ 'title' => 'required', 'url' => 'required|unique:contents,url,' . $this->id, - 'template' => 'required|exists:templates,template_name', 'published_from' => 'date', 'published_to' => 'date', 'title_photo' => 'exists:files,id', diff --git a/modules/ContactForm/Handlers/ContactForm.php b/modules/ContactForm/Handlers/ContactForm.php index 74d8b906..76f0adc4 100644 --- a/modules/ContactForm/Handlers/ContactForm.php +++ b/modules/ContactForm/Handlers/ContactForm.php @@ -2,13 +2,14 @@ namespace Modules\ContactForm\Handlers; use App\Enumerations\ModulesHandlerToId; +use App\Handlers\Contracts\ContentTitles; use App\Handlers\Handler; use App\Http\Controllers\Admin\Contents\EditContent; use App\Http\Requests\Request; use App\Models\Content; use App\Models\User; -class ContactForm extends Handler +class ContactForm extends Handler implements ContentTitles { public static function getHistoryHandler() { @@ -29,7 +30,7 @@ class ContactForm extends Handler $settings = [ 'phone' => $request->phone, 'email' => $request->email, - 'contactEmail' => $request->ContactEmail, + 'contactEmail' => $request->contactEmail, 'subject' => $request->subject, 'companyName' => $request->companyName, 'address' => $request->address, @@ -171,4 +172,38 @@ class ContactForm extends Handler { // nothing to do } + + /** + * Get translated title for pages overview of given type. + * + * This value is used for rendering list of all content pages of given type in administration. + * + * @return string + */ + public static function getOverviewTitle() + { + return trans('contactform::module.allForms'); + } + + /** + * Title displayed above for for creating new content page + * + * @return string + */ + public static function getCreateNewTitle() + { + return trans('contactform::module.newForm'); + } + + /** + * Title for form displayed for editin content page + * + * @param Content $content + * + * @return mixed + */ + public static function getEditTitle(Content $content) + { + return trans('contactform::module.editForm'); + } } \ No newline at end of file diff --git a/modules/ContactForm/Resources/lang/cs/module.php b/modules/ContactForm/Resources/lang/cs/module.php index cc9a1388..c76b9420 100644 --- a/modules/ContactForm/Resources/lang/cs/module.php +++ b/modules/ContactForm/Resources/lang/cs/module.php @@ -1,5 +1,8 @@ "Všechny formuláře", "description" => "Jednoduchý kontaktní formulář", +"editForm" => "Upravuji formulář", "name" => "Kontaktní formulář", +"newForm" => "Vytvořit nový kontaktní formulář", ]; diff --git a/modules/ContactForm/Resources/lang/en/module.php b/modules/ContactForm/Resources/lang/en/module.php index 63e4708e..3e9d374e 100644 --- a/modules/ContactForm/Resources/lang/en/module.php +++ b/modules/ContactForm/Resources/lang/en/module.php @@ -1,5 +1,8 @@ 'Contact form', - 'description' => 'Simple contact form' + 'description' => 'Simple contact form', + 'allForms' => 'All contact forms', + 'newForm' => 'Create new contact form', + 'editForm' => 'Editing contact form' ]; \ No newline at end of file diff --git a/modules/StaticPages/Handlers/StaticPage.php b/modules/StaticPages/Handlers/StaticPage.php index 6c8607ce..128dac6b 100644 --- a/modules/StaticPages/Handlers/StaticPage.php +++ b/modules/StaticPages/Handlers/StaticPage.php @@ -2,13 +2,14 @@ namespace Modules\StaticPages\Handlers; use App\Enumerations\ModulesHandlerToId; +use App\Handlers\Contracts\ContentTitles; use App\Handlers\Handler; use App\Http\Controllers\Controller; use App\Http\Requests\Request; use App\Models\Content; use App\Models\User; -class StaticPage extends Handler +class StaticPage extends Handler implements ContentTitles { public static function registerAdminMenu(User $user) { @@ -97,4 +98,39 @@ class StaticPage extends Handler { // nothing to do } + + + /** + * Get translated title for pages overview of given type. + * + * This value is used for rendering list of all content pages of given type in administration. + * + * @return string + */ + public static function getOverviewTitle() + { + return trans('staticpages::module.allPages'); + } + + /** + * Title displayed above for for creating new content page + * + * @return string + */ + public static function getCreateNewTitle() + { + return trans('staticpages::module.newPage'); + } + + /** + * Title for form displayed for editin content page + * + * @param Content $content + * + * @return mixed + */ + public static function getEditTitle(Content $content) + { + return trans('staticpages::module.editPage'); + } } \ No newline at end of file diff --git a/modules/StaticPages/Resources/lang/cs/module.php b/modules/StaticPages/Resources/lang/cs/module.php index a7e99f44..e0dfbbeb 100644 --- a/modules/StaticPages/Resources/lang/cs/module.php +++ b/modules/StaticPages/Resources/lang/cs/module.php @@ -1,5 +1,8 @@ "Všechny statické stránky", "description" => "Statické stránky jsou určeny k zobrazování statického obsahu na stránkách.", +"editPage" => "Upravuji statickou stránku", "name" => "Statické stránky", +"newPage" => "Vytvářím novou stránku", ]; diff --git a/modules/StaticPages/Resources/lang/en/module.php b/modules/StaticPages/Resources/lang/en/module.php index a263fd12..db22a5b4 100644 --- a/modules/StaticPages/Resources/lang/en/module.php +++ b/modules/StaticPages/Resources/lang/en/module.php @@ -1,5 +1,8 @@ 'Static pages', - 'description' => 'Static pages are intended for displaying static content on webpage.' + 'description' => 'Static pages are intended for displaying static content on webpage.', + 'allPages' => 'All static pages', + 'editPage' => 'Editing static page', + 'newPage' => 'Create new static page' ]; \ No newline at end of file diff --git a/resources/assets/admin/css/vendor.css b/resources/assets/admin/css/vendor.css index 4f1000e0..96315b90 100644 --- a/resources/assets/admin/css/vendor.css +++ b/resources/assets/admin/css/vendor.css @@ -14407,4 +14407,87 @@ img { .card.file-preview .card-block img { width: 100%; +} + + +.tag { + display: inline-block; + padding: 0.25em 0.4em; + font-size: 75%; + font-weight: bold; + line-height: 1; + color: #fff; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + border-radius: 0.25rem; +} + +.tag:empty { + display: none; +} + +.btn .tag { + position: relative; + top: -1px; +} + +a.tag:focus, a.tag:hover { + color: #fff; + text-decoration: none; + cursor: pointer; +} + +.tag-pill { + padding-right: 0.6em; + padding-left: 0.6em; + border-radius: 10rem; +} + +.tag-default { + background-color: #818a91; +} + +.tag-default[href]:focus, .tag-default[href]:hover { + background-color: #687077; +} + +.tag-primary { + background-color: #0275d8; +} + +.tag-primary[href]:focus, .tag-primary[href]:hover { + background-color: #025aa5; +} + +.tag-success { + background-color: #5cb85c; +} + +.tag-success[href]:focus, .tag-success[href]:hover { + background-color: #449d44; +} + +.tag-info { + background-color: #5bc0de; +} + +.tag-info[href]:focus, .tag-info[href]:hover { + background-color: #31b0d5; +} + +.tag-warning { + background-color: #f0ad4e; +} + +.tag-warning[href]:focus, .tag-warning[href]:hover { + background-color: #ec971f; +} + +.tag-danger { + background-color: #d9534f; +} + +.tag-danger[href]:focus, .tag-danger[href]:hover { + background-color: #c9302c; } \ No newline at end of file diff --git a/resources/lang/cs/admin/actionLog.php b/resources/lang/cs/admin/actionLog.php index 305a86df..20ea7793 100644 --- a/resources/lang/cs/admin/actionLog.php +++ b/resources/lang/cs/admin/actionLog.php @@ -3,6 +3,7 @@ return [ "assignWidget" => "Přiřadil widget :widgetName (#:widgetId) do plochy :widgetAreaName (#:widgetAreaId)", "changeSettings" => "Změna nastavení", "createNewContent" => "Vytvořena nová obsahová stránka. Titulek :title, url :url a ID #:id", +"createUser" => "Vytvořen nový uživatel :name s e-mailem :email.", "deleteContent" => 'Smazána stránka ":title", url "url a ID #:id. Tato změna je zaznamenána v revizi :revision.', "deleteCustomField" => "a", "deleteWidgetArea" => "Smazal plochu pro widget :name", @@ -18,6 +19,7 @@ return [ "nameAssignWidget" => "Přiřazení widgetu", "nameChangeSettings" => "Změna nastavení", "nameCreateNewContent" => "Vytvoření nové stránky", +"nameCreateUser" => "Vytvořen uživatel", "nameDeleteContent" => "Smazání stránky", "nameDeleteCustomField" => "Smazání uživatelského pole", "nameDeleteWidgetArea" => "Smazání plochy pro widgety", diff --git a/resources/lang/cs/admin/fileManager.php b/resources/lang/cs/admin/fileManager.php index 0e325749..e3a20e33 100644 --- a/resources/lang/cs/admin/fileManager.php +++ b/resources/lang/cs/admin/fileManager.php @@ -38,5 +38,5 @@ return [ "updatedAt" => "Poslední změna", "upload" => "Nahrát nový soubor", "uploadSuccessfull" => "Soubor úspěšně nahrán|:count soubory úspěšně nahrány|:count souborů úspěšně nahráno", -"url" => "Veřejá URL", +"url" => "Veřejná URL", ]; diff --git a/resources/lang/en/admin/actionLog.php b/resources/lang/en/admin/actionLog.php index 58b02a8b..b5bb3d40 100644 --- a/resources/lang/en/admin/actionLog.php +++ b/resources/lang/en/admin/actionLog.php @@ -6,6 +6,7 @@ return [ 'login' => 'Logged in', 'logout' => 'Logged out', 'userEdit' => 'Updated user :name (:email)', + 'createUser' => 'Created user :name (:email)', 'newCustomField' => 'Added new custom field with ID #:id and name ":name"', 'editCustomField' => 'Edited custom field with ID #:id and name ":name"', 'deleteCustomField' => 'Deleted custom field ID #:id and name ":name"', @@ -42,6 +43,7 @@ return [ 'nameEditWidgetArea' => 'Edit widget area', 'nameInvalidEditContentAttempt' => 'Tried to edit invalid page', 'nameCreateNewContent' => 'Created new page', + 'nameCreateUser' => 'Created new user', 'nameDeleteContent' => 'Deleted page', 'namePublishContent' => 'Published page', 'nameDraftFromContent' => 'Made draft from published page', diff --git a/resources/views/admin/content/formParts/appearance.blade.php b/resources/views/admin/content/formParts/appearance.blade.php index 9dccd625..2e54de54 100644 --- a/resources/views/admin/content/formParts/appearance.blade.php +++ b/resources/views/admin/content/formParts/appearance.blade.php @@ -24,26 +24,28 @@ -
-
- +@if (count($templates)) +
+
+ - + @foreach($templates as $template) + - @endforeach - + + @endforeach + - @include('admin.snippets.hasError', ['field' => 'template']) + @include('admin.snippets.hasError', ['field' => 'template']) +
-
\ No newline at end of file +@endif \ No newline at end of file diff --git a/resources/views/admin/content/overview.blade.php b/resources/views/admin/content/overview.blade.php index c231302a..07247a1b 100644 --- a/resources/views/admin/content/overview.blade.php +++ b/resources/views/admin/content/overview.blade.php @@ -32,7 +32,7 @@
@lang('admin/contents.actions')
@foreach($pages as $page) -
+
-
{{$statuses[$page->status]}}
+
+ {{$statuses[$page->status]}} +
{{trans($page->module_name)}} diff --git a/resources/views/admin/fileManager/filesTiles.blade.php b/resources/views/admin/fileManager/filesTiles.blade.php index eee274d6..7dc60913 100644 --- a/resources/views/admin/fileManager/filesTiles.blade.php +++ b/resources/views/admin/fileManager/filesTiles.blade.php @@ -1,6 +1,4 @@ -
@forelse($files as $file) -
@include('admin.snippets.card', [ 'body' => ''.\App\Helpers\FileManager::getPreview($file).'', @@ -17,5 +15,4 @@
@lang('admin/fileManager.noFiles')
- @endforelse -
\ No newline at end of file + @endforelse \ No newline at end of file diff --git a/resources/views/admin/userManagement/detail.blade.php b/resources/views/admin/userManagement/detail.blade.php index fe2eca6d..0a8cc60c 100644 --- a/resources/views/admin/userManagement/detail.blade.php +++ b/resources/views/admin/userManagement/detail.blade.php @@ -2,6 +2,11 @@ @section('pageHeading', trans('admin/userManagement.profile')) @section('pageDescription', @trans('admin/userManagement.detail', ['name' => $user->name, 'email' => $user->email])) +@section('headerButtons') + + + +@endsection @section('content') diff --git a/resources/views/admin/userManagement/edit.blade.php b/resources/views/admin/userManagement/edit.blade.php index aed103e4..a1240547 100644 --- a/resources/views/admin/userManagement/edit.blade.php +++ b/resources/views/admin/userManagement/edit.blade.php @@ -1,6 +1,11 @@ @extends('admin.layoutWithNavigation') @section('pageHeading', @trans('admin/userManagement.editUser', ['name' => str_limit($user->name, 20), 'email' => $user->email])) +@section('headerButtons') + + + +@endsection @section('content')
diff --git a/templates/Base/OnePage/Handlers/OnePage.php b/templates/Base/OnePage/Handlers/OnePage.php index 91c4a681..fff9ad05 100644 --- a/templates/Base/OnePage/Handlers/OnePage.php +++ b/templates/Base/OnePage/Handlers/OnePage.php @@ -2,6 +2,7 @@ namespace Templates\Base\OnePage\Handlers; use App\Handlers\Contracts\TemplateHandler; +use App\Helpers\CurrentTemplate; use App\Helpers\PageRenderer; use App\Helpers\Settings; use App\Helpers\Template; @@ -10,7 +11,12 @@ use App\Models\Content; use App\Models\Module; use App\Models\Settings as SettingsModel; use App\Models\User; +use App\Models\Widget; +use App\Models\WidgetArea; +use App\Models\WidgetInWidgetArea; +use App\Models\WidgetType; use Illuminate\Support\Facades\Auth; +use Templates\Base\OnePage\Widgets\OnePageMenu\OnePageMenu; abstract class OnePage implements TemplateHandler { @@ -133,6 +139,32 @@ abstract class OnePage implements TemplateHandler foreach ($types as $type) { ActionLogType::create($type); } + + // try to create onepage menu widget + $widgetName = OnePageMenu::getName(); + $widgetDescription = OnePageMenu::getDescription(); + + CurrentTemplate::reset(); + + // create row in widget types + WidgetType::create([ + 'handler' => OnePageMenu::class, + 'name' => $widgetName, + 'module_id' => null, + 'template_id' => CurrentTemplate::get()->id, + 'description' => $widgetDescription + ]); + + $area = WidgetArea::create(['name' => 'Top menu', 'code' => 'topMenu', 'deletable' => 0]); + $widget = Widget::create([ + 'widget_type_handler' => OnePageMenu::class, + 'name' => 'Menu', + 'settings' => '{"containerClass": null}', + 'deletable' => 0 + ]); + + // bind widget with widget area + WidgetInWidgetArea::create(['widget_id' => $widget->id, 'widget_area_id' => $area->id, 'position' => 1]); } /**