From: Stephen Cameron Date: Mon, 18 Jan 2021 20:49:26 +0000 (+0100) Subject: WIP #4064 @11 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=6e64e689ce1d4d548861268e1c204957350ebcbb;p=usines-reunies.git WIP #4064 @11 --- diff --git a/.gitignore b/.gitignore index 6639ba7..85b2378 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ # Misc +.uploads-proxy .DS_Store .idea _doc @@ -9,6 +10,7 @@ _doc # Application web/app/plugins/* !web/app/plugins/.gitkeep +web/app/mu-plugins/wp-migrate-db-pro-compatibility.php web/app/mu-plugins/*/ !web/app/mu-plugins/cube web/app/upgrade diff --git a/web/app/mu-plugins/cube/src/Elementor/Setup.php b/web/app/mu-plugins/cube/src/Elementor/Setup.php index 0402f97..c420b42 100644 --- a/web/app/mu-plugins/cube/src/Elementor/Setup.php +++ b/web/app/mu-plugins/cube/src/Elementor/Setup.php @@ -28,9 +28,11 @@ class Setup { $elementor->widgets_manager->register_widget_type( new Widgets\TextBlock() ); $elementor->widgets_manager->register_widget_type( new Widgets\IntroCarousel() ); $elementor->widgets_manager->register_widget_type( new Widgets\Circle() ); + $elementor->widgets_manager->register_widget_type( new Widgets\BackgroundLayer() ); $elementor->widgets_manager->register_widget_type( new Widgets\ImageMap() ); $elementor->widgets_manager->register_widget_type( new Widgets\TeamGrid() ); - $elementor->widgets_manager->register_widget_type( new Widgets\Realisations() ); + $elementor->widgets_manager->register_widget_type( new Widgets\LatestRealisations() ); + $elementor->widgets_manager->register_widget_type( new Widgets\LatestNews() ); } @@ -106,13 +108,13 @@ class Setup { $element->add_render_attribute('_wrapper', 'data-cols', $cols); -// echo "

COLS: $cols

"; -// echo "
";
-//            /* @var \Elementor\Element_Column $el */
-//            foreach ($children as $child) {
-//                print_r($child->get_data()['settings']);
-//            }
-//            echo "
"; + //echo "

COLS: $cols

