From 71549c0aca2a232a1211d6c8cc0a9383c515b692 Mon Sep 17 00:00:00 2001 From: merdan Date: Fri, 2 Apr 2021 14:22:25 +0500 Subject: [PATCH] arhiv calendar partner news --- .../blogtags/components/BlogTagSearch.php | 1 + plugins/rainlab/blog/components/Posts.php | 1 + plugins/rainlab/blog/models/Post.php | 18 +- themes/modern/config/lang.yaml | 2 + themes/modern/layouts/cms.htm | 1 + themes/modern/pages/archive.htm | 37 ++++ themes/modern/pages/category.htm | 20 +- themes/modern/pages/index.htm | 196 +----------------- themes/modern/pages/post.htm | 104 +--------- themes/modern/pages/tag.htm | 60 ++++-- themes/modern/partials/calendar.htm | 17 ++ themes/modern/partials/footer.htm | 101 +-------- themes/modern/partials/index/partner_news.htm | 36 ++++ themes/modern/partials/pagination.htm | 14 +- themes/modern/partials/social.htm | 102 +++++++++ themes/modern/partials/tags.htm | 6 +- 16 files changed, 279 insertions(+), 437 deletions(-) create mode 100644 themes/modern/pages/archive.htm create mode 100644 themes/modern/partials/index/partner_news.htm create mode 100644 themes/modern/partials/social.htm diff --git a/plugins/bedard/blogtags/components/BlogTagSearch.php b/plugins/bedard/blogtags/components/BlogTagSearch.php index 51642a4ed..688b7b57f 100644 --- a/plugins/bedard/blogtags/components/BlogTagSearch.php +++ b/plugins/bedard/blogtags/components/BlogTagSearch.php @@ -158,6 +158,7 @@ class BlogTagSearch extends ComponentBase }]) ->first(); + // Store the posts in a better container if(empty($this->tag)) { $this->posts = null; diff --git a/plugins/rainlab/blog/components/Posts.php b/plugins/rainlab/blog/components/Posts.php index 8b12faa67..e355afd21 100644 --- a/plugins/rainlab/blog/components/Posts.php +++ b/plugins/rainlab/blog/components/Posts.php @@ -208,6 +208,7 @@ class Posts extends ComponentBase 'perPage' => $this->property('postsPerPage'), 'search' => trim(input('search')), 'category' => $category, + 'date' => input('date'), 'published' => $isPublished, 'exceptPost' => is_array($this->property('exceptPost')) ? $this->property('exceptPost') diff --git a/plugins/rainlab/blog/models/Post.php b/plugins/rainlab/blog/models/Post.php index ba73915ee..e7db21371 100644 --- a/plugins/rainlab/blog/models/Post.php +++ b/plugins/rainlab/blog/models/Post.php @@ -251,6 +251,7 @@ class Post extends Model 'exceptCategories' => null, 'category' => null, 'search' => '', + 'date' => '', 'published' => true, 'exceptPost' => null ], $options)); @@ -261,6 +262,12 @@ class Post extends Model $query->isPublished(); } + $date = trim($date); + + if(strtotime($date)){ + $query->whereDate('published_at','=',$date); + } + /* * Except post(s) */ @@ -339,8 +346,12 @@ class Post extends Model */ if ($category !== null) { $category = Category::find($category); - $categories = $category->getAllChildrenAndSelf()->lists('id'); + if(!$categories){ + $categories[] = $category->id; + + } +// dd($categories); $query->whereHas('categories', function($q) use ($categories) { $q->whereIn('id', $categories); }); @@ -401,8 +412,9 @@ class Post extends Model return array_get($parts, 0); } - - return Html::limit($this->content_html, 280); + //remove image + $content = preg_replace("/]+\>/i", " ", $this->content_html); + return Html::limit($content, 280); } // diff --git a/themes/modern/config/lang.yaml b/themes/modern/config/lang.yaml index 15454afdf..ba70b4cf9 100644 --- a/themes/modern/config/lang.yaml +++ b/themes/modern/config/lang.yaml @@ -1,6 +1,7 @@ en: site.name: 'Orient' site.slogan: 'Oriented on making people closer' + partner_news: 'PARTNERS NEWS' nav.home: 'Home' nav.city: 'Ashgabat' page.latest_news: 'Latest news' @@ -18,6 +19,7 @@ en: ru: site.name: 'Ориент' site.slogan: 'Наш ориентир то, что сближает людей' + partner_news: 'НОВОСТИ КОЛЛЕГ' nav.home: 'Главная' nav.city: 'Ашхабад' page.tags: 'ТЭГИ' diff --git a/themes/modern/layouts/cms.htm b/themes/modern/layouts/cms.htm index 0774b9288..5732c3274 100644 --- a/themes/modern/layouts/cms.htm +++ b/themes/modern/layouts/cms.htm @@ -27,6 +27,7 @@ forceUrl = 1 {% framework extras %} {% scripts %} + diff --git a/themes/modern/pages/archive.htm b/themes/modern/pages/archive.htm new file mode 100644 index 000000000..1c09bfed4 --- /dev/null +++ b/themes/modern/pages/archive.htm @@ -0,0 +1,37 @@ +title = "Архив" +url = "/arhiv" +layout = "cms" +is_hidden = 0 +robot_index = "index" +robot_follow = "follow" + +[viewBag] +localeTitle[en] = "Archive" +localeUrl[en] = "/archive" + +[blogPosts] +pageNumber = "{{ :page }}" +categoryFilter = "{{ :slug }}" +postsPerPage = 10 +noPostsMessage = "No posts found" +sortOrder = "published_at desc" +categoryPage = "category" +postPage = "post" +== +
+
+
+ Arhiw +
+ {% for item in blogPosts.posts %} + {% partial 'post_list_item' post = item %} + {% else %} +

