FEATURE #1373: add link to history for static pages

This commit is contained in:
Michal Kváček
2016-02-05 16:18:18 +01:00
parent 620a5545d8
commit aeabe03911
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'])
]);
}