"; + //echo "
";
+            ///* @var \Elementor\Element_Column $el */
+            //foreach ($children as $child) {
+            //    print_r($child->get_data()['settings']);
+            //}
+            //echo "
"; $settings = $element->get_settings(); diff --git a/web/app/mu-plugins/cube/src/Elementor/Widgets/BackgroundLayer.php b/web/app/mu-plugins/cube/src/Elementor/Widgets/BackgroundLayer.php new file mode 100644 index 0000000..c064afa --- /dev/null +++ b/web/app/mu-plugins/cube/src/Elementor/Widgets/BackgroundLayer.php @@ -0,0 +1,200 @@ +start_controls_section( + 'section_content', + [ + 'label' => __( 'Fond Détaché', 'cube' ), + ] + ); + + $this->add_control( + 'bg_color', + [ + 'label' => __( 'Couleur', 'cube' ), + 'type' => Controls_Manager::COLOR, + 'default' => '', + 'selectors' => [ + '{{WRAPPER}} .cube-bg-layer' => 'background-color: {{VALUE}};', + ], + ] + ); + + + $this->add_control( + '_z_index', // A more convenient version than the one in the advanced settings + [ + 'label' => __( 'Z-Index', 'elementor' ), + 'type' => Controls_Manager::TEXT, + 'default' => '0', + 'selectors' => [ + '{{WRAPPER}}' => 'z-index: {{VALUE}};', + ], + ] + ); + + $this->add_control( + '_css_classes', // A more convenient version than the one in the advanced settings + [ + 'label' => __( 'CSS Classes', 'elementor' ), + 'type' => Controls_Manager::TEXT, + 'default' => '', + 'prefix_class' => '', + ] + ); + + $this->add_control( + 'top', + [ + 'label' => __( 'Top Offset', 'elementor' ), + 'type' => Controls_Manager::TEXT, + 'default' => '0', + 'selectors' => [ + '{{WRAPPER}}' => 'top: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'bottom', + [ + 'label' => __( 'Bottom Offset', 'elementor' ), + 'type' => Controls_Manager::TEXT, + 'default' => '0', + 'selectors' => [ + '{{WRAPPER}}' => 'bottom: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'left', + [ + 'label' => __( 'Left Offset', 'elementor' ), + 'type' => Controls_Manager::TEXT, + 'default' => '0', + 'selectors' => [ + '{{WRAPPER}}' => 'left: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'right', + [ + 'label' => __( 'Left Offset', 'elementor' ), + 'type' => Controls_Manager::TEXT, + 'default' => '0', + 'selectors' => [ + '{{WRAPPER}}' => 'right: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'width', + [ + 'label' => __( 'Width', 'elementor' ), + 'type' => Controls_Manager::TEXT, + 'default' => 'auto', + 'selectors' => [ + '{{WRAPPER}}' => 'width: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'height', + [ + 'label' => __( 'Height', 'elementor' ), + 'type' => Controls_Manager::TEXT, + 'default' => 'auto', + 'selectors' => [ + '{{WRAPPER}}' => 'height: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'margin_bottom', + [ + 'label' => __( 'Bottom Margin', 'elementor' ), + 'type' => Controls_Manager::TEXT, + 'default' => '0', + 'selectors' => [ + '{{WRAPPER}}' => 'margin-bottom: {{VALUE}} !important;', + ], + ] + ); + +// $this->add_control( +// 'width', +// [ +// 'label' => __( 'Largeur', 'cube' ), +// 'type' => Controls_Manager::TEXT, +// 'default' => '100%', +// 'selectors' => [ +// '{{WRAPPER}} .bg-layer' => 'width: {{VALUE}};', +// ], +// ] +// ); + + + + $this->end_controls_section(); + + $this->common_controls(); + } + /** + * Render the widget output on the frontend. + * Written in PHP and used to generate the final HTML. + * + * @since 1.0.0 + * @access protected + */ + protected function render() { + echo '
'; + } +} diff --git a/web/app/mu-plugins/cube/src/Elementor/Widgets/LatestNews.php b/web/app/mu-plugins/cube/src/Elementor/Widgets/LatestNews.php new file mode 100644 index 0000000..d29bf2a --- /dev/null +++ b/web/app/mu-plugins/cube/src/Elementor/Widgets/LatestNews.php @@ -0,0 +1,105 @@ +start_controls_section( + 'section_content', + [ + 'label' => __( 'Dernières Actualités', 'cube' ), + ] + ); + + $this->add_control( + 'widget_description', + [ + 'raw' => __( 'Ce widget affichera les actualités les plus récentes', 'cube' ), + 'type' => Controls_Manager::RAW_HTML, + 'content_classes' => 'elementor-descriptor', + ] + ); + + /* + $this->add_control( + 'posts_limit', + [ + 'label' => __( 'Number of posts to display', 'cube' ), + 'type' => Controls_Manager::NUMBER, + 'default' => 3, + ] + ); + */ + + $this->end_controls_section(); + + $this->common_controls(); + } + /** + * Render the widget output on the frontend. + * Written in PHP and used to generate the final HTML. + * + * @since 1.0.0 + * @access protected + */ + protected function render() { + + $posts_limit = 3; //$this->get_settings('posts_limit'); + + $news_posts = wp_get_recent_posts([ + 'numberposts' => $posts_limit, + 'orderby' => 'post_date', + 'order' => 'DESC', + 'post_type' => 'post', + 'post_status' => 'publish', + 'suppress_filters' => true + ]); + + if ($news_posts) { + echo view('widgets.latest-news', compact('news_posts')); + } + + } +} diff --git a/web/app/mu-plugins/cube/src/Elementor/Widgets/LatestRealisations.php b/web/app/mu-plugins/cube/src/Elementor/Widgets/LatestRealisations.php new file mode 100644 index 0000000..b917ff2 --- /dev/null +++ b/web/app/mu-plugins/cube/src/Elementor/Widgets/LatestRealisations.php @@ -0,0 +1,109 @@ +start_controls_section( + 'section_content', + [ + 'label' => __( 'Dernières Réalisations', 'cube' ), + ] + ); + + $this->add_control( + 'widget_description', + [ + 'raw' => __( 'Ce widget affichera les réalisations les plus récentes', 'cube' ), + 'type' => Controls_Manager::RAW_HTML, + 'content_classes' => 'elementor-descriptor', + ] + ); + + /* + $this->add_control( + 'posts_limit', + [ + 'label' => __( 'Number of posts to display', 'cube' ), + 'type' => Controls_Manager::NUMBER, + 'default' => 3, + ] + ); + */ + + $this->end_controls_section(); + + $this->common_controls(); + } + /** + * Render the widget output on the frontend. + * Written in PHP and used to generate the final HTML. + * + * @since 1.0.0 + * @access protected + */ + protected function render() { + + $posts_limit = 3; //$this->get_settings('posts_limit'); + + $realisation_posts = wp_get_recent_posts([ + 'numberposts' => $posts_limit, + 'orderby' => 'post_date', + 'order' => 'DESC', + 'post_type' => 'realisation', + 'post_status' => 'publish', + 'suppress_filters' => true + ]); + + if ($realisation_posts) { + echo '
'; + foreach ($realisation_posts as $realisation_post) { + echo view('partials.content-realisation', compact('realisation_post')); + } + echo '
'; + } + + } +} diff --git a/web/app/mu-plugins/cube/src/Elementor/Widgets/Realisations.php b/web/app/mu-plugins/cube/src/Elementor/Widgets/Realisations.php deleted file mode 100644 index 93bced7..0000000 --- a/web/app/mu-plugins/cube/src/Elementor/Widgets/Realisations.php +++ /dev/null @@ -1,105 +0,0 @@ -start_controls_section( - 'section_content', - [ - 'label' => __( 'Réalisations', 'cube' ), - ] - ); - - $this->add_control( - 'widget_description', - [ - 'raw' => __( 'This widget will display the most recent réalisation posts.', 'cube' ), - 'type' => Controls_Manager::RAW_HTML, - 'content_classes' => 'elementor-descriptor', - ] - ); - - $this->add_control( - 'posts_limit', - [ - 'label' => __( 'Number of posts to display', 'cube' ), - 'type' => Controls_Manager::NUMBER, - 'default' => 10, - ] - ); - - $this->end_controls_section(); - - $this->common_controls(); - } - /** - * Render the widget output on the frontend. - * Written in PHP and used to generate the final HTML. - * - * @since 1.0.0 - * @access protected - */ - protected function render() { - - $posts_limit = $this->get_settings('posts_limit'); - - $realisation_posts = wp_get_recent_posts([ - 'numberposts' => $posts_limit, - 'orderby' => 'post_date', - 'order' => 'DESC', - 'post_type' => 'realisation', - 'post_status' => 'publish', - 'suppress_filters' => true - ]); - - if ($realisation_posts) { - foreach ($realisation_posts as $realisation_post) { - echo view('partials.content-realisation', compact('realisation_post')); - } - } - - } -} diff --git a/web/app/mu-plugins/cube/src/Elementor/Widgets/TextBlock.php b/web/app/mu-plugins/cube/src/Elementor/Widgets/TextBlock.php index 26cfb22..4d03754 100644 --- a/web/app/mu-plugins/cube/src/Elementor/Widgets/TextBlock.php +++ b/web/app/mu-plugins/cube/src/Elementor/Widgets/TextBlock.php @@ -182,6 +182,18 @@ class TextBlock extends _Base { ] ); + $this->add_responsive_control( + 'width', + [ + 'label' => __( 'Width', 'elementor' ), + 'type' => Controls_Manager::TEXT, + 'default' => '100%', + 'selectors' => [ + '{{WRAPPER}} .text-block' => 'width: {{VALUE}};', + ], + ] + ); + $this->add_control( 'max_width', [ diff --git a/web/app/themes/Usines/resources/assets/scripts/intro-carousel.js b/web/app/themes/Usines/resources/assets/scripts/intro-carousel.js index 70bb0cb..90b0746 100644 --- a/web/app/themes/Usines/resources/assets/scripts/intro-carousel.js +++ b/web/app/themes/Usines/resources/assets/scripts/intro-carousel.js @@ -4,33 +4,11 @@ elementorFrontend.hooks.addAction('frontend/element_ready/cube-intro-carousel.default', function ($scope) { // Inspired by: https://www.sitepoint.com/make-a-simple-javascript-slideshow-without-jquery/ - const slides = $scope.find('.intro-carousel-image'); + const slides = $scope.find('.intro-carousel-slide'); const slideInterval = setInterval(nextSlide, 4000); let currentSlide = 0; - initSlideshow(); - - function initSlideshow() { - let slideshowDots = document.createElement('ul'); - slideshowDots.className = 'intro-carousel-dots'; - - // Build dots navigation - slides.each(function (index) { - let item = document.createElement('li'); - item.setAttribute('data-slide', index); - if (index === 0) { - item.className = 'active'; - } - slideshowDots.appendChild(item); - }); - - $scope.append(slideshowDots); - - $(document).on('click', '.intro-carousel-dots li', function() { - clearInterval(slideInterval); // Stop autoplay - showSlide($(this).data('slide')); - }); - } + showSlide(0); function showSlide(index) { $(slides[currentSlide]).removeClass('showing'); @@ -47,8 +25,6 @@ showSlide(currentSlide - 1); } - - }); }); })(jQuery); diff --git a/web/app/themes/Usines/resources/assets/styles/components/navigation-mobile.styl b/web/app/themes/Usines/resources/assets/styles/components/navigation-mobile.styl index 86bbcc1..f5b606e 100644 --- a/web/app/themes/Usines/resources/assets/styles/components/navigation-mobile.styl +++ b/web/app/themes/Usines/resources/assets/styles/components/navigation-mobile.styl @@ -41,7 +41,7 @@ //=== Burger menu icon + animation &-opener - position: fixed + position: absolute width: 30px height: @width top: @width diff --git a/web/app/themes/Usines/resources/assets/styles/widgets/background-layer.styl b/web/app/themes/Usines/resources/assets/styles/widgets/background-layer.styl new file mode 100644 index 0000000..0f37145 --- /dev/null +++ b/web/app/themes/Usines/resources/assets/styles/widgets/background-layer.styl @@ -0,0 +1,7 @@ +.elementor-widget-cube-bg-layer + position: absolute + margin-bottom: 0 + + .elementor-widget-container + min-height: 1px // Prevent Elementor editor from thinking this is empty because it only contains absolute positioned elements + height: 100% diff --git a/web/app/themes/Usines/resources/assets/styles/widgets/intro-carousel.styl b/web/app/themes/Usines/resources/assets/styles/widgets/intro-carousel.styl new file mode 100644 index 0000000..d096121 --- /dev/null +++ b/web/app/themes/Usines/resources/assets/styles/widgets/intro-carousel.styl @@ -0,0 +1,49 @@ +$breakpoint-carousel = 768px + + +.intro-carousel + @apply flex flex-row-reverse items-center + + +below($breakpoint-carousel) + @apply flex-col-reverse + + &-text + flex-basis: 40% + + +below(1600px) + flex-basis: 50% + +below(1350px) + flex-basis: 60% + + &-slides + flex-basis: 60% + + +below($breakpoint-carousel) + width: 100% + margin-right: 2.5vw + margin-bottom: 5vw + + &-slide + position: relative + z-index: 1 + opacity: 0 + transition: opacity 1s + + &.showing + opacity: 1 + z-index: 2 + + + &-caption + position: absolute + bottom: 6% + left: 3% + right: 60% + text-align: right + + +below(1600px) + font-size: 1.1vw + +below(1350px) + font-size: 0.9vw + +below($breakpoint-carousel) + font-size: 2vw diff --git a/web/app/themes/Usines/resources/assets/styles/widgets/latest-news.styl b/web/app/themes/Usines/resources/assets/styles/widgets/latest-news.styl new file mode 100644 index 0000000..d07ea84 --- /dev/null +++ b/web/app/themes/Usines/resources/assets/styles/widgets/latest-news.styl @@ -0,0 +1,12 @@ +.latest-news + display: grid + grid-template-columns: repeat(3, 1fr) + constrain(grid-gap, 5vw) + + +below(1024px) + @apply text-sm + grid-gap: 2.5vw + + +below(500px) + grid-template-columns: 1fr + grid-gap: 7.5vw diff --git a/web/app/themes/Usines/resources/assets/styles/widgets/latest-realisations.styl b/web/app/themes/Usines/resources/assets/styles/widgets/latest-realisations.styl new file mode 100644 index 0000000..d0c22a6 --- /dev/null +++ b/web/app/themes/Usines/resources/assets/styles/widgets/latest-realisations.styl @@ -0,0 +1,24 @@ +.latest-realisations + display: grid + grid-template-columns: repeat(3, 1fr) + constrain(grid-gap, 5vw) + + +below(1024px) + @apply text-sm + grid-gap: 2.5vw + + +below(500px) + grid-template-columns: 1fr + grid-gap: 7.5vw + + article + padding-top: 0 !important + + article + &:nth-child(1) + constrain(padding-top, 2.5vw) + &:nth-child(3) + constrain(padding-top, 5vw) + + &.mt-2v + margin-top: 0 diff --git a/web/app/themes/Usines/resources/views/index.blade.php b/web/app/themes/Usines/resources/views/index.blade.php index 0dde956..088824e 100644 --- a/web/app/themes/Usines/resources/views/index.blade.php +++ b/web/app/themes/Usines/resources/views/index.blade.php @@ -2,7 +2,7 @@ @section('content') -

