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