diff --git a/plugins/rainlab/blog/models/Post.php b/plugins/rainlab/blog/models/Post.php index 51b0e642f..fb64b6dc9 100644 --- a/plugins/rainlab/blog/models/Post.php +++ b/plugins/rainlab/blog/models/Post.php @@ -44,7 +44,8 @@ class Post extends Model 'powerseo_keywords' => 'required', 'excerpt' => 'required', 'awtor' => 'required', - 'img_source' => 'required' + 'img_source' => ['required', 'not_in:orient,orientnews,Orient,OrientNews,Orient News,Orient news,orient news,ORIENT NEWS,ORIENT,NEWS,orient news,news'], + 'author_name' => 'required' ]; /** @@ -178,14 +179,12 @@ class Post extends Model { if(isset($this->awtor)){ if($this->awtor->type == 'other'){ - $fields->author_name->hidden = false; - }elseif(isset($fields->author_name)){ - //$fields->author_name->value = null; - $fields->author_name->hidden = true; + $fields->author_name->value = ''; + $fields->author_name->readOnly = false; + }elseif(isset($fields->author_name)){ + $fields->author_name->value = $this->awtor->name; + $fields->author_name->readOnly = true; } - }else{ - //$fields->author_name->hidden = true; - return; } if(isset($fields->category_groups)){ @@ -555,6 +554,9 @@ class Post extends Model public function scopeFilterId($query, $id) { + if(!isset($id)){ + return; + } return $query->where('id', $id); } diff --git a/plugins/rainlab/blog/models/post/fields.yaml b/plugins/rainlab/blog/models/post/fields.yaml index dc87c69ac..bf31fa9ac 100644 --- a/plugins/rainlab/blog/models/post/fields.yaml +++ b/plugins/rainlab/blog/models/post/fields.yaml @@ -67,9 +67,8 @@ secondaryTabs: author_name: label: 'Author Name' span: auto - hidden: 1 - dependsOn: - - awtor + dependsOn: awtor + readOnly: true type: text tab: 'rainlab.blog::lang.post.tab_manage' featured: diff --git a/themes/modern2/pages/new/afisha-post.htm b/themes/modern2/pages/new/afisha-post.htm index 5666ebaee..7f37d5708 100644 --- a/themes/modern2/pages/new/afisha-post.htm +++ b/themes/modern2/pages/new/afisha-post.htm @@ -75,6 +75,13 @@ function onStart(){
+ +
+ {% if post.featured_image %} + {{post.title}} + {% endif %} +
+
@@ -104,11 +111,9 @@ function onStart(){
-
- {% if post.featured_image %} - {{post.title}} - {% endif %} -
+ + +
{{post.content|md}}