- {% endif %}
- {{ article.title }}
-
- diff --git a/innovedus_cms/home/models.py b/innovedus_cms/home/models.py index ca613de..d62d0ba 100644 --- a/innovedus_cms/home/models.py +++ b/innovedus_cms/home/models.py @@ -22,6 +22,7 @@ NEWS_SIZE = _get_env_int("HOMEPAGE_NEWS_SIZE", 8) # Default to 8 articles in new BLOCK_SIZE = _get_env_int("HOMEPAGE_BLOCK_SIZE", 7) # Default to 7 articles in block layout HORIZON_SIZE = _get_env_int("HOMEPAGE_HORIZON_SIZE", 4) # Default to 4 articles in horizon layout PAGE_SIZE = _get_env_int("HOMEPAGE_PAGE_SIZE", 10) # Default to 10 articles per page for pagination +CATEGORY_HOT_SIZE = _get_env_int("CATEGORY_HOT_SIZE", 6) # Default to 4 articles in category hot layout # Mixin for Category-related functionality class CategoryMixin: @@ -64,6 +65,7 @@ class CategoryMixin: "title": self.title, "items": page_obj, "url": self.url, + "page_range": paginator.get_elided_page_range(page_obj.number), } ) return blocks @@ -108,6 +110,7 @@ class CategoryMixin: "title": self.title, "items": page_obj, "url": self.url, + "page_range": paginator.get_elided_page_range(page_obj.number), } def get_trending_articles(self, request=None, exclude_ids=None): @@ -142,6 +145,7 @@ class CategoryMixin: "title": self.title, "items": page_obj, "url": self.url, + "page_range": paginator.get_elided_page_range(page_obj.number), } @@ -224,6 +228,12 @@ class CategoryPage(Page, CategoryMixin): def get_context(self, request): context = super().get_context(request) context["category_sections"] = self.build_category_blocks(request) + context["category_trending"] = ( + ArticlePage.objects.descendant_of(self) + .live() + .filter(trending=True) + .order_by("-date", "-id")[:CATEGORY_HOT_SIZE] + ) # breadcrumbs, site_root = self.build_breadcrumbs() # context["breadcrumbs"] = breadcrumbs # context["breadcrumb_root"] = site_root diff --git a/innovedus_cms/home/static/css/article_list.css b/innovedus_cms/home/static/css/article_list.css new file mode 100644 index 0000000..fe92252 --- /dev/null +++ b/innovedus_cms/home/static/css/article_list.css @@ -0,0 +1,278 @@ +.page-article-list{ + padding-bottom: 40px; +} + +.first-article { + display: grid; + grid-template-columns: 410px 1fr; + grid-template-areas: + "image content"; + gap: 16px 40px; + align-items: start; + padding: 40px 0; +} + +.first-article .first-article-image { + grid-area: image; + position: relative; + border-radius: 10px; + overflow: hidden; + width: 410px; +} + +.first-article .first-article-image img{ + display: block; + width: 410px; + height: 293px; + object-fit: cover; + border-radius: 10px; +} + +.first-article .first-article-content { + max-height: 293px; + overflow: hidden; + position: relative; +} + +.first-article .first-article-content a { + grid-area: content; + display: flex; + flex-direction: column; + gap: 16px; +} + +.first-article .first-article-title { + font-size: 40px; + font-weight: 400; + color: #f4a41c; + margin: 0; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + overflow: hidden; + flex: 0 0 auto; +} + +.first-article .first-article-date { + color: #ffffff66; + flex: 0 0 auto; +} + +.first-article .first-article-intro { + font-size: 20px; + flex: 0 1 auto; + min-height: 0; + overflow: hidden; +} + +.first-article .first-article-body { + flex: 1 2 auto; + min-height: 0; + overflow: hidden; + position: relative; +} + +.first-article .first-article-content::after { + content: ""; + position: absolute; + left: 0; + right: 0; + bottom: 0; + height: 100px; + background: linear-gradient(to bottom, rgba(14, 27, 66, 0), #0e1b42); + pointer-events: none; +} + +.article-list-lower { + margin: 40px 0; + display: flex; + flex-direction: column; + gap: 32px; +} + +.article-list-item { + display: grid; + grid-template-columns: 410px 1fr; + grid-template-areas: + "image content"; + gap: 16px 40px; + align-items: start; +} + +.article-thumb { + grid-area: image; + position: relative; + border-radius: 10px; + overflow: hidden; + width: 410px; +} + +.article-thumb img{ + display: block; + width: 410px; + height: 218px; + object-fit: cover; + border-radius: 10px; +} + +.article-content { + grid-area: content; + display: flex; + flex-direction: column; + gap: 8px; +} + +.article-title { + font-size: 40px; + font-weight: 400; + margin: 0; + display: -webkit-box; + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; + overflow: hidden; +} + +.article-date { + color: #0e1b4266; +} + +.pagination { + display: flex; + justify-content: center; + align-items: center; + /* vertical-align: middle; */ + gap: 16px; + height: 44px; +} + +.pagination a { + display: inline-flex; + align-items: center; + gap: 8px; + height: 44px; +} + +.pagination .prev-page span, +.pagination .next-page span { + height: 44px; + line-height: 44px; +} + +.pagination .left-arrow, +.pagination .right-arrow { + background: none; + width: 44px; + height: 44px; + border: none; + padding: 0; + cursor: pointer; +} + +.pagination .left-arrow .left-arrow-icon, +.pagination .right-arrow .right-arrow-icon { + width: 16px; + height: 32px; +} + +.pagination .right-arrow .right-arrow-icon { + transform: rotate(180deg); +} + +.pagination-pages { + display: flex; + align-items: center; + gap: 12px; +} + +.pagination-pages a, +.pagination-current, +.pagination-ellipsis { + line-height: 44px; +} + +.pagination-current { + font-weight: 700; +} + +@media (min-width: 768px) and (max-width: 1023px) { + .first-article { + grid-template-columns: 318px 1fr; + } + + .first-article .first-article-image { + width: 318px; + } + + .first-article .first-article-image img{ + width: 318px; + height: 290px; + } + + .article-list-item { + grid-template-columns: 318px 1fr; + } + + .article-thumb { + width: 318px; + } + + .article-thumb img{ + width: 318px; + } +} + +@media (max-width: 767px) { + .first-article { + grid-template-columns: 1fr; + grid-template-areas: + "image" + "content"; + } + + .article-list-item { + grid-template-columns: 1fr; + grid-template-areas: + "image" + "content"; + } +} + +@media (min-width: 575px) and (max-width: 767px) { + .first-article .first-article-image { + width: 426px; + } + + .first-article .first-article-image img{ + width: 426px; + height: 260px; + } + + .article-thumb { + width: 426px; + } + + .article-thumb img{ + width: 426px; + height: 260px; + } +} + +@media (max-width: 574px) { + .first-article .first-article-image { + width: 300px; + } + + .first-article .first-article-image img{ + width: 300px; + height: 218px; + } + + .article-thumb { + width: 300px; + } + + .article-thumb img{ + width: 300px; + height: 218px; + } +} diff --git a/innovedus_cms/home/static/css/block_list.css b/innovedus_cms/home/static/css/block_list.css index c1f2a64..37ebcf1 100644 --- a/innovedus_cms/home/static/css/block_list.css +++ b/innovedus_cms/home/static/css/block_list.css @@ -28,13 +28,16 @@ } .block-first-article .first-article-content { + max-height: 293px; + overflow: hidden; + position: relative; +} + +.block-first-article .first-article-content a { grid-area: content; display: flex; flex-direction: column; gap: 16px; - max-height: 293px; - overflow: hidden; - position: relative; } .block-first-article .first-article-title { @@ -79,98 +82,6 @@ pointer-events: none; } -.block-list-lower { - margin: 24px 0; - display: flex; - flex-wrap: wrap; - align-items: stretch; - gap: 28px; -} - -.block-list-items { - display: contents; -} - -.block-list-items a { - display: flex; - flex-direction: column; - gap: 12px; - width: 200px; - text-decoration: none; -} - -.block-list-thumb { - position: relative; - width: 194px; - height: 133px; - border-radius: 10px; - overflow: hidden; -} - -.block-list-thumb img { - display: block; - width: 100%; - height: 100%; - object-fit: cover; -} - -.block-list-items a span{ - display: -webkit-box; - -webkit-line-clamp: 3; - -webkit-box-orient: vertical; - overflow: hidden; -} - -.block-list-items .article-title { - font-size: 20px; -} - -.block-list-items .article-date { - color: #0e1b4266; -} - -.block-list-more-article { - max-width: 430px; - min-width: 200px; - flex: 1 1 0; - display: flex; - align-items: center; - justify-content: center; - align-self: stretch; - margin-left: auto; - text-align: center; -} - -.block-list-more-article a { - display: flex; - align-items: center; - gap: 12px; - justify-content: center; -} - -.block-list-more-article span { - font-size: 18px; - font-weight: 700; - color: #0e1b42; - text-decoration: underline; -} - -.block-list-more-article .right-arrow { - background: none; - width: 52px; - height: 52px; - border: none; - padding: 0; - cursor: pointer; - box-shadow: #0e1b4266 1px 2px 1px 1px; -} - -.block-list-more-article .right-arrow .right-arrow-icon { - width: 16px; - height: 32px; - transform: rotate(180deg); -} - @media (min-width: 768px) and (max-width: 1023px) { .block-first-article { grid-template-columns: 318px 1fr; @@ -188,15 +99,6 @@ .block-first-article .first-article-title { font-size: 36px; } - - .block-list-lower { - gap: 20px; - } - - .block-list-more-article { - max-width: 200px; - flex: 1 1 200px; - } } @media (max-width: 767px) { @@ -222,27 +124,6 @@ font-size: 36px; } - .block-list-items a { - display: grid; - grid-template-columns: 194px 1fr; - column-gap: 16px; - row-gap: 8px; - width: 100%; - } - - .block-list-items a > div:nth-of-type(1) { - grid-row: 1 / span 2; - } - - .block-list-items a > div:nth-of-type(2), - .block-list-items a > div:nth-of-type(3) { - grid-column: 2; - min-width: 0; - } - - .block-list-more-article { - max-width: 100%; - } } @media (max-width: 574px) { @@ -262,39 +143,4 @@ .block-first-article .first-article-intro { font-size: 16px; } - - .block-list-lower { - gap: 16px; - } - - .block-list-items a { - width: 142px; - } - - .block-list-thumb { - width: 139px; - height: 110px; - } - - .block-list-items .article-title { - font-size: 16px; - } - - .block-list-items .article-date { - font-size: 12px; - } - - .block-list-more-article span { - font-size: 16px; - } - - .block-list-more-article .right-arrow { - width: 40px; - height: 40px; - } - - .block-list-more-article .right-arrow .right-arrow-icon { - width: 12px; - height: 24px; - } } diff --git a/innovedus_cms/home/static/css/block_list_lower.css b/innovedus_cms/home/static/css/block_list_lower.css new file mode 100644 index 0000000..d4337fb --- /dev/null +++ b/innovedus_cms/home/static/css/block_list_lower.css @@ -0,0 +1,162 @@ +.block-list-lower { + margin: 24px 0; + display: flex; + flex-wrap: wrap; + align-items: stretch; + gap: 28px; +} + +.block-list-items { + display: contents; +} + +.block-list-items a { + display: flex; + flex-direction: column; + gap: 12px; + width: 200px; + text-decoration: none; +} + +.block-list-thumb { + position: relative; + width: 194px; + height: 133px; + border-radius: 10px; + overflow: hidden; +} + +.block-list-thumb img { + display: block; + width: 100%; + height: 100%; + object-fit: cover; +} + +.block-list-items a span { + display: -webkit-box; + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; + overflow: hidden; +} + +.block-list-items .article-title { + font-size: 20px; +} + +.block-list-items .article-date { + color: #0e1b4266; +} + +.block-list-more-article { + max-width: 430px; + min-width: 200px; + flex: 1 1 0; + display: flex; + align-items: center; + justify-content: center; + align-self: stretch; + margin-left: auto; + text-align: center; +} + +.block-list-more-article a { + display: flex; + align-items: center; + gap: 12px; + justify-content: center; +} + +.block-list-more-article span { + font-size: 18px; + font-weight: 700; + text-decoration: underline; +} + +.block-list-more-article .right-arrow { + background: none; + width: 52px; + height: 52px; + border: none; + padding: 0; + cursor: pointer; + box-shadow: #0e1b4266 1px 2px 1px 1px; +} + +.block-list-more-article .right-arrow .right-arrow-icon { + width: 16px; + height: 32px; + transform: rotate(180deg); +} + +@media (min-width: 768px) and (max-width: 1023px) { + .block-list-lower { + gap: 20px; + } + + .block-list-more-article { + max-width: 200px; + flex: 1 1 200px; + } +} + +@media (min-width: 575px) and (max-width: 767px) { + .block-list-items a { + display: grid; + grid-template-columns: 194px 1fr; + column-gap: 16px; + row-gap: 8px; + width: 100%; + } + + .block-list-items a > div:nth-of-type(1) { + grid-row: 1 / span 2; + } + + .block-list-items a > div:nth-of-type(2), + .block-list-items a > div:nth-of-type(3) { + grid-column: 2; + min-width: 0; + } + + .block-list-more-article { + max-width: 100%; + } +} + +@media (max-width: 574px) { + .block-list-lower { + gap: 16px; + } + + .block-list-items a { + width: 142px; + } + + .block-list-thumb { + width: 139px; + height: 110px; + } + + .block-list-items .article-title { + font-size: 16px; + } + + .block-list-items .article-date { + font-size: 12px; + } + + .block-list-more-article span { + font-size: 16px; + } + + .block-list-more-article .right-arrow { + width: 40px; + height: 40px; + } + + .block-list-more-article .right-arrow .right-arrow-icon { + width: 12px; + height: 24px; + } +} diff --git a/innovedus_cms/home/static/css/category.css b/innovedus_cms/home/static/css/category.css index e48bd6b..20e3e37 100644 --- a/innovedus_cms/home/static/css/category.css +++ b/innovedus_cms/home/static/css/category.css @@ -21,7 +21,6 @@ display: flex; align-items: center; margin: 24px 0; - color: #0e1b42; font-size: 18px; font-weight: 700; } diff --git a/innovedus_cms/home/static/css/home.css b/innovedus_cms/home/static/css/home.css index a982be3..07a05e1 100644 --- a/innovedus_cms/home/static/css/home.css +++ b/innovedus_cms/home/static/css/home.css @@ -1,13 +1,7 @@ -.home-hero-band { - background-color: #0e1b42; - color: #ffffff; +.home-hero { padding-bottom: 86px; } -.home-hero-band a { - color: #ffffff; -} - .home-banner img { width: 100%; height: auto; @@ -42,7 +36,6 @@ .more-link { text-decoration: none; - font-size: 16px; } .section-b .list-title { diff --git a/innovedus_cms/home/static/css/horizontal_list.css b/innovedus_cms/home/static/css/horizontal_list.css index 27cff22..453afce 100644 --- a/innovedus_cms/home/static/css/horizontal_list.css +++ b/innovedus_cms/home/static/css/horizontal_list.css @@ -69,7 +69,6 @@ display: flex; flex-direction: column; gap: 12px; - color: inherit; text-decoration: none; } @@ -125,12 +124,10 @@ } .horizontal-list .article-intro { - font-size: 16px; } .horizontal-list .article-date { color: #0e1b4266; - font-size: 16px; } .horizontal-list .empty { diff --git a/innovedus_cms/home/static/css/news_list.css b/innovedus_cms/home/static/css/news_list.css index eeab0a1..91d4d3b 100644 --- a/innovedus_cms/home/static/css/news_list.css +++ b/innovedus_cms/home/static/css/news_list.css @@ -1,8 +1,3 @@ -.news-title, .more-news-title { - background-color: #ffffff; - color: #0e1b42; -} - .news-hero { display: grid; grid-template-columns: 480px 1fr; @@ -69,11 +64,14 @@ } .news-hero .first-news-content { + max-height: 293px; +} + +.news-hero .first-news-content a { grid-area: content; display: flex; flex-direction: column; gap: 16px; - max-height: 293px; } .news-hero .fist-news-date, diff --git a/innovedus_cms/home/templates/home/category_page.html b/innovedus_cms/home/templates/home/category_page.html index aa1361b..cb35545 100644 --- a/innovedus_cms/home/templates/home/category_page.html +++ b/innovedus_cms/home/templates/home/category_page.html @@ -3,6 +3,7 @@ {% block extra_css %} {% endblock %} +{% block body_class %}{% if not page.has_subcategories %}template-darkbackground{% endif %}{% endblock %} {% block content %} {# Breadcrumbs navigation may not used anymore #} {% if breadcrumbs %} @@ -25,13 +26,27 @@ {% endif %} -
- {% endif %}
- {{ article.title }}
-
-
+ {% endif %}
+
- {% endif %}
-
+ {% endif %}
+