diff --git a/modules/Blog/Article/Handlers/Article.php b/modules/Blog/Article/Handlers/Article.php index aa8ec0c8..fb4aeb83 100644 --- a/modules/Blog/Article/Handlers/Article.php +++ b/modules/Blog/Article/Handlers/Article.php @@ -3,6 +3,7 @@ namespace Modules\Blog\Article\Handlers; use App\Enumerations\ModulesHandlerToId; use App\Handlers\Handler; +use App\Http\Controllers\Admin\EditContent; use App\Http\Controllers\Controller; use App\Http\Requests\Request; use App\Models\Content; @@ -23,15 +24,18 @@ class Article extends Handler return Controller::VisitorsView($content->template, ['page' => $content]); } - /** - * Load some extra data for content management form? - * - * @param Content $content - * - * @return mixed - */ - public static function loadExtraData(Content $content) + public static function getExtendedFormInputsCreate() { + $sections = parent::getExtendedFormInputsCreate(); + + $sections['basicInfo'] = 'article::admin.content.basicInfo'; + + return $sections; + } + + public static function getExtendedFormInputsEdit() + { + return self::getExtendedFormInputsCreate(); } /** @@ -45,6 +49,7 @@ class Article extends Handler */ public static function createNew(Content &$content, Request $request) { + $content->module_settings = json_encode(['allowComments' => (int)$request->has('allowComments')]); } /** @@ -61,7 +66,17 @@ class Article extends Handler */ public static function edit(Content &$content, Request $request, $revisionID) { - // TODO: Implement edit() method. + $fields = ['allowComments' => 'allowComments']; + + // get data and try to save them + $data = EditContent::getFields($request, $fields); + + $data['allowComments'] = (int) $data['allowComments']; + + list($revision, $changedColumns) = $content->updateWithHistory($fields, $data, $revisionID); + + // return amount of changed columns + return $changedColumns; } /** diff --git a/modules/Blog/Article/Resources/lang/en/article.php b/modules/Blog/Article/Resources/lang/en/article.php index 05e0b10e..2d1e8b44 100644 --- a/modules/Blog/Article/Resources/lang/en/article.php +++ b/modules/Blog/Article/Resources/lang/en/article.php @@ -1,4 +1,6 @@ 'Allow comments?', + 'new' => 'Write new', + 'overview' => 'All articles' ]; \ No newline at end of file diff --git a/modules/Blog/Article/Resources/views/admin/content/basicInfo.blade.php b/modules/Blog/Article/Resources/views/admin/content/basicInfo.blade.php new file mode 100644 index 00000000..e150c58f --- /dev/null +++ b/modules/Blog/Article/Resources/views/admin/content/basicInfo.blade.php @@ -0,0 +1,89 @@ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ + + @if (isset($errors) && $errors->has('status')) +
+ {{ $errors->first('status') }} +
+ @endif +
+
+ +
+ + @if($module->support_categories && count($categories)) +
+ +
+ + @endif +
+ +
+
+ +
+
\ No newline at end of file