L'actu mobilier & déco

+

L’actu mobilier & déco

{{-- Applying 1px vertical padding here so margins take effect at top and bottom (can't use overflow:hidden due to background decorations) --}}
diff --git a/web/app/themes/Usines/resources/views/partials/content-realisation.blade.php b/web/app/themes/Usines/resources/views/partials/content-realisation.blade.php index 5b5a81e..e498d3d 100644 --- a/web/app/themes/Usines/resources/views/partials/content-realisation.blade.php +++ b/web/app/themes/Usines/resources/views/partials/content-realisation.blade.php @@ -3,12 +3,12 @@ // exists outside the loop, we are sometimes getting data that is passed in and other times relying on // the global loop context. As a result, the code had to be modified a bit to work in both situations. $postID = isset($realisation_post) ? $realisation_post['ID'] : $post->ID; - $thumbnail = carbon_get_post_meta($postID, 'thumbnail'); + $thumbnail = get_post_meta($postID, '_thumbnail', true); $thumbnail_image = $thumbnail ? wp_get_attachment_image($thumbnail, 'large') : ''; - $thumbnail_caption = carbon_get_post_meta($postID, 'thumbnail_caption'); + $thumbnail_caption = get_post_meta($postID, '_thumbnail_caption', true); @endphp diff --git a/web/app/themes/Usines/resources/views/partials/footer.blade.php b/web/app/themes/Usines/resources/views/partials/footer.blade.php index 21ac9ce..b0914ea 100644 --- a/web/app/themes/Usines/resources/views/partials/footer.blade.php +++ b/web/app/themes/Usines/resources/views/partials/footer.blade.php @@ -37,7 +37,7 @@

{!! nl2br(get_option('contact_footer_text')) !!}

- + @svg('images/icons/phone', 'fill-current h-10 mr-4') {{ $contact_phone }} @@ -59,11 +59,7 @@

Des promos & des news !

Inscrivez-vous à notre newsletter

- + {!! do_shortcode('[hf_form slug="newsletter"]') !!}
diff --git a/web/app/themes/Usines/resources/views/partials/header.blade.php b/web/app/themes/Usines/resources/views/partials/header.blade.php index 1047c5a..b700f47 100644 --- a/web/app/themes/Usines/resources/views/partials/header.blade.php +++ b/web/app/themes/Usines/resources/views/partials/header.blade.php @@ -41,7 +41,7 @@ - + {{ get_option('contact_header_text') }}
{{ $contact_phone }} diff --git a/web/app/themes/Usines/resources/views/single.blade.php b/web/app/themes/Usines/resources/views/single.blade.php index 08f40d4..3dd430b 100644 --- a/web/app/themes/Usines/resources/views/single.blade.php +++ b/web/app/themes/Usines/resources/views/single.blade.php @@ -3,7 +3,7 @@ @section('content') {{-- H2 tag here because the post has a H1 for the title --}} -

L'actu mobilier & déco

+

L’actu mobilier & déco

diff --git a/web/app/themes/Usines/resources/views/widgets/intro-carousel.blade.php b/web/app/themes/Usines/resources/views/widgets/intro-carousel.blade.php index 8dc5bf6..a710a7f 100644 --- a/web/app/themes/Usines/resources/views/widgets/intro-carousel.blade.php +++ b/web/app/themes/Usines/resources/views/widgets/intro-carousel.blade.php @@ -1,7 +1,7 @@ {{-- INTRO CAROUSEL --}} -