No posts found

+ {% endfor %} + {% partial 'pagination' items = blogPosts.posts %} +
+
+
+ {% partial 'calendar' %} + {% partial 'tags' %} +
diff --git a/themes/modern/pages/category.htm b/themes/modern/pages/category.htm index 4f8dbad5c..52d976f5c 100644 --- a/themes/modern/pages/category.htm +++ b/themes/modern/pages/category.htm @@ -1,12 +1,12 @@ title = "Рубрика" -url = "/category/:slug" +url = "/category/:slug/:page?" layout = "cms" is_hidden = 0 robot_index = "index" robot_follow = "follow" [viewBag] -localeUrl[en] = "/category/:slug" +localeUrl[en] = "/category/:slug/:page?" localeTitle[en] = "Category" [blogPosts] @@ -23,27 +23,15 @@ postPage = "post"
{{category.name}}
- {% for item in posts %} + {% for item in blogPosts.posts %} {% partial 'post_list_item' post = item %} {% else %}

No posts found

{% endfor %} - {% partial 'pagination'%} + {% partial 'pagination' items = blogPosts.posts %}
{% partial 'calendar' %} {% partial 'tags' %}
-{% put scripts %} - - -{% endput %} \ No newline at end of file diff --git a/themes/modern/pages/index.htm b/themes/modern/pages/index.htm index 3354c2a5f..538537f19 100644 --- a/themes/modern/pages/index.htm +++ b/themes/modern/pages/index.htm @@ -67,181 +67,7 @@ type = "slider"
-
-
- НОВОСТИ КОЛЛЕГ -
- -
+ {% partial 'index/partner_news'%}
@@ -257,12 +83,7 @@ type = "slider" {% partial 'tags' %} -
- Календарь нОВОСТЕЙ -
-
- -
+ {% partial 'calendar' %}
@@ -283,14 +104,5 @@ type = "slider" {% put scripts %} - - -{% endput %} \ No newline at end of file + +{% endput %} diff --git a/themes/modern/pages/post.htm b/themes/modern/pages/post.htm index 617c2d33b..1446fbfba 100644 --- a/themes/modern/pages/post.htm +++ b/themes/modern/pages/post.htm @@ -31,7 +31,7 @@ slug = "{{ :slug }}"

{{post.title}}

