From 8ea1506a1cea9a886083882829049384c076a01b Mon Sep 17 00:00:00 2001 From: flashwave Date: Wed, 15 Aug 2018 15:08:20 +0200 Subject: [PATCH] Changes the news post previews up a little --- assets/less/mio/classes/news/container.less | 9 ++-- assets/less/mio/classes/news/list.less | 1 - assets/less/mio/classes/news/preview.less | 47 ++++++++++------- public/index.php | 2 +- templates/home/index.twig | 13 ++--- templates/news/category.twig | 57 ++++++++++----------- templates/news/index.twig | 51 +++++++++--------- templates/news/macros.twig | 39 +++++++------- 8 files changed, 106 insertions(+), 113 deletions(-) diff --git a/assets/less/mio/classes/news/container.less b/assets/less/mio/classes/news/container.less index 32308044..59b93732 100644 --- a/assets/less/mio/classes/news/container.less +++ b/assets/less/mio/classes/news/container.less @@ -1,12 +1,9 @@ @mio-news-mobile: 700px; .news__container { - &__content { - margin: 2px; - display: flex; + display: flex; - @media (max-width: @mio-news-mobile) { - flex-direction: column; - } + @media (max-width: @mio-news-mobile) { + flex-direction: column; } } diff --git a/assets/less/mio/classes/news/list.less b/assets/less/mio/classes/news/list.less index b0ff157a..75545549 100644 --- a/assets/less/mio/classes/news/list.less +++ b/assets/less/mio/classes/news/list.less @@ -1,7 +1,6 @@ .news__list { margin: 0; margin-bottom: 2px; - box-shadow: initial; &__item { text-decoration: none; diff --git a/assets/less/mio/classes/news/preview.less b/assets/less/mio/classes/news/preview.less index 1ed6eeff..149c9264 100644 --- a/assets/less/mio/classes/news/preview.less +++ b/assets/less/mio/classes/news/preview.less @@ -1,6 +1,5 @@ .news__preview { margin: 0; - box-shadow: initial; &:not(:last-child) { margin-bottom: 2px; @@ -11,39 +10,51 @@ flex-shrink: 1; } - &__content { + &__container { + display: flex; + margin: 1px; + flex-direction: column; + } + + &__content { + flex-grow: 1; + flex-shrink: 1; display: flex; - margin: 2px; } &__text { - flex-grow: 1; - flex-shrink: 1; - margin-left: 2px; + flex: 1 1 auto; } &__info { - text-align: right; - flex-grow: 0; - flex-shrink: 0; + display: flex; + justify-content: space-between; + border-top: 1px solid #9475b2; + font-size: .9em; + padding: 0 2px; + margin-top: 1px; } - &__date { - display: block; + &__link { + color: inherit; + text-decoration: underline dotted; + + &:hover { + text-decoration: underline; + } } &__user { + text-align: center; + flex: 0 0 auto; text-decoration: none; color: inherit; - display: inline-flex; - - &__name { - font-weight: 700; - } + display: flex; + flex-direction: column; &__avatar { - height: 20px; - width: 20px; + height: 50px; + width: 50px; margin-left: 4px; } } diff --git a/public/index.php b/public/index.php index 3b11a01d..cff7fede 100644 --- a/public/index.php +++ b/public/index.php @@ -34,7 +34,7 @@ $news = Database::query(' ON u.`display_role` = r.`role_id` WHERE p.`is_featured` = true ORDER BY p.`created_at` DESC - LIMIT 3 + LIMIT 5 ')->fetchAll(PDO::FETCH_ASSOC); $statistics = Cache::instance()->get('index:stats:v1', function () { diff --git a/templates/home/index.twig b/templates/home/index.twig index 50f4905e..6d8418cc 100644 --- a/templates/home/index.twig +++ b/templates/home/index.twig @@ -34,16 +34,9 @@ {% endif %} -
- Featured News -
-
- {% for post in featured_news %} - {{ news_preview(post) }} - {% endfor %} -
-
-
+ {% for post in featured_news %} + {{ news_preview(post) }} + {% endfor %} diff --git a/templates/news/category.twig b/templates/news/category.twig index 04b75160..b2cb3446 100644 --- a/templates/news/category.twig +++ b/templates/news/category.twig @@ -9,42 +9,37 @@ }) %} {% block content %} -
-
News » {{ category.category_name }}
-
-
- {% for post in posts %} - {{ news_preview(post) }} - {% endfor %} +
+
+ {% for post in posts %} + {{ news_preview(post) }} + {% endfor %} +
+ +
+
+
+ News » {{ category.category_name }} +
+
+ {{ category.category_description|length > 0 ? category.category_description : '' }} +
-
- {% if category.category_description|length > 0 %} -
-
- Description -
-
- {{ category.category_description }} -
+ {% if featured|length > 0 %} +
+
+ Featured Posts
- {% endif %} - - {% if featured|length > 0 %} -
-
- Featured Posts -
-
- {% for featured_post in featured %} - {{ featured_post.post_title }} - {% endfor %} -
+
+ {% for featured_post in featured %} + {{ featured_post.post_title }} + {% endfor %}
- {% endif %} +
+ {% endif %} - {{ pagination(category.posts_count, posts_take, posts_offset, '/news.php?c=' ~ category.category_id) }} -
+ {{ pagination(category.posts_count, posts_take, posts_offset, '/news.php?c=' ~ category.category_id) }}
{% endblock %} diff --git a/templates/news/index.twig b/templates/news/index.twig index 340dc3f9..d7ee36bf 100644 --- a/templates/news/index.twig +++ b/templates/news/index.twig @@ -6,36 +6,33 @@ {% set canonical_url = '/news.php'|url_construct({'o':posts_offset}) %} {% block content %} -
-
News
-
-
- {% for post in posts %} - {{ news_preview(post) }} - {% endfor %} -
+
+
+ {% for post in posts %} + {{ news_preview(post) }} + {% endfor %} +
-
-
-
- Categories -
- +
+
+
+ Categories +
+ - - {{ pagination(posts_count, posts_take, posts_offset, '/news.php') }}
+ + {{ pagination(posts_count, posts_take, posts_offset, '/news.php') }}
{% endblock %} diff --git a/templates/news/macros.twig b/templates/news/macros.twig index 882ad83b..c10421ba 100644 --- a/templates/news/macros.twig +++ b/templates/news/macros.twig @@ -4,33 +4,34 @@ {{ post.post_title }} -