]> _ Git - sycomore-fondation.git/commitdiff
wip #5812 @6:30
authorsoufiane <soufiane@cubedesigners.com>
Mon, 15 May 2023 16:34:30 +0000 (18:34 +0200)
committersoufiane <soufiane@cubedesigners.com>
Mon, 15 May 2023 16:34:30 +0000 (18:34 +0200)
wp-content/mu-plugins/cube/Widgets/AssociationSectionImage.php
wp-content/mu-plugins/cube/Widgets/TextWithBtn.php
wp-content/themes/sycomore-fondation/resources/styles/partials/galleryTwin.sass
wp-content/themes/sycomore-fondation/resources/styles/widgets/blockAssociation.sass
wp-content/themes/sycomore-fondation/resources/styles/widgets/blocktextbtn.sass
wp-content/themes/sycomore-fondation/resources/views/widgets/text-image-with-btn.blade.php [new file with mode: 0644]

index b201435b50f7cce674949d49d3c6c645083a1465..7d7cacda60d152caaf02e850a868eb672ff7e305 100644 (file)
@@ -208,59 +208,7 @@ class AssociationSectionImage extends _Base {
             ?>
             </{$html_tag[$marker_type]}>
         <?php
+        echo "<button class='btn display-all-lists'>Tout afficher <span class='counter'></span></button>";
         echo "</div>";
     }
-
-    protected function content_template() {
-        ?>
-        <#
-        html_tag = {
-        'ordered': 'ol',
-        'unordered': 'ul',
-        'other': 'ul',
-        };
-        view.addRenderAttribute( 'list', 'class', 'assoc-list' );
-
-        view.addRenderAttribute( 'title', 'class', ['font-bold text-lg text-center relative']);
-
-        view.addInlineEditingAttributes( 'title', 'none' );
-
-        #>
-
-        <div class="assoc-block">
-            <# if ('' !== settings.title) { #>
-                <div class="text-block-title relative">
-                <{{{ settings.title_tag }}} {{{ view.getRenderAttributeString( 'title' ) }}}>
-                    {{{ settings.title }}}
-                </{{{ settings.title_tag }}}>
-                <span class="design-line"></span>
-                </div>
-            <# } #>
-            <div class="assoc-block-gallery">
-                <# _.each( settings.gallery, function( image ) { #>
-                <img src="{{ image.url }}">
-                <# }); #>
-            </div>
-            <{{{ html_tag[ settings.marker_type ] }}} {{{ view.getRenderAttributeString( 'list' ) }}}>
-            <# _.each( settings.list_items, function( item, index ) {
-            var repeater_setting_key = view.getRepeaterSettingKey( 'text', 'list_items', index );
-            view.addRenderAttribute( repeater_setting_key, 'class', 'elementor-list-widget-text' );
-            view.addInlineEditingAttributes( repeater_setting_key );
-            #>
-            <li {{{ view.getRenderAttributeString( repeater_setting_key ) }}}>
-                <# var title = item.text; #>
-                <# if ( item.link ) { #>
-                <# view.addRenderAttribute( `link_${index}`, item.link ); #>
-                <a href="{{ item.link.url }}" {{{ view.getRenderAttributeString( `link_${index}` ) }}}>
-                    {{{title}}}
-                </a>
-                <# } else { #>
-                {{{title}}}
-                <# } #>
-            </li>
-            <# } ); #>
-            </{{{ html_tag[ settings.marker_type ] }}}>
-        </div>
-        <?php
-    }
 }
\ No newline at end of file
index 98dd47232bd4ea15ac7cfd64073c66c41c66589c..d79f177dcba3392e545f6195ad3a13e9e7e1bb02 100644 (file)
@@ -3,6 +3,8 @@
 namespace Cube\Widgets;
 
 use Elementor\Controls_Manager;
