FEATURE: add saving templates to static pages
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
namespace Modules\StaticPages\Http\Controllers\Admin;
|
||||
|
||||
use App\Enumerations\ContentStatuses;
|
||||
use App\Enumerations\ModulesHandlerToId;
|
||||
use App\Models\Content;
|
||||
use App\Models\ContentHistory;
|
||||
use App\Models\Template;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Modules\StaticPages\Events\DeleteStaticPage;
|
||||
use Modules\StaticPages\Events\EditStaticPage as EditStaticPageEvent;
|
||||
@@ -40,12 +42,19 @@ class EditStaticPage extends Controller
|
||||
$page = Content::where('module_handler', config('staticpages.handler'))
|
||||
->findOrFail($id);
|
||||
|
||||
$allModules = ModulesHandlerToId::getWithTranslations();
|
||||
$moduleId = $allModules[config('staticpages.handler')];
|
||||
$templates = Template::where('module_id', $moduleId)
|
||||
->select(['template_name', 'name', 'description'])
|
||||
->get();
|
||||
|
||||
$history = $this->history->getStructuredHistoryOf($page);
|
||||
|
||||
// render view
|
||||
return view('staticpages::admin.edit', [
|
||||
'contentStatuses' => $statuses,
|
||||
'page' => $page,
|
||||
'templates' => $templates,
|
||||
'historySize' => count($history['changesets'])
|
||||
]);
|
||||
}
|
||||
@@ -75,6 +84,7 @@ class EditStaticPage extends Controller
|
||||
$fields = [
|
||||
'title' => 'title',
|
||||
'url' => 'url',
|
||||
'template' => 'template',
|
||||
'published_from' => 'publishedFrom',
|
||||
'published_to' => 'publishedTo',
|
||||
'meta_keywords' => 'metaKeywords',
|
||||
|
||||
Reference in New Issue
Block a user