- {% if post.image %} + {% if post.featured_image %} {{post.title}} @@ -42,109 +42,11 @@ slug = "{{ :slug }}"
{% partial 'latest_news'%} -
\ No newline at end of file + diff --git a/themes/modern/pages/tag.htm b/themes/modern/pages/tag.htm index 4f13fe500..7d9d8dbed 100644 --- a/themes/modern/pages/tag.htm +++ b/themes/modern/pages/tag.htm @@ -1,12 +1,12 @@ title = "Тег" -url = "/tag/:slug" +url = "/tag/:tag/:page?" layout = "cms" is_hidden = 0 robot_index = "index" robot_follow = "follow" [viewBag] -localeUrl[en] = "/tag/:slug" +localeUrl[en] = "/tag/:tag/:page?" localeTitle[en] = "Tag" [blogTagSearch] @@ -20,29 +20,55 @@ categoryPage = "category"
- {{category.name}} + {{blogTagSearch.tag.name}}
- {% for item in posts %} + {% for item in blogTagSearch.posts %} {% partial 'post_list_item' post = item %} {% else %}

No posts found

{% endfor %} - {% partial 'pagination'%} + + {% if blogTagSearch.totalPosts > blogTagSearch.resultsPerPage %} + + {% endif %}
{% partial 'calendar' %} {% partial 'tags' %}
-{% put scripts %} - - -{% endput %} \ No newline at end of file diff --git a/themes/modern/partials/calendar.htm b/themes/modern/partials/calendar.htm index dc05daaec..58a8fad14 100644 --- a/themes/modern/partials/calendar.htm +++ b/themes/modern/partials/calendar.htm @@ -4,3 +4,20 @@
+{% put scripts %} + + +{% endput %} diff --git a/themes/modern/partials/footer.htm b/themes/modern/partials/footer.htm index da9303b24..cc3ad1141 100644 --- a/themes/modern/partials/footer.htm +++ b/themes/modern/partials/footer.htm @@ -7,106 +7,7 @@ Copyright 2012-{{ 'now' | date('Y')}} {{'footer.copyright'|_}}| Пользовательское соглашение diff --git a/themes/modern/partials/index/partner_news.htm b/themes/modern/partials/index/partner_news.htm new file mode 100644 index 000000000..c8b5a6e04 --- /dev/null +++ b/themes/modern/partials/index/partner_news.htm @@ -0,0 +1,36 @@ +[rssItems] +maxItems = 6 + +[viewBag] +== +
+
+ {{'partner_news'|_}} +
+
+ {% for news in rssItems.items %} +
+
+
+
+ {{news.source}} +
+
+
+
{{news.published_at|date('d.m.Y')}} + + + + {{news.published_at|date('H:i')}} +
+
+ + {{news.title}} + +
+
+ {% endfor %} +
+
diff --git a/themes/modern/partials/pagination.htm b/themes/modern/partials/pagination.htm index 50a1c4563..c9f1ea7cf 100644 --- a/themes/modern/partials/pagination.htm +++ b/themes/modern/partials/pagination.htm @@ -1,6 +1,6 @@ -{% if posts.total > posts.perPage %} +{% if items.total > items.perPage %} {% endif %} diff --git a/themes/modern/partials/social.htm b/themes/modern/partials/social.htm new file mode 100644 index 000000000..cbf962cb5 --- /dev/null +++ b/themes/modern/partials/social.htm @@ -0,0 +1,102 @@ + + {% if this.theme.youtube %} + + {% endif %} + {% if this.theme.vk %} + + {% endif %} + {% if this.theme.twitter %} + + {% endif %} + {% if this.theme.ok %} + + {% endif %} + {% if this.theme.linkedin %} + + {% endif %} + {% if this.theme.instagram %} + + {% endif %} + {% if this.theme.facebook %} + + {% endif %} + {% if this.theme.telegram %} + + {% endif %} + diff --git a/themes/modern/partials/tags.htm b/themes/modern/partials/tags.htm index 0f882b6a5..5d11bcd2d 100644 --- a/themes/modern/partials/tags.htm +++ b/themes/modern/partials/tags.htm @@ -9,9 +9,9 @@ direction = "desc" {{'page.tags'|_}}