+use Elementor\Group_Control_Image_Size;
+use Elementor\Widget_Image_Gallery;
 
 class TextWithBtn extends _Base {
 
@@ -113,6 +115,63 @@ class TextWithBtn extends _Base {
         );
 
         $this->end_controls_section();
+
+        $this->start_controls_section(
+            'section_gallery',
+            [
+                'label' => esc_html__( 'Image Gallery', 'elementor' ),
+            ]
+        );
+
+        $this->add_control(
+            'wp_gallery',
+            [
+                'label' => esc_html__( 'Add Images', 'elementor' ),
+                'type' => Controls_Manager::GALLERY,
+                'show_label' => false,
+                'dynamic' => [
+                    'active' => true,
+                ],
+            ]
+        );
+
+        $this->add_group_control(
+            Group_Control_Image_Size::get_type(),
+            [
+                'name' => 'thumbnail', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `thumbnail_size` and `thumbnail_custom_dimension`.
+                'exclude' => [ 'custom' ],
+                'separator' => 'none',
+            ]
+        );
+
+        $gallery_columns = range( 1, 10 );
+        $gallery_columns = array_combine( $gallery_columns, $gallery_columns );
+
+        $this->add_control(
+            'gallery_columns',
+            [
+                'label' => esc_html__( 'Columns', 'elementor' ),
+                'type' => Controls_Manager::SELECT,
+                'default' => 4,
+                'options' => $gallery_columns,
+            ]
+        );
+
+        $this->add_control(
+            'gallery_position',
+            [
+                'label' => esc_html__( 'Position', 'elementor' ),
+                'type' => Controls_Manager::SELECT,
+                'default' => 'gallery-right',
+                'options' => [
+                    'gallery-right' => 'right',
+                    'gallery-left' => 'left',
+                ],
+            ]
+        );
+
+        $this->end_controls_section();
+
         $this->start_controls_section(
             'style_section',
             [
@@ -120,6 +179,16 @@ class TextWithBtn extends _Base {
                 'tab' => Controls_Manager::TAB,
             ]
         );
+        $this->add_control(
+            'text_color',
+            [
+                'label' => esc_html__( 'Text Color', 'cube' ),
+                'type' => Controls_Manager::COLOR,
+                'selectors' => [
+                    '{{WRAPPER}} .highlight' => 'color: {{VALUE}}',
+                ],
+            ]
+        );
         $this->add_control(
             'color',
             [
@@ -143,12 +212,6 @@ class TextWithBtn extends _Base {
      */
     protected function render() {
 
-        $abovetitle = $this->get_settings('above_title');
-        $title = $this->get_settings('title');
-        $title_tag = $this->get_settings('title_tag');
-        $body = $this->parse_text_editor($this->get_settings('body'));
-        $cta_text = $this->get_settings('cta_text');
-        $cta_link = $this->get_settings('cta_link');
         $cta_class = $this->get_settings('cta_class') ? $this->get_settings('cta_class') : '';
 
         if ( ! empty( $cta_link['url'] ) ) {
@@ -167,63 +230,11 @@ class TextWithBtn extends _Base {
         $this->add_render_attribute('body', 'class', ['text-blockbtn-body font-semibold']);
         $this->add_render_attribute('cta_text', 'class', ["text-blockbtn-cta btn font-semibold $cta_class"]);
 
+        $settings = $this->get_settings_for_display();
+        $attributes = $this->get_render_attributes();
+
+        echo view('widgets/text-image-with-btn')->with('settings',$settings)->with('attributes',$attributes);
         // Rendered content
-        echo '<div class="text-blockbtn">';
-        if (!empty($abovetitle)) echo "<p {$this->get_render_attribute_string('above_title')}>$abovetitle</p>";
-        if (!empty($title)) echo "<{$title_tag} {$this->get_render_attribute_string('title')}>$title</{$title_tag}>";
-        if (!empty($body)) echo "<div {$this->get_render_attribute_string('body')}>$body</div>";
-        if (!empty($cta_text)) {
-            echo '<div><a '. $this->get_render_attribute_string('cta_text') .'>';
-            echo $cta_text;
-            echo '</a></div>';
-        }
-        echo '</div>';
     }
 
-    /**
-     * Render text editor widget output in the editor.
-     *
-     * Written as a Backbone JavaScript template and used to generate the live preview.
-     *
-     * @since 1.0.0
-     * @access protected
-     */
-    protected function content_template() {
-        ?>
-        <#
-        div_tag = "div";
-        view.addRenderAttribute( 'above_title', 'class', ['text-block-above-title font-semibold']);
-        view.addRenderAttribute( 'title', 'class', ['text-block-title font-bold text-xl']);
-        view.addRenderAttribute( 'body', 'class', ['text-block-body font-semibold']);
-        view.addRenderAttribute( 'cta_text', 'class', ['text-block-cta btn font-semibold']);
-
-        view.addInlineEditingAttributes( 'above_title', 'none' );
-        view.addInlineEditingAttributes( 'title', 'none' );
-        view.addInlineEditingAttributes( 'body', 'none' );
-        view.addInlineEditingAttributes( 'cta_text', 'none' );
-        #>
-        <{{{ div_tag }}} class="text-blockbtn">
-            <# if ('' !== settings.above_title) { #>
-            <p {{{ view.getRenderAttributeString( 'above_title' ) }}} >{{{ settings.above_title }}}</p>
-            <# } #>
-
-            <# if ('' !== settings.title) { #>
-                <{{{ settings.title_tag }}} {{{ view.getRenderAttributeString( 'title' ) }}}>{{{ settings.title }}}</{{{ settings.title_tag }}}>
-            <# } #>
-
-            <# if ('' !== settings.body) { #>
-            <div {{{ view.getRenderAttributeString( 'body' ) }}}>{{{ settings.body }}}</div>
-            <# } #>
-
-            <# if ('' !== settings.cta_text) { #>
-            <div>
-                <a {{{ view.getRenderAttributeString( 'cta_text' ) }}}>
-                {{{ settings.cta_text }}}
-                </a>
-            </div>
-            <# } #>
-
-        </{{{ div_tag }}}>
-        <?php
-    }
 }
index a8b7fe020b69159f1c222fe5cd9556b1a0d17ca8..6b5dd34d21c8d0da7998b1fd5a43834af9f01f73 100644 (file)
@@ -1,14 +1,20 @@
 .gallery-columns-2
   .gallery
     &-item
+      width: 100%
       &:nth-of-type(2n+1)
-
         max-width: calc(4 * 100% / 7) !important
+        padding-right: 4.5px
+        +screen-size(tablet)
+          padding-right: 10px
         .gallery-icon
           padding-bottom: 119.79%
 
       &:nth-of-type(2n+2)
         max-width: calc(3 * 100% / 7) !important
+        padding-left: 4.5px
+        +screen-size(tablet)
+          padding-left: 10px
         .gallery-icon
           padding-bottom: 134.61%
 
@@ -22,3 +28,4 @@
         top: 50%
         transform: translate(-50%,-50%)
         object-fit: cover
+        border-radius: 3px 3px 3px 3px
index f475848982cce6cba1bebc32958902f1685d1b75..eb51270eecc0c0b08368827f52b6784ef6aef6d6 100644 (file)
@@ -3,11 +3,15 @@
     padding-bottom: 86px
     border-bottom: 1px solid #D8D8D8
     h3,h2
-      width: max-content
-      margin: 0 auto 46px
+      width: 100%
       z-index: 1
       background: #ffffff
-      padding: 0 50px
+      margin: 0 auto 1.313rem
+      text-align: left
+      +screen-size(tablet)
+        width: max-content
+        margin: 0 auto 2.875rem
+        padding: 0 50px
     .design-line
       width: 100%
       height: 1px
       img
         filter: grayscale(1)
   &-list
-    width: 83.33%
     margin: 0 auto
     list-style-type: disc
     list-style-position: inside
     display: grid
     flex-wrap: wrap
-    grid-template-columns: repeat(3, 1fr)
-    +gap
+    grid-template-columns: repeat(1, 1fr)
+    +special-gap(4.444)
+    +screen-size('tablet')
+      width: 83.33%
+      grid-template-columns: repeat(3, 1fr)
+      +special-gap(0)
     li
       width: 100%
+      +screen-size(tablet, 'max')
+        &:nth-child(n + 2)
+          display: none
+          visibility: hidden
index 422d3a4f78c5d8a2646c0b54641a02cc4f0b431b..5e49027a94608556aa0a03eb1ba66bda5380fc3e 100644 (file)
@@ -1,4 +1,37 @@
 .text-blockbtn
+  display: grid
+  +screen-size(small-desktop)
+    grid-template-columns: repeat(12, 1fr)
+    align-items: center
+  +special-gap(0)
+  &.gallery-left
+    +screen-size(small-desktop)
+      .text-blockbtn
+        &-above-title
+          grid-area: 1 / 8 / 2 / 11
+        &-title
+          grid-area: 2 / 8 / 3 / 11
+        &-gallery
+          grid-area: 1 / 1 / 5 / 7
+        &-body
+          grid-area: 3 / 8 / 4 / 11
+        &-btn
+          grid-area: 4 / 8 / 5 / 11
+  &.gallery-right
+    +screen-size(small-desktop)
+      .text-blockbtn
+        &-above-title
+          grid-area: 1 / 2 / 2 / 5
+        &-title
+          grid-area: 2 / 2 / 3 / 5
+        &-gallery
+          grid-area: 1 / 6 / 5 / 13
+        &-body
+          grid-area: 3 / 2 / 4 / 5
+        &-btn
+          grid-area: 4 / 2 / 5 / 5
+
+
   &-above-title
     position: relative
     width: max-content
diff --git a/wp-content/themes/sycomore-fondation/resources/views/widgets/text-image-with-btn.blade.php b/wp-content/themes/sycomore-fondation/resources/views/widgets/text-image-with-btn.blade.php
new file mode 100644 (file)
index 0000000..6fbb0b7
--- /dev/null
@@ -0,0 +1,26 @@
+<div class="text-blockbtn {{ $settings['gallery_position'] }}">
+  <p class="text-blockbtn-above-title highlight relative font-semibold">
+    <span class='relative z-1'>{{ $settings['above_title'] }}</span>
+    <span class='highlight-bar'></span>
+  </p>
+  <{{$settings['title_tag']}} class="{{implode(' ',$attributes['title']['class'])}}">
+    {!! $settings['title'] !!}
+  </{{$settings['title_tag']}}>
+
+  <div class="text-blockbtn-gallery gallery-columns-{{ $settings['gallery_columns'] }}">
+    @foreach($settings['wp_gallery'] as $image)
+      <div class="gallery-item">
+        <div class="gallery-icon">
+          <img class="attachment-{{ $settings['thumbnail_size'] }} size-{{ $settings['thumbnail_size'] }}" src="{{ $image['url'] }}" />
+        </div>
+      </div>
+    @endforeach
+  </div>
+
+  <div class="{{implode(' ',$attributes['body']['class'])}}">{!! $settings['body'] !!}</div>
+  <div class="text-blockbtn-btn">
+    <a href="{{$settings['cta_link']['url']}}" class="{{implode(' ',$attributes['cta_text']['class'])}}">
+      {!! $settings['cta_text'] !!}
+    </a>
+  </div>
+</div>