From 30318ac7597d585770ca1e559d3257fc090a05f3 Mon Sep 17 00:00:00 2001 From: Stephen Cameron Date: Tue, 19 Jan 2021 18:01:07 +0100 Subject: [PATCH] WIP #4064 @5 --- web/app/themes/Usines/app/setup.php | 24 +++++++++ .../assets/images/icons/arrow-circle.svg | 4 ++ .../resources/assets/styles/pages/news.styl | 54 +++++++++++++++++++ .../assets/styles/pages/realisations.styl | 47 ++++++++-------- .../views/archive-realisation.blade.php | 36 +++++++++++-- .../Usines/resources/views/index.blade.php | 11 ++-- .../partials/content-realisation.blade.php | 8 +-- .../content-single-realisation.blade.php | 2 +- .../views/partials/content.blade.php | 17 +++--- .../views/widgets/latest-news.blade.php | 23 ++++---- 10 files changed, 168 insertions(+), 58 deletions(-) create mode 100644 web/app/themes/Usines/resources/assets/images/icons/arrow-circle.svg diff --git a/web/app/themes/Usines/app/setup.php b/web/app/themes/Usines/app/setup.php index 2063b6d..2b08ba7 100755 --- a/web/app/themes/Usines/app/setup.php +++ b/web/app/themes/Usines/app/setup.php @@ -308,3 +308,27 @@ add_filter( 'tiny_mce_before_init', function($init_array) { return $init_array; }); + + +/** + * Set paging limits depending on post type (overrides Dashboard > Settings > Reading settings) + */ +add_action('pre_get_posts', function ($query) { + /** @var \WP_Query $query */ + // Only target the main query on the frontend + if (!is_admin() && $query->is_main_query()) { + + // Normal posts (news) must be limited to 6 per page because that's how many + // different decoration styles we have available (see View/Composers/NewsIndex.php) + if ($query->get('post_type') === '') { + $query->set('posts_per_page', 6); + return; + } + + // No limit for Réalisation posts + if ($query->get('post_type') === 'realisation') { + $query->set('posts_per_page', -1); + return; + } + } +}, 1); diff --git a/web/app/themes/Usines/resources/assets/images/icons/arrow-circle.svg b/web/app/themes/Usines/resources/assets/images/icons/arrow-circle.svg new file mode 100644 index 0000000..8e5c8ad --- /dev/null +++ b/web/app/themes/Usines/resources/assets/images/icons/arrow-circle.svg @@ -0,0 +1,4 @@ + + + + diff --git a/web/app/themes/Usines/resources/assets/styles/pages/news.styl b/web/app/themes/Usines/resources/assets/styles/pages/news.styl index 0f14874..345eb91 100644 --- a/web/app/themes/Usines/resources/assets/styles/pages/news.styl +++ b/web/app/themes/Usines/resources/assets/styles/pages/news.styl @@ -1,4 +1,55 @@ +$breakpoint-news-compress = 1200px +$breakpoint-news-stack = 768px + +.news-index + + &-bg // Main beige inset background + width: 55% + z-index: -1 + + +below($breakpoint-news-compress) + width: 80% + +below($breakpoint-news-stack) + width: 100% + + &-decorations + +below($breakpoint-news-stack) + display: none + + &-post + @apply flex items-center + + &:nth-of-type(even) + @apply flex-row-reverse + + +below($breakpoint-news-stack) + flex-direction: column !important + + &-featured-image + width: 25% + + +below($breakpoint-news-stack) + width: 90% + margin-bottom: 5vw + + &-post-text + width: 35% + + +below($breakpoint-news-compress) + width: 50% + +below($breakpoint-news-stack) + width: 90% + + .posts-navigation + center(55%) + + +below($breakpoint-news-compress) + center(80%) + +below($breakpoint-news-stack) + max-width: none + margin: 0 5vw + .nav-links display: flex flex-wrap: wrap @@ -13,5 +64,8 @@ transition: background-color 0.25s white-space: nowrap + .nav-previous + @apply mr-4 + &:hover @apply bg-blue text-white diff --git a/web/app/themes/Usines/resources/assets/styles/pages/realisations.styl b/web/app/themes/Usines/resources/assets/styles/pages/realisations.styl index 1f00002..0461889 100644 --- a/web/app/themes/Usines/resources/assets/styles/pages/realisations.styl +++ b/web/app/themes/Usines/resources/assets/styles/pages/realisations.styl @@ -9,33 +9,34 @@ &:not(:last-child) // Spacing between items margin-right: 2.5rem - &.current-cat a:after // Rotate arrow down when current category - transform: rotate(45deg) - transform-origin: 75% 75% + &.current-cat svg // Rotate arrow down when current category + transform: rotate(-90deg) + transform-origin: center a position: relative + white-space: nowrap // Circle arrow icon (>) - &:before // Circle ( ) - content: '' - display: inline-block - width: 2em - height: @width - vertical-align: middle - margin-right: 0.5em - border-radius: 50% - border: 2px solid - - &:after // Arrow > - content: '' - width: 0.5625em - height: @width - border-style: solid - border-width: 0 2px 2px 0 - transform: rotate(-45deg) - position: absolute - left: 0.6em - top: 0.4em + //&:before // Circle ( ) + // content: '' + // display: inline-block + // width: 2em + // height: @width + // vertical-align: middle + // margin-right: 0.5em + // border-radius: 50% + // border: 2px solid + // + //&:after // Arrow > + // content: '' + // width: 0.5625em + // height: @width + // border-style: solid + // border-width: 0 2px 2px 0 + // transform: rotate(-45deg) + // position: absolute + // left: 0.6em + // top: 0.4em diff --git a/web/app/themes/Usines/resources/views/archive-realisation.blade.php b/web/app/themes/Usines/resources/views/archive-realisation.blade.php index 8a5d641..553b8c1 100644 --- a/web/app/themes/Usines/resources/views/archive-realisation.blade.php +++ b/web/app/themes/Usines/resources/views/archive-realisation.blade.php @@ -27,18 +27,44 @@
{{-- Intro text that is stored in theme's custom options (see Réalisations menu in dashboard) --}} -
{{ $intro }}
+
{{ $intro }}
{{-- Réalisation Categories --}} -