Merge branch 'dev' into history

This commit is contained in:
Michal Kváček
2016-02-05 17:03:22 +01:00
3 changed files with 26 additions and 3 deletions
@@ -3,6 +3,7 @@ namespace Modules\StaticPages\Http\Controllers\Admin;
use App\Enumerations\ContentStatuses;
use App\Models\Content;
use App\Models\ContentHistory;
use Illuminate\Support\Facades\Event;
use Modules\StaticPages\Events\DeleteStaticPage;
use Modules\StaticPages\Events\EditStaticPage as EditStaticPageEvent;
@@ -13,6 +14,16 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class EditStaticPage extends Controller
{
/**
* @var ContentHistory
*/
private $history;
public function __construct(ContentHistory $history)
{
$this->history = $history;
}
/**
* Display form for editing static page
*
@@ -29,10 +40,13 @@ class EditStaticPage extends Controller
$page = Content::where('module_handler', config('staticpages.handler'))
->findOrFail($id);
$history = $this->history->getStructuredHistoryOf($page);
// render view
return view('staticpages::admin.edit', [
'contentStatuses' => $statuses,
'page' => $page
'page' => $page,
'historySize' => count($history['changesets'])
]);
}
@@ -26,6 +26,7 @@ return [
'invalidPage' => 'Specified page does not exist.',
'pageDeleted' => 'Page :name (:url) successfully deleted.',
'nothingToEdit' => 'You did not submit any changes. Nothing was edited.',
'successfullyEdited' => 'Edit successfull'
'successfullyEdited' => 'Edit successfull',
'showHistory' => 'History (:count)'
];
@@ -13,6 +13,7 @@
<form method="POST" action="{{route('staticpage.editPost', ['id' => $page->id])}}">
{!! csrf_field() !!}
<div class="row">
<ul class="tabs" data-tabs id="static-page-controls">
<li class="tabs-title is-active">
<a href="#basic-info" aria-selected="true">@lang('staticpages::admin.basicInfo')</a>
@@ -141,11 +142,18 @@
</div>
</div>
</div>
</div>
<div class="row">
<div class="columns large-12">
<div class="columns large-6">
<button type="submit" class="button success">@lang('staticpages::admin.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('staticpages::admin.showHistory', ['count' => $historySize])</a>
</div>
@endif
</div>
</form>