FEATURE #1507: modularize content management

This commit is contained in:
Michal Kváček
2016-03-11 15:43:11 +01:00
parent 3407707046
commit 9f5bd46ca3
23 changed files with 1018 additions and 19 deletions
@@ -0,0 +1,14 @@
@extends('admin.layout')
@section('pageName', @trans('admin/contents.edit', ['name' => $page->title]))
@section('content')
<div class="row">
<h2>@lang('admin/contents.edit', ['name' => $page->title])</h2>
</div>
<div class="row">
@include('admin.content.editForm')
</div>
@stop
@@ -0,0 +1,37 @@
@if (session('success'))
<div data-alert class="callout success">
<strong>{{ session('success') }}</strong>
</div>
@endif
@if (session('error'))
<div data-alert class="callout alert">
<strong>{{ session('error') }}</strong>
</div>
@endif
<form method="POST" action="{{route('content.editPost', ['pageId' => $page->id])}}">
{!! csrf_field() !!}
@include('admin.content.formInputs')
<div class="row">
<div class="columns large-6">
<button type="submit" class="button success">@lang('admin/contents.edit', ['name' => $page->title])</button>
</div>
@if ($historySize > 0)
<div class="columns text-right large-6">
<a class="button warning" href="{{route('content.history', ['id' => $page->id])}}">@lang('admin/contents.showHistory', ['count' => $historySize])</a>
</div>
@endif
</div>
</form>
@section('javascripts')
<script src="{{asset('../resources/assets/js/vendor/ckeditor/ckeditor.js')}}"></script>
<script type="application/javascript">
CKEDITOR.replace ('pageContent');
</script>
@stop
@@ -0,0 +1,17 @@
<ul class="tabs" data-tabs id="static-page-controls">
@foreach($formSectionNames as $section => $sectionName)
<li class="tabs-title @if($sectionName == reset($formSectionNames)) is-active @endif">
<a href="#{{$section}}" @if($sectionName == reset($formSectionNames)) aria-selected="true" @endif>
{{trans($sectionName)}}
</a>
</li>
@endforeach
</ul>
<div class="tabs-content" data-tabs-content="static-page-controls">
@foreach($formSections as $section => $view)
<div class="tabs-panel @if($view == reset($formSections)) is-active @endif" id="{{$section}}">
@include($view)
</div>
@endforeach
</div>
@@ -0,0 +1,27 @@
<div class="row">
<div class="columns large-12">
<label>
@lang('admin/contents.template')
<select 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>
@if (isset($errors) && $errors->has('template'))
<div class="callout alert">
{{ $errors->first('template') }}
</div>
@endif
</label>
</div>
</div>
@@ -0,0 +1,56 @@
<div class="row">
<div class="columns large-6">
<label>
@lang('admin/contents.field_title')
<input type="text" name="title" placeholder="@lang('admin/contents.field_title')"
value="{{old('title', $page->title)}}" />
</label>
</div>
<div class="columns large-6">
<label>
@lang('admin/contents.field_url')
<input type="text" name="url" placeholder="@lang('admin/contents.field_url')"
value="{{old('url', $page->url)}}" />
@if (isset($errors) && $errors->has('url'))
<div class="callout alert">
{{ $errors->first('url') }}
</div>
@endif
</label>
</div>
</div>
<div class="row">
<div class="columns large-12">
<label>
<select name="status">
@foreach($contentStatuses as $status => $translation)
<option value="{{$status}}" @if(old('status', $page->status) == $status) selected @endif>
{{$translation}}
</option>
@endforeach
</select>
</label>
@if (isset($errors) && $errors->has('status'))
<div class="callout alert">
{{ $errors->first('status') }}
</div>
@endif
</div>
</div>
<div class="row">
<div class="columns large-12">
<label>
<textarea name="pageContent" id="pageContent" class="wysiwyg-editor">
{{old('pageContent', $page->content)}}
</textarea>
</label>
</div>
</div>
@@ -0,0 +1,21 @@
<div class="row">
<div class="columns large-12">
<label>
@lang('admin/contents.field_meta_keywords')
<input type="text" name="meta_keywords" value="{{old('meta_keywords', $page->meta_keywords)}}"
placeholder="@lang('admin/contents.field_meta_keywords')" />
</label>
</div>
</div>
<div class="row">
<div class="columns large-12">
<label>
@lang('admin/contents.field_meta_description')
<textarea name="meta_description"
placeholder="@lang('admin/contents.field_meta_description')" rows="5">{{old('meta_description', $page->meta_description)}}
</textarea>
</label>
</div>
</div>
@@ -0,0 +1,31 @@
<div class="row">
<div class="columns large-6">
<label>
@lang('admin/contents.field_published_from')
<input type="datetime" name="published_from" value="{{old('published_from', $page->published_from)}}"
placeholder="@lang('admin/contents.field_published_from')" />
@if (isset($errors) && $errors->has('published_from'))
<div class="callout alert">
{{ $errors->first('published_from') }}
</div>
@endif
</label>
</div>
<div class="columns large-6">
<label>
@lang('admin/contents.field_published_to')
<input type="datetime" name="published_to" value="{{old('published_to', $page->published_to)}}"
placeholder="@lang('admin/contents.field_published_to')" />
@if (isset($errors) && $errors->has('published_to'))
<div class="callout alert">
{{ $errors->first('published_to') }}
</div>
@endif
</label>
</div>
</div>
@@ -0,0 +1,14 @@
@extends('admin.layout')
@section('pageName', @trans('admin/contents.new', ['name' => $moduleName]))
@section('content')
<div class="row">
<h2>@lang('admin/contents.new', ['name' => $moduleName])</h2>
</div>
<div class="row">
@include('admin.content.newForm')
</div>
@stop
@@ -0,0 +1,31 @@
@if (session('success'))
<div data-alert class="callout success">
<strong>{{ session('success') }}</strong>
</div>
@endif
@if (session('error'))
<div data-alert class="callout alert">
<strong>{{ session('error') }}</strong>
</div>
@endif
<form method="POST" action="{{route('content.newPost', ['moduleId' => $moduleId])}}">
{!! csrf_field() !!}
@include('admin.content.formInputs')
<div class="row">
<div class="columns large-12">
<button type="submit" class="button success">@lang('admin/contents.save')</button>
</div>
</div>
</form>
@section('javascripts')
<script src="{{asset('../resources/assets/js/vendor/ckeditor/ckeditor.js')}}"></script>
<script type="application/javascript">
CKEDITOR.replace ('pageContent');
</script>
@stop
@@ -0,0 +1,77 @@
@extends('admin/layout')
@section('content')
<div class="row">
<h1>@lang('admin/contents.overview')</h1>
@if (session('success'))
<div data-alert class="callout success">
<strong>{{ session('success') }}</strong>
</div>
@endif
@if (session('error'))
<div data-alert class="callout alert">
<strong>{{ session('error') }}</strong>
</div>
@endif
</div>
<div class="row" id="static-page-overview" data-equalizer>
@forelse($pages as $page)
<div class="columns large-3">
<div class="page callout" data-equalizer-watch>
<h4>{{$page->title}}</h4>
<span class="date">{{date('d.m.Y', strtotime($page->created_at))}}</span>
<span class="author">{{$page->author_name}}</span>
<br />
<span class="moduleName">@lang($page->module_name)</span>
<p class="perex">
@if (trim($page->meta_description))
{{str_limit($page->meta_description)}}
@else
{{str_limit(strip_tags($page->content))}}
@endif
</p>
@if ($page->meta_keywords)
<p class="keywords">{{$page->meta_keywords}}</p>
@endif
<p class="controls row text-center">
<a href="{{route('page.content', ['url' => $page->url])}}" class="button tiny secondary has-tip" data-tooltip aria-haspopup="true" title="@lang('admin/contents.viewPage')"><i class="fa fa-desktop"></i></a>
@if($page->is_homepage)
<a class="button tiny disabled"><i class="fa fa-home"></i></a>
@else
<a href="{{route('content.setHomepage', ['id' => $page->id])}}" class="button tiny success has-tip" data-tooltip aria-haspopup="true" title="@lang('admin/contents.setHomepage', ['name' => $page->title])"><i class="fa fa-home"></i></a>
@endif
<a href="{{route('content.edit', ['id' => $page->id])}}" class="button tiny success has-tip" data-tooltip aria-haspopup="true" title="@lang('admin/contents.edit', ['name' => $page->title])"><i class="fa fa-edit"></i></a>
@if($page->status == \App\Models\Content::STATUS_DRAFT)
<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" title="@lang('admin/contents.makePublic')"><i class="fa fa-eye"></i></a>
<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" title="@lang('admin/contents.makeProtected')"><i class="fa fa-lock"></i></a>
@endif
@if(in_array($page->status, [\App\Models\Content::STATUS_PROTECTED, \App\Models\Content::STATUS_PUBLIC]))
<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" title="@lang('admin/contents.makeDraft')"><i class="fa fa-eye-slash"></i></a>
@endif
<a href="{{route('content.delete', ['id' => $page->id])}}" class="button tiny alert confirm has-tip" data-tooltip aria-haspopup="true" title="@lang('admin/contents.deletePage')"><i class="fa fa-remove"></i></a>
</p>
</div>
</div>
@empty
<em>@lang('admin/contents.noPagesAvailable')</em>
@endforelse
</div>
<div class="row">
{{$pages->render()}}
</div>
@stop