Merge branch 'dev' into doucovanineratovice.cz

This commit is contained in:
Michal Kváček
2016-09-27 22:52:57 +02:00
23 changed files with 261 additions and 38 deletions
+1
View File
@@ -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)
+8
View File
@@ -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;
}
}
@@ -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();
@@ -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'));
}
@@ -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'));
}
}
@@ -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',
-1
View File
@@ -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',
+37 -2
View File
@@ -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');
}
}
@@ -1,5 +1,8 @@
<?php
return [
"allForms" => "Všechny formuláře",
"description" => "Jednoduchý kontaktní formulář",
"editForm" => "Upravuji formulář",
"name" => "Kontaktní formulář",
"newForm" => "Vytvořit nový kontaktní formulář",
];
@@ -1,5 +1,8 @@
<?php
return [
'name' => 'Contact form',
'description' => 'Simple contact form'
'description' => 'Simple contact form',
'allForms' => 'All contact forms',
'newForm' => 'Create new contact form',
'editForm' => 'Editing contact form'
];
+37 -1
View File
@@ -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');
}
}
@@ -1,5 +1,8 @@
<?php
return [
"allPages" => "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",
];
@@ -1,5 +1,8 @@
<?php
return [
'name' => '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'
];
+83
View File
@@ -14408,3 +14408,86 @@ 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;
}
+2
View File
@@ -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 <strong>:title</strong>, 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",
+1 -1
View File
@@ -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",
];
+2
View File
@@ -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',
@@ -24,26 +24,28 @@
</div>
</div>
<div class="row">
<div class="col-lg-12">
<label class="control-label">
@lang('admin/contents.template')
</label>
@if (count($templates))
<div class="row">
<div class="col-lg-12">
<label class="control-label">
@lang('admin/contents.template')
</label>
<select class="form-control" name="template">
@foreach($templates as $template)
<option value="{{$template->template_name}}"
@if(old('template', $page->template) == $template->template_name) selected @endif>
{{$template->name}}
@if($template->description != '')
- {{str_limit($template->description, 60)}}
@endif
<select class="form-control" name="template">
@foreach($templates as $template)
<option value="{{$template->template_name}}"
@if(old('template', $page->template) == $template->template_name) selected @endif>
{{$template->name}}
@if($template->description != '')
- {{str_limit($template->description, 60)}}
@endif
</option>
@endforeach
</select>
</option>
@endforeach
</select>
@include('admin.snippets.hasError', ['field' => 'template'])
@include('admin.snippets.hasError', ['field' => 'template'])
</div>
</div>
</div>
@endif
@@ -32,7 +32,7 @@
<div class="col-xs-2 col-lg-1">@lang('admin/contents.actions')</div>
</div>
@foreach($pages as $page)
<div class="row p-tb-15">
<div class="row p-tb-15 @if($page->is_homepage) bold @endif">
<div class="col-md-1 hidden-sm-down text-center with-placeholder">
<a href="{{route('content.edit', ['id' => $page->id])}}">
@if(!view()->exists(\App\Helpers\Template::name($page->template, false)))
@@ -40,7 +40,8 @@
title="@lang('admin/contents.invalidTemplateSelected')"></i>
@else
@if(!empty($page->title_photo))
<img src="@thumbnail($page->title_photo)" class="placeholder" alt="{{$page->title}}" />
<img src="@thumbnail($page->title_photo)" class="placeholder"
alt="{{$page->title}}" />
@else
<img src="{{asset('resources/assets/admin/img/placeholder.png')}}"
class="placeholder"
@@ -54,7 +55,11 @@
{{$page->title}}
</a>
</div>
<div class="col-lg-2 col-md-3 hidden-sm-down">{{$statuses[$page->status]}}</div>
<div class="col-lg-2 col-md-3 hidden-sm-down">
<span class="tag @if($page->status == \App\Models\Content::STATUS_PUBLIC) tag-success
@elseif ($page->status == \App\Models\Content::STATUS_DRAFT) tag-danger
@else tag-warning @endif">{{$statuses[$page->status]}}</span>
</div>
<div class="col-lg-2 col-md-3 hidden-sm-down">
<a href="{{route('content.overview', ['moduleId' => $page->module_id])}}">
{{trans($page->module_name)}}
@@ -1,6 +1,4 @@
<div class="row">
@forelse($files as $file)
<div class="col-sm-4 col-md-3 text-center">
@include('admin.snippets.card', [
'body' => '<a href="'.route('upload.detail', ['id' => $file->id]).'">'.\App\Helpers\FileManager::getPreview($file).'</a>',
@@ -18,4 +16,3 @@
<em>@lang('admin/fileManager.noFiles')</em>
</div>
@endforelse
</div>
@@ -2,6 +2,11 @@
@section('pageHeading', trans('admin/userManagement.profile'))
@section('pageDescription', @trans('admin/userManagement.detail', ['name' => $user->name, 'email' => $user->email]))
@section('headerButtons')
<a href="{{route('users.overview')}}" class="btn btn-secondary btn-sm rounded" title="@lang('admin/userManagement.overview')">
<i class="fa fa-list"></i>
</a>
@endsection
@section('content')
@@ -1,6 +1,11 @@
@extends('admin.layoutWithNavigation')
@section('pageHeading', @trans('admin/userManagement.editUser', ['name' => str_limit($user->name, 20), 'email' => $user->email]))
@section('headerButtons')
<a href="{{route('users.overview')}}" class="btn btn-secondary btn-sm rounded" title="@lang('admin/userManagement.overview')">
<i class="fa fa-list"></i>
</a>
@endsection
@section('content')
<div class="row">
@@ -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]);
}
/**