FEATURE #1373: add link to history for static pages
This commit is contained in:
@@ -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'])
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user