From d7a8790cae17f4c5172aab199d03dcc93ba9f9b0 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 9 Feb 2023 15:25:36 +0500 Subject: [PATCH] afisha phone --- plugins/rainlab/blog/models/Post.php | 8 +++++-- plugins/rainlab/blog/models/post/fields.yaml | 21 +++++++++++------ ...der_table_update_rainlab_blog_posts_19.php | 23 +++++++++++++++++++ plugins/rainlab/blog/updates/version.yaml | 3 +++ 4 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 plugins/rainlab/blog/updates/builder_table_update_rainlab_blog_posts_19.php diff --git a/plugins/rainlab/blog/models/Post.php b/plugins/rainlab/blog/models/Post.php index 2f7525638..6aae648b4 100644 --- a/plugins/rainlab/blog/models/Post.php +++ b/plugins/rainlab/blog/models/Post.php @@ -66,7 +66,7 @@ class Post extends Model /** * @var array Attributes to be stored as JSON */ - protected $jsonable = ['metadata', 'more_photo']; + protected $jsonable = ['metadata', 'more_photo', 'afisha_phone_new']; /** * The attributes that should be mutated to dates. @@ -228,7 +228,9 @@ class Post extends Model public function filterFields($fields, $context = null) { - + $fields->tags_ru->hidden = true; + $fields->tags_tm->hidden = true; + $fields->tags_en->hidden = true; // $fields->afisha_phone->value = $fields->category_groupsq->value; // $fields->category_groups->value = $fields->category_groupsq->value; @@ -290,9 +292,11 @@ class Post extends Model if($this->category_groups->where('type', 'afisha')->count()){ $fields->afisha_phone->hidden = false; + $fields->afisha_phone_new->hidden = false; $fields->afisha_address->hidden = false; }else{ $fields->afisha_phone->hidden = true; + $fields->afisha_phone_new->hidden = true; $fields->afisha_address->hidden = true; } } diff --git a/plugins/rainlab/blog/models/post/fields.yaml b/plugins/rainlab/blog/models/post/fields.yaml index 9e36e4871..7dc86620c 100644 --- a/plugins/rainlab/blog/models/post/fields.yaml +++ b/plugins/rainlab/blog/models/post/fields.yaml @@ -145,18 +145,11 @@ secondaryTabs: required: 0 type: balloon-selector tab: 'Category Group' - # category_groups: - # span: left - # path: field_category_group_item - # type: partial - # dependsOn: category_groupsq - # tab: 'Category Group' category_groups: span: left path: field_category_group_item type: relation tab: 'Category Group' - # options: getCategoryGroupsOptions categories: tab: 'Category Group' type: checkboxlist @@ -175,3 +168,17 @@ secondaryTabs: type: text dependsOn: category_groups tab: 'Category Group' + afisha_phone_new: + label: 'Afisha Phones' + prompt: 'Add new phone' + style: default + span: auto + type: repeater + dependsOn: category_groups + tab: 'Category Group' + form: + fields: + phone: + label: Phone + span: full + type: text diff --git a/plugins/rainlab/blog/updates/builder_table_update_rainlab_blog_posts_19.php b/plugins/rainlab/blog/updates/builder_table_update_rainlab_blog_posts_19.php new file mode 100644 index 000000000..026980fca --- /dev/null +++ b/plugins/rainlab/blog/updates/builder_table_update_rainlab_blog_posts_19.php @@ -0,0 +1,23 @@ +text('afisha_phone_new')->nullable(); + }); + } + + public function down() + { + Schema::table('rainlab_blog_posts', function($table) + { + $table->dropColumn('afisha_phone_new'); + }); + } +} diff --git a/plugins/rainlab/blog/updates/version.yaml b/plugins/rainlab/blog/updates/version.yaml index fb30b89c5..ddc95369f 100644 --- a/plugins/rainlab/blog/updates/version.yaml +++ b/plugins/rainlab/blog/updates/version.yaml @@ -174,3 +174,6 @@ 1.5.38: - 'Updated table rainlab_blog_posts' - builder_table_update_rainlab_blog_posts_18.php +1.5.39: + - 'Updated table rainlab_blog_posts' + - builder_table_update_rainlab_blog_posts_19.php