Merge branch 'dev' into test.customwristbands.cz

This commit is contained in:
Michal Kváček
2016-04-06 20:19:27 +02:00
11 changed files with 194 additions and 112 deletions
+22 -2
View File
@@ -5,11 +5,28 @@ use App\Models\WidgetArea;
class WidgetAreas class WidgetAreas
{ {
/**
* @var array list of inicialized widget areas
*/
protected static $widgetAreas = [];
/**
* Renderer for whole widget area.
*
* @param $uniqueCode
*
* @return mixed
*/
public static function render($uniqueCode) public static function render($uniqueCode)
{ {
$widgetArea = new WidgetArea(); if (isset(self::$widgetAreas[$uniqueCode])) {
echo self::$widgetAreas[$uniqueCode];
return;
}
$widgets = $widgetArea->getWidgets($uniqueCode)->get(); $widgetArea = new WidgetArea();
$widgets = $widgetArea->getWidgets($uniqueCode)
->get();
$content = ''; $content = '';
foreach ($widgets as $widget) { foreach ($widgets as $widget) {
@@ -19,6 +36,9 @@ class WidgetAreas
$content .= call_user_func([$presenter, 'render'], json_decode($widget->settings)); $content .= call_user_func([$presenter, 'render'], json_decode($widget->settings));
} }
// cache this widget area
self::$widgetAreas[$uniqueCode] = $content;
echo $content; echo $content;
} }
} }
@@ -39,7 +39,7 @@ class ContentOverview extends Controller
} }
// get pages for overview // get pages for overview
$pages = $this->content->getOverview($moduleFilterHandler, $status, true) $pages = $this->content->getOverview($moduleFilterHandler, $status, true, true)
->paginate($perPage); ->paginate($perPage);
// get homepage - for checking if homepage is set and available // get homepage - for checking if homepage is set and available
+15 -5
View File
@@ -99,7 +99,8 @@ class Content extends Model
* *
* @return bool * @return bool
*/ */
public function isDraft() { public function isDraft()
{
return $this->status == self::STATUS_DRAFT; return $this->status == self::STATUS_DRAFT;
} }
@@ -108,7 +109,8 @@ class Content extends Model
* *
* @return bool * @return bool
*/ */
public function isPublic() { public function isPublic()
{
return $this->status == self::STATUS_PUBLIC; return $this->status == self::STATUS_PUBLIC;
} }
@@ -117,7 +119,8 @@ class Content extends Model
* *
* @return bool * @return bool
*/ */
public function isProtected() { public function isProtected()
{
return $this->status == self::STATUS_PROTECTED; return $this->status == self::STATUS_PROTECTED;
} }
@@ -126,7 +129,8 @@ class Content extends Model
* *
* @return bool * @return bool
*/ */
public function isVisible() { public function isVisible()
{
return $this->isPublic() || $this->isProtected(); return $this->isPublic() || $this->isProtected();
} }
@@ -157,7 +161,7 @@ class Content extends Model
* *
* @return * @return
*/ */
public function getOverview($handler = false, $status = false, $joinAuthor = false) public function getOverview($handler = false, $status = false, $joinAuthor = false, $joinParent = false)
{ {
$query = DB::table('contents') $query = DB::table('contents')
->select('contents.*', 'modules.name AS module_name') ->select('contents.*', 'modules.name AS module_name')
@@ -177,6 +181,12 @@ class Content extends Model
->addSelect('users.email AS author_email'); ->addSelect('users.email AS author_email');
} }
if ($joinParent) {
$query = $query->join('contents as parent', 'parent.id', '=', 'contents.parent_id')
->addSelect('parent.title AS parent_title')
->addSelect('parent.url AS parent_url');
}
// add filtering by status // add filtering by status
if (in_array($status, ContentStatuses::getSimple())) { if (in_array($status, ContentStatuses::getSimple())) {
$query = $query->where('contents.status', $status); $query = $query->where('contents.status', $status);
+2
View File
@@ -134,6 +134,8 @@ class AppServiceProvider extends ServiceProvider
$registrator->register('basic', 'admin/settings.basic', 'admin.settings.parts.basic'); $registrator->register('basic', 'admin/settings.basic', 'admin.settings.parts.basic');
$registrator->register('meta', 'admin/settings.meta', 'admin.settings.parts.meta'); $registrator->register('meta', 'admin/settings.meta', 'admin.settings.parts.meta');
$registrator->register('social', 'admin/settings.socialSites', 'admin.settings.parts.social');
} }
/** /**
+1 -1
View File
@@ -62,7 +62,7 @@ class Menu implements WidgetRenderer
$page = $pages[$pageId]; $page = $pages[$pageId];
$active = false; $active = false;
if ($route == 'page.content' && isset($parameters['url']) && $parameters['url'] == $page->url) { if (($page->is_homepage && $route == 'page.index') || ($route == 'page.content' && isset($parameters['url']) && $parameters['url'] == $page->url)) {
$active = true; $active = true;
} }
+21 -28
View File
@@ -99,38 +99,31 @@ code {
left: 0; left: 0;
} }
#static-page-overview .page {
position: relative;
padding-bottom: 3em;
}
#static-page-overview .page .controls {
position: absolute;
bottom: 0;
}
#static-page-overview .page .controls .button {
margin-bottom: 10px;
}
#static-page-overview .date, #static-page-overview .author {
font-size: 80%;
}
#static-page-overview .perex {
}
#static-page-overview .keywords {
margin-bottom: 0;
font-size: 80%;
}
#appearance .title-photo img { #appearance .title-photo img {
max-height: 10em; max-height: 10em;
} }
.page img {
max-height: 7em;
}
.page .parent, .page .date, .page .author {
font-style: italic;
font-size: 75%;
}
.page.draft {
opacity: 0.5;
}
.page.draft:hover {
opacity: 1;
}
.page.protected {
border-color: orange;
}
.red { .red {
color: red; color: red;
} }
+9 -6
View File
@@ -19,11 +19,11 @@ return [
'field_published_to' => 'Published to', 'field_published_to' => 'Published to',
'successfullyCreated' => 'Page successfully created', 'successfullyCreated' => 'Page successfully created',
'noPagesAvailable' => 'No static pages available. Try to create one first.', 'noPagesAvailable' => 'No static pages available. Try to create one first.',
'viewPage' => 'View page on web', 'viewPage' => 'View',
'deletePage' => 'Delete page (ireversible!)', 'deletePage' => 'Delete',
'makePublic' => 'Publish page', 'makePublic' => 'Publish',
'makeProtected' => 'Publish page only for logged users', 'makeProtected' => 'Logged users only',
'makeDraft' => 'Disable page and make it draft', 'makeDraft' => 'Make draft',
'invalidStatus' => 'Cannot change status to something undefined.', 'invalidStatus' => 'Cannot change status to something undefined.',
'statusChanged' => 'Status successfully changed.', 'statusChanged' => 'Status successfully changed.',
'invalidPage' => 'Specified page does not exist.', 'invalidPage' => 'Specified page does not exist.',
@@ -39,5 +39,8 @@ return [
'noParentPage' => ' -- No parent page -- ', 'noParentPage' => ' -- No parent page -- ',
'uploadTitleImage' => 'Upload title image', 'uploadTitleImage' => 'Upload title image',
'noHomepage' => 'You have not set up your homepage yet, or your current homepage is draft! Try to select another one.', 'noHomepage' => 'You have not set up your homepage yet, or your current homepage is draft! Try to select another one.',
'homepageProtected' => 'Your homepage is displayed only for logged in users. This may or may not be an error.' 'homepageProtected' => 'Your homepage is displayed only for logged in users. This may or may not be an error.',
'parentPage' => 'Parent page',
'alreadyHomepage' => 'Homepage'
]; ];
+10 -1
View File
@@ -10,5 +10,14 @@ return [
'author' => 'Page owner', 'author' => 'Page owner',
'successfullySaved' => 'Settings successfully saved', 'successfullySaved' => 'Settings successfully saved',
'nothingToSave' => 'You have submitted unchanged form. Try to change some attribute first.', 'nothingToSave' => 'You have submitted unchanged form. Try to change some attribute first.',
'meta' => 'Meta information' 'meta' => 'Meta information',
'socialSites' => 'Social networks',
'social' => [
'facebook' => 'Facebook profile',
'instagram' => 'Instagram profile',
'twitter' => 'Twitter profile',
'pinterest' => 'Pinterest profile',
'gplus' => 'G+ profile'
]
]; ];
@@ -15,8 +15,8 @@
<li class="accordion-item" data-accordion-item> <li class="accordion-item" data-accordion-item>
<a class="accordion-title"> <a class="accordion-title">
<img src="{{\App\Helpers\Gravatar::img($action->email, 20)}}" alt="{{$action->email}}" /> <img src="{{\App\Helpers\Gravatar::img($action->email, 20)}}" alt="{{$action->email}}" />
{{date('d.m.Y', strtotime($action->created_at))}} |
<strong>{{$action->name}}</strong> <strong>{{$action->name}}</strong>
{{date('d.m.Y', strtotime($action->created_at))}}
</a> </a>
<div class="accordion-content" data-tab-content> <div class="accordion-content" data-tab-content>
<div class="row"> <div class="row">
@@ -1,17 +1,33 @@
<div class="row" id="static-page-overview" data-equalizer data-equalize-by-row="true">
@forelse($pages as $page) @forelse($pages as $page)
<div class="columns @if(!isset($tileClass)) large-3 @else {{$tileClass}} @endif"> <div class="page callout page {{$page->status}} row">
<div class="page callout" data-equalizer-watch>
@if ($page->title_photo) <div class="row column">
<img src="{{config('app.upload_url')}}/{{$page->title_photo}}" alt="" /> @if ($page->parent_id && $page->parent_url)
<span class="parent">
@lang('admin/contents.parentPage'):
<a href="{{route('content.edit', ['id' => $page->parent_id])}}">{{$page->parent_title}}</a>,
</span>
@endif @endif
<span class="author">{{$page->author_name}}</span>,
<h4>{{$page->title}}</h4>
<span class="date">{{date('d.m.Y', strtotime($page->created_at))}}</span> <span class="date">{{date('d.m.Y', strtotime($page->created_at))}}</span>
<span class="author">{{$page->author_name}}</span>
<br /> </div>
<span class="moduleName">@lang($page->module_name)</span>
<div class="column large-1">
@if ($page->title_photo)
<a href="{{route('content.edit', ['id' => $page->id])}}">
<img src="@upload($page->title_photo)" class="float-left" alt="" />
</a>
@endif
</div>
<div class="column large-8">
<h4>
<a href="{{route('content.edit', ['id' => $page->id])}}">
{{$page->title}}
<small>(@lang($page->module_name))</small>
</a>
</h4>
<p class="perex"> <p class="perex">
@if (trim($page->meta_description)) @if (trim($page->meta_description))
@@ -20,48 +36,48 @@
{{str_limit(strip_tags($page->content))}} {{str_limit(strip_tags($page->content))}}
@endif @endif
</p> </p>
</div>
@if ($page->meta_keywords) <div class="controls column float-right large-3">
<p class="keywords">{{$page->meta_keywords}}</p>
@endif
<p class="controls row text-center">
@if($page->is_homepage) @if($page->is_homepage)
<a class="button tiny disabled"><i class="fa fa-home"></i></a> <a class="button tiny disabled">
<i class="fa fa-home"></i>
@lang('admin/contents.alreadyHomepage')
</a>
@else @else
<a href="{{route('content.setHomepage', ['id' => $page->id])}}" <a href="{{route('content.setHomepage', ['id' => $page->id])}}"
class="button tiny success has-tip" data-tooltip aria-haspopup="true" class="button tiny success">
title="@lang('admin/contents.setHomepage', ['name' => $page->title])"><i <i class="fa fa-home"></i>
class="fa fa-home"></i></a> @lang('admin/contents.setHomepage')
</a>
@endif @endif
<a href="{{route('content.edit', ['id' => $page->id])}}" class="button tiny success has-tip" <a href="{{route('content.edit', ['id' => $page->id])}}" class="button tiny success">
data-tooltip aria-haspopup="true" <i class="fa fa-edit"></i>
title="@lang('admin/contents.edit', ['name' => $page->title])"><i class="fa fa-edit"></i></a> @lang('admin/contents.edit', ['name' => $page->title])
</a>
@if($page->status == \App\Models\Content::STATUS_DRAFT) @if($page->status == \App\Models\Content::STATUS_DRAFT)
<a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => \App\Models\Content::STATUS_PUBLIC])}}" <a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => \App\Models\Content::STATUS_PUBLIC])}}"
class="button tiny success confirm has-tip" data-tooltip aria-haspopup="true" class="button tiny success confirm">
title="@lang('admin/contents.makePublic')"><i class="fa fa-eye"></i></a> <i class="fa fa-eye"></i> @lang('admin/contents.makePublic')</a>
<a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => \App\Models\Content::STATUS_PROTECTED])}}" <a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => \App\Models\Content::STATUS_PROTECTED])}}"
class="button tiny warning confirm has-tip" data-tooltip aria-haspopup="true" class="button tiny warning confirm">
title="@lang('admin/contents.makeProtected')"><i class="fa fa-lock"></i></a> <i class="fa fa-lock"></i> @lang('admin/contents.makeProtected')</a>
@else @else
<a href="{{route('page.content', ['url' => $page->url])}}" target="_blank" <a href="{{route('page.content', ['url' => $page->url])}}" target="_blank"
class="button tiny secondary has-tip" data-tooltip aria-haspopup="true" class="button tiny secondary"><i
title="@lang('admin/contents.viewPage')"><i class="fa fa-desktop"></i></a> class="fa fa-desktop"></i> @lang('admin/contents.viewPage')</a>
<a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => \App\Models\Content::STATUS_DRAFT])}}" <a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => \App\Models\Content::STATUS_DRAFT])}}"
class="button tiny warning confirm has-tip" data-tooltip aria-haspopup="true" class="button tiny warning confirm"><i
title="@lang('admin/contents.makeDraft')"><i class="fa fa-eye-slash"></i></a> class="fa fa-eye-slash"></i> @lang('admin/contents.makeDraft')</a>
@endif @endif
<a href="{{route('content.delete', ['id' => $page->id])}}" <a href="{{route('content.delete', ['id' => $page->id])}}"
class="button tiny alert confirm has-tip" data-tooltip aria-haspopup="true" class="button tiny alert confirm"><i
title="@lang('admin/contents.deletePage')"><i class="fa fa-remove"></i></a> class="fa fa-remove"></i> @lang('admin/contents.deletePage')</a>
</p>
</div> </div>
</div> </div>
@empty @empty
<em>@lang('admin/contents.noPagesAvailable')</em> <em>@lang('admin/contents.noPagesAvailable')</em>
@endforelse @endforelse
</div>
@@ -0,0 +1,29 @@
<label>
@lang('admin/settings.social.facebook')
<input type="text" name="facebookProfile" value="{{old('facebookProfile', isset($settings->facebookProfile) ? $settings->facebookProfile : '')}}" />
</label>
<label>
@lang('admin/settings.social.twitter')
<input type="text" name="twitterProfile" value="{{old('twitterProfile', isset($settings->twitterProfile) ? $settings->twitterProfile : '')}}" />
</label>
<label>
@lang('admin/settings.social.pinterest')
<input type="text" name="pinterestProfile" value="{{old('pinterestProfile', isset($settings->pinterestProfile) ? $settings->pinterestProfile : '')}}" />
</label>
<label>
@lang('admin/settings.social.gplus')
<input type="text" name="gplusProfile" value="{{old('gplusProfile', isset($settings->gplusProfile) ? $settings->gplusProfile : '')}}" />
</label>
<label>
@lang('admin/settings.social.instagram')
<input type="text" name="instagramProfile" value="{{old('instagramProfile', isset($settings->instagramProfile) ? $settings->instagramProfile : '')}}" />
</label>