updates 18.12

This commit is contained in:
Kerim 2022-12-18 13:28:49 +05:00
parent 8cd156e362
commit d65495c00f
16 changed files with 274 additions and 88 deletions

View File

@ -27,7 +27,7 @@ class CategoriesV2Controller extends Controller
public function index(){
$data = $this->CategoryGroup::select('id','name','type_post', 'media', 'event', 'note')
$data = $this->CategoryGroup::select('id','name','type', 'note')
->with(['translations:model_id,locale,attribute_data'])
->with(['category_items' => function($query) {
$query

View File

@ -34,6 +34,7 @@ class postsController extends Controller
'typePost' => input('typePost'),
'group' => input('group'),
'published' => true,
'featured' => input('featured'),
'select' => ['id','title','slug','published_at',DB::raw("IF(featured_image<>'',concat('$path',featured_image),featured_image) as main_image")]
]);

View File

@ -170,20 +170,26 @@ class Post extends Model
public function filterFields($fields, $context = null)
{
if($this->category_groups->count()){
// \Log::info($this->getActiveCategoriesOptions());
// $datas = $this->category_groups;
// for ($i = 0; $i < count($datas); $i++) {
// \Log::info($datas[$i]->name);
// }
// $fields->active_categories->value = $this->getActiveCategoriesOptions();
// \Log::info($this->active_categories);
if($this->category_groups->where('type', 'news')->count()){
$fields->type_post->hidden = false;
}else{
$fields->type_post->hidden = true;
}
if($this->category_groups->where('type', 'media')->count()){
$fields->video_file->hidden = false;
}else{
$fields->video_file->hidden = true;
}
if($this->category_groups->where('type', 'afisha')->count()){
$fields->afisha_phone->hidden = false;
$fields->afisha_address->hidden = false;
}else{
$fields->afisha_phone->hidden = true;
$fields->afisha_address->hidden = true;
}
if(isset($fields->locale)){
if($this->locale == 'en')
{

View File

@ -8,22 +8,19 @@ columns:
label: name
type: text
searchable: true
# invisible: true
sortable: true
note:
label: note
type: text
searchable: true
# invisible: true
sortable: true
created_at:
label: 'Created At'
type: text
searchable: true
# invisible: true
sortable: true
type_post:
label: Tm/World
type: switch
# invisible: true
type:
label: Type
type: text
searchable: true
sortable: true

View File

@ -8,18 +8,16 @@ fields:
span: auto
preset: name
type: text
type_post:
label: (turkmenistan/world)
type:
label: 'Group Type'
span: auto
type: switch
media:
label: Media
span: auto
type: switch
event:
label: Event
span: auto
type: switch
options:
news: news
media: media
event: event
afisha: afisha
article: article
type: balloon-selector
tabs:
fields:
category_items:

View File

@ -61,9 +61,10 @@ secondaryTabs:
type: text
tab: 'rainlab.blog::lang.post.tab_manage'
featured:
label: Featured
label: 'показать в слайдере на главной странице'
span: auto
type: checkbox
comment: 'не отмечать если не нужно выставлять на слайдере'
tab: 'rainlab.blog::lang.post.tab_manage'
published_at:
tab: 'rainlab.blog::lang.post.tab_manage'
@ -110,16 +111,31 @@ secondaryTabs:
path: field_category_group_item
type: partial
tab: 'Category Group'
# active_categories:
# tab: 'Category Group'
# type: relation
# dependsOn: category_groups
# commentAbove: 'rainlab.blog::lang.post.categories_comment'
# placeholder: 'rainlab.blog::lang.post.categories_placeholder'
# span: auto
categories:
tab: 'Category Group'
type: checkboxlist
dependsOn: category_groups
options: getActiveCategoriesOptions
span: auto
afisha_phone:
label: Afisha
span: left
hidden: 1
type: text
dependsOn: category_groups
tab: 'Category Group'
afisha_address:
label: 'Afisha Address'
span: left
hidden: 1
type: text
dependsOn: category_groups
tab: 'Category Group'
video_file:
label: 'Video File'
span: left
mode: file
hidden: 1
type: mediafinder
dependsOn: category_groups
tab: 'Category Group'

View File

@ -0,0 +1,23 @@
<?php namespace RainLab\Blog\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRainlabBlogCategoryGroup6 extends Migration
{
public function up()
{
Schema::table('rainlab_blog_category_group', function($table)
{
$table->boolean('is_afisha')->nullable()->default(0);
});
}
public function down()
{
Schema::table('rainlab_blog_category_group', function($table)
{
$table->dropColumn('is_afisha');
});
}
}

View File

@ -0,0 +1,23 @@
<?php namespace RainLab\Blog\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRainlabBlogCategoryGroup7 extends Migration
{
public function up()
{
Schema::table('rainlab_blog_category_group', function($table)
{
$table->string('type')->nullable();
});
}
public function down()
{
Schema::table('rainlab_blog_category_group', function($table)
{
$table->dropColumn('type');
});
}
}

View File

@ -0,0 +1,29 @@
<?php namespace RainLab\Blog\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRainlabBlogCategoryGroup8 extends Migration
{
public function up()
{
Schema::table('rainlab_blog_category_group', function($table)
{
$table->dropColumn('type_post');
$table->dropColumn('media');
$table->dropColumn('event');
$table->dropColumn('is_afisha');
});
}
public function down()
{
Schema::table('rainlab_blog_category_group', function($table)
{
$table->boolean('type_post')->nullable()->default(0);
$table->boolean('media')->nullable()->default(0);
$table->boolean('event')->nullable()->default(0);
$table->boolean('is_afisha')->nullable()->default(0);
});
}
}

View File

@ -0,0 +1,25 @@
<?php namespace RainLab\Blog\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRainlabBlogPosts7 extends Migration
{
public function up()
{
Schema::table('rainlab_blog_posts', function($table)
{
$table->string('afisha_phone')->nullable();
$table->text('afisha_address')->nullable();
});
}
public function down()
{
Schema::table('rainlab_blog_posts', function($table)
{
$table->dropColumn('afisha_phone');
$table->dropColumn('afisha_address');
});
}
}

View File

@ -0,0 +1,23 @@
<?php namespace RainLab\Blog\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRainlabBlogPosts8 extends Migration
{
public function up()
{
Schema::table('rainlab_blog_posts', function($table)
{
$table->text('video_file')->nullable();
});
}
public function down()
{
Schema::table('rainlab_blog_posts', function($table)
{
$table->dropColumn('video_file');
});
}
}

View File

@ -129,3 +129,18 @@
1.5.23:
- 'Updated table rainlab_blog_category_group'
- builder_table_update_rainlab_blog_category_group_5.php
1.5.24:
- 'Updated table rainlab_blog_posts'
- builder_table_update_rainlab_blog_posts_7.php
1.5.25:
- 'Updated table rainlab_blog_category_group'
- builder_table_update_rainlab_blog_category_group_6.php
1.5.26:
- 'Updated table rainlab_blog_category_group'
- builder_table_update_rainlab_blog_category_group_7.php
1.5.27:
- 'Updated table rainlab_blog_category_group'
- builder_table_update_rainlab_blog_category_group_8.php
1.5.28:
- 'Updated table rainlab_blog_posts'
- builder_table_update_rainlab_blog_posts_8.php

View File

@ -1,18 +1,14 @@
items:
-
title: Новости
nesting: 0
type: blog-category
url: null
type: url
url: /ru/new/posts/news
code: ''
reference: '9'
cmsPage: new/category
replace: 0
viewBag:
locale:
en:
title: ''
url: ''
url: /en
tm:
title: ''
url: ''
@ -22,13 +18,9 @@ items:
items:
-
title: События
nesting: 0
type: blog-category
url: null
type: url
url: /ru/new/posts/news/events
code: ''
reference: '9'
cmsPage: new/category
replace: 0
viewBag:
locale:
en:
@ -42,12 +34,9 @@ items:
isExternal: '0'
-
title: Watan
nesting: 0
type: blog-category
type: url
url: /ru/new/posts/news/watan
code: ''
reference: '804'
cmsPage: new/category
replace: 0
viewBag:
locale:
en:
@ -61,12 +50,13 @@ items:
isExternal: '0'
-
title: Экономика
nesting: 0
type: blog-category
nesting: null
type: url
url: /new/group/news/economy
code: ''
reference: '5'
cmsPage: new/category
replace: 0
reference: null
cmsPage: null
replace: null
viewBag:
locale:
en:
@ -80,12 +70,13 @@ items:
isExternal: '0'
-
title: Общество
nesting: 0
type: blog-category
nesting: null
type: url
url: /new/group/news/society
code: ''
reference: '12'
cmsPage: new/category
replace: 0
reference: null
cmsPage: null
replace: null
viewBag:
locale:
en:
@ -99,13 +90,9 @@ items:
isExternal: '0'
-
title: Статьи
nesting: 0
type: blog-category
url: null
type: url
url: /ru/new/posts/stati
code: ''
reference: '5'
cmsPage: new/category
replace: 0
viewBag:
locale:
en:
@ -120,13 +107,9 @@ items:
items:
-
title: Экономика
nesting: null
type: category-blog-posts
url: null
type: url
url: /ru/new/posts/stati/economy
code: ''
reference: '5'
cmsPage: new/newPost
replace: 0
viewBag:
locale:
en:
@ -160,13 +143,9 @@ items:
isExternal: '0'
-
title: Технологии
nesting: null
type: category-blog-posts
url: null
type: url
url: /ru/new/posts/stati/technology
code: ''
reference: '11'
cmsPage: new/newPost
replace: 0
viewBag:
locale:
en:

View File

@ -0,0 +1,51 @@
title = "new/group/category"
url = "/new/posts/:group/:slug?"
layout = "new/master-inside"
is_hidden = 0
robot_index = "index"
robot_follow = "follow"
[blogPosts]
pageNumber = "{{ :page }}"
categoryFilter = "{{ :slug }}"
postsPerPage = 10
noPostsMessage = "No posts found"
sortOrder = "published_at desc"
categoryPage = "new/category"
postPage = "new/newPost"
==
<?php
function onStart(){
//$this['backendUsers'] = Backend\Models\User::all();
$this['group'] = $this->param('group');
}
?>
==
<!-- HEAD end ======== -->
<main class="rubric-main">
<div class="container">
<div class="rubric-inner">
<div class="trending-head">
<h2>{{category.name}}</h2>
<!-- <h2>{{ group }}</h2> -->
<span></span>
</div>
<div class="rubric-items">
{% for post in blogPosts.posts %}
{% partial 'new/post_list_item' post = post %}
{% else %}
<p>No posts found</p>
{% endfor %}
</div>
{% partial 'new/pagination' items = blogPosts.posts %}
</div>
</div>
</main>

View File

@ -115,7 +115,7 @@ code = "top-menu"
{% if not item.isHidden and item.items|length %}
<div class="nav__inner-link {% if(item.isChildActive) %}} active {% endif %} {{item.cssClass}}">
<div class="nav__inner-link {% if(item.isChildActive) %} active {% endif %} {{item.cssClass}}">
<span>{{ item.title }}</span>
<div class="dropDown">
{% for item in item.items %}

View File

@ -14,12 +14,12 @@ code = "new-top-menui"
<li>
<span class="nav-section-span {% if(item.isActive) %} active {% endif %}"><a href="{{ item.url }}" style="color: white">{{ item.title }}</a></span>
<ul class="nav-section-dropdown {% if(item.isActive) %} active {% endif %}">
<span class="nav-section-span {% if(item.isActive or item.isChildActive) %} active {% endif %}"><a href="{{ item.url }}" style="color: white">{{ item.title }}</a></span>
<ul class="nav-section-dropdown {% if(item.isActive or item.isChildActive) %} active {% endif %}">
{% for itemC in item.items %}
{% for item in item.items %}
<li><a href="{{ itemC.url }}" class="{% if (itemC.isChildActive) %} active {% endif %} ">{{ itemC.title }}</a></li>
<li><a href="{{ item.url }}" class="{% if(item.isActive) %} active {% endif %}">{{ item.title }}</a></li>
{% endfor %}