ORIENT/themes/modern2/pages/new/group.htm

165 lines
5.3 KiB
HTML
Raw Normal View History

2022-12-25 12:30:38 +00:00
title = "Рубрика"
2022-12-18 11:13:59 +00:00
url = "/new/posts/:categoryGroup/:slug?"
2022-12-18 08:28:49 +00:00
layout = "new/master-inside"
is_hidden = 0
robot_index = "index"
robot_follow = "follow"
2022-12-25 12:30:38 +00:00
[viewBag]
localeTitle[en] = "Category"
2022-12-18 08:28:49 +00:00
[blogPosts]
pageNumber = "{{ :page }}"
categoryFilter = "{{ :slug }}"
2022-12-18 12:08:08 +00:00
categoryGroup = "{{ :categoryGroup }}"
2022-12-18 08:28:49 +00:00
postsPerPage = 10
noPostsMessage = "No posts found"
sortOrder = "published_at desc"
categoryPage = "new/category"
postPage = "new/newPost"
==
<?php
2022-12-18 12:08:08 +00:00
function onStart(){
2022-12-23 09:55:31 +00:00
// $postId = $this->param('id');
// $currentPost = RainLab\Blog\Models\Post::where('id', $postId)->with(['category_groups'])->first();
$currentLocale = $this->activeLocale;
2022-12-18 12:08:08 +00:00
$this['group'] = $this->param('categoryGroup');
2022-12-19 12:53:46 +00:00
$this['categorySlug'] = $this->param('slug');
2022-12-18 12:08:08 +00:00
$this['groupName'] = RainLab\Blog\Models\CategoryGroup::where('slug', $this['group'])->first();
2022-12-23 09:55:31 +00:00
$currentCatLink = '/'.$this['categorySlug'];
$currentUrl = '/'.$currentLocale.'/new/posts/'.$this['group'].$currentCatLink;
2022-12-29 11:38:21 +00:00
if(!$this['categorySlug'] && $this['group'] != 'media'){
2022-12-25 12:30:38 +00:00
$this->page->meta_title = $this['groupName']->name;
2022-12-29 11:38:21 +00:00
}elseif(!$this['categorySlug'] && $this['group'] == 'media'){
$this->page->meta_title = 'Media';
2022-12-25 12:30:38 +00:00
}
2022-12-29 11:38:21 +00:00
2022-12-25 12:30:38 +00:00
2022-12-23 09:55:31 +00:00
//dd($currentUrl);
if($this->menuItems && $this['group']){
foreach ($this->menuItems as $menu){
//dump($currentUrl);
if(!$this['categorySlug']){
if($menu->url.'/' === $currentUrl){
$menu->isActive = true;
break;
}
}else{
foreach ($menu->items as $menuItem){
if($menuItem->url === $currentUrl){
// dump($menuItem);
$menuItem->isActive = true;
$menuItem->isChildActive = true;
break;
}
}
}
}
}
//$this['backendUsers'] = Backend\Models\User::all();
2022-12-19 12:53:46 +00:00
if($this['categorySlug']){
2023-01-12 10:01:54 +00:00
$this['mediaPostsFilter'] = Tps\Tps\Models\Media::where('type', $this['categorySlug'])->orderBy('published_at', 'DESC')->paginate(9);
2022-12-19 12:53:46 +00:00
}else{
2023-01-12 10:01:54 +00:00
$this['mediaPostsFilter'] = Tps\Tps\Models\Media::orderBy('published_at', 'DESC')->paginate(9);
2022-12-19 12:53:46 +00:00
}
2022-12-23 09:55:31 +00:00
2022-12-18 12:08:08 +00:00
}
2022-12-18 08:28:49 +00:00
?>
==
2022-12-19 12:53:46 +00:00
{% set records = media.records %}
{% set displayColumn = media.displayColumn %}
{% set noRecordsMessage = media.noRecordsMessage %}
{% set detailsPage = media.detailsPage %}
{% set detailsKeyColumn = media.detailsKeyColumn %}
{% set detailsUrlParameter = media.detailsUrlParameter %}
2022-12-18 08:28:49 +00:00
<!-- HEAD end ======== -->
<main class="rubric-main">
<div class="container">
<div class="rubric-inner">
<div class="trending-head">
2022-12-19 12:53:46 +00:00
<h2 style="text-transform: capitalize;">{% if category.name != "" %}{{category.name}}{% else %} {% if group == 'media' %} {{ group }} {% else %}{{ groupName.name }}{% endif %} {% endif %}</h2>
2022-12-18 08:28:49 +00:00
<span></span>
</div>
2022-12-19 12:53:46 +00:00
{% if group == 'media' %}
<div class="video-main-top {% if categorySlug == 'photo' %} photo-main-top {% endif %}">
{% for post in mediaPostsFilter %}
2022-12-23 09:55:31 +00:00
{% if post.type == 'photo' %}
{% partial 'newHome/photo-item' post=post %}
{% else %}
{% partial 'newHome/video-item' post=post %}
{% endif %}
2022-12-19 12:53:46 +00:00
{% else %}
<li class="no-data">{{ 'no Records' }}</li>
{% endfor %}
</div>
2023-01-12 10:01:54 +00:00
{% partial 'new/pagination' items = mediaPostsFilter %}
2022-12-19 12:53:46 +00:00
{% else %}
2022-12-29 11:38:21 +00:00
<div class="rubric-items {% if group == 'poster' %} affiche-items {% endif %}">
2022-12-19 12:53:46 +00:00
{% for post in blogPosts.posts %}
2022-12-29 11:38:21 +00:00
{% if group == 'poster' %}
{% partial 'new/afisha-item' post = post %}
{% else %}
{% partial 'new/post_list_item' post = post %}
{% endif %}
2022-12-19 12:53:46 +00:00
{% else %}
<p>No posts found</p>
{% endfor %}
</div>
2023-01-12 10:01:54 +00:00
{% partial 'new/pagination' items = blogPosts.posts %}
2022-12-19 12:53:46 +00:00
{% endif %}
2022-12-18 08:28:49 +00:00
2022-12-19 12:53:46 +00:00
2023-01-12 10:01:54 +00:00
2022-12-18 08:28:49 +00:00
</div>
</div>
2022-12-23 09:55:31 +00:00
</main>
<section class="photo-scroller">
<div class="photo-scroller-inner">
<div class="swiper photoScrollerSwiper">
<div class="swiper-wrapper">
</div>
<div class="photo-scroller-prev video-prev">
<img src="{{'assets/new/icons/arrow-left-white.svg'|theme}}" alt="" />
</div>
<div class="photo-scroller-next video-next">
<img src="{{'assets/new/icons/arrow-right-white.svg'|theme}}" alt="" />
</div>
</div>
<div class="photo-scroller-closer">
<img src="{{'assets/new/icons/close.svg'|theme}}" alt="" />
</div>
</div>
</section>
{% put scripts %}
2023-01-30 09:47:38 +00:00
<script src="{{'assets/new/scripts/core/affiche-item.js'|theme}}"></script>
2022-12-23 09:55:31 +00:00
<script src="{{'assets/new/scripts/core/rubric.js'|theme}}"></script>
2023-01-30 09:47:38 +00:00
2022-12-23 09:55:31 +00:00
{% endput %}