]> _ Git - ccgm.git/commitdiff
Wait #3413 @7.5
authorstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 10 Mar 2020 17:57:20 +0000 (17:57 +0000)
committerstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 10 Mar 2020 17:57:20 +0000 (17:57 +0000)
19 files changed:
framework/application/configs/application.ini
framework/application/controllers/AdminajaxController.php
framework/application/models/News.php
framework/application/views/helpers/Actualites.php
framework/application/views/helpers/News.php
framework/application/views/scripts/common/footer.phtml
framework/application/views/scripts/news/index.phtml
images/facebook.svg [new file with mode: 0644]
images/home-slider-next.svg [new file with mode: 0644]
images/home-slider-prev.svg [new file with mode: 0644]
images/play.svg [new file with mode: 0644]
images/slider-next.svg [new file with mode: 0644]
images/slider-prev.svg [new file with mode: 0644]
images/twitter.svg [new file with mode: 0644]
index.php
js/news-article.js
js/slick-lightbox.js
less/news-article.less
less/slick-lightbox.less

index d88902e05999b312efa9d2f2e663b36a61fc0b06..25d2814a6448dcb62e3be330844d5c3ba37e7855 100644 (file)
@@ -1,5 +1,6 @@
 [base]
 dev = false
+firephp = false ;Disabled because it can cause "502 bad gateway" errors
 
 minify.js = true
 minify.css = false
@@ -69,6 +70,19 @@ httpauth.password = 20ccgm13
 
 seo.robots = false
 
+[dev : base]
+
+dev = true
+webhost = dev.ccgm.fr
+
+;httpauth.username = ccgm
+;httpauth.password = 20ccgm20
+
+database.params.host = ccgmzwgfdev.mysql.db
+database.params.username = ccgmzwgfdev
+database.params.dbname = ccgmzwgfdev
+database.params.password = nqSYJEaJ84r7xGoPnTjc
+
 [dev-local : base]
 
 dev = true
index 69984187ddc24f011189307668157064b6657b28..add95207a2a7a6d88ddee78c931c458f698e091e 100644 (file)
@@ -2,6 +2,12 @@
 
 class AdminajaxController extends CubeIT_Controller_Admin_AdminajaxController {
 
-}
+    public function saveselectlist($class, $element, $dataFilters, $reloadOnSave = false) {
+
+        $this->clearCacheTag('navigation');
+        $this->clearCacheTag('contents');
 
-?>
+        return parent::saveselectlist($class, $element, $dataFilters, $reloadOnSave);
+    }
+
+}
index c331513aa4a19e09870571a0668edf21c016f43b..ea636c4202c1bd9d284fb70776f1dd5cd1862782 100644 (file)
@@ -29,6 +29,27 @@ class CCGM_Model_News extends CubeIT_Model_Data_Table {
         return explode(PHP_EOL, $this->content)[0];
        }
 
+       // Get the best image for the post
+    public function getPosterImage($width, $height, $class) {
+
+           $this->view = Zend_Controller_Action_HelperBroker::getExistingHelper('ViewRenderer')->view;
+
+        $img = $this->view->imageProcess($this->getImage(), '', $width, $height, ['class' => $class]);
+
+        // No images found in 'image' field, so look for a video frame
+        if (!$img) {
+            $videos = $this->getVideoDetails();
+
+            if (count($videos) > 0) {
+                return '<div class="'. $class .'" style="background-image: url('. $videos[0]['image'] .'); background-position: center; background-size: cover; width: '. $width .'px; height: '. $height .'px"></div>';
+            } else {
+                return false;
+            }
+        }
+
+           return $img;
+       }
+
        // Process YouTube URLs entered and get poster images
        public function getVideoDetails() {
            $video_list = trim($this->videos);
@@ -48,7 +69,7 @@ class CCGM_Model_News extends CubeIT_Model_Data_Table {
             $videos[] = [
                 'url' => $video_URL,
                 'image' => $video_image,
-                'embed' => "https://www.youtube.com/embed/$video_ID",
+                'embed' => "https://www.youtube.com/embed/$video_ID?enablejsapi=1&iv_load_policy=3&rel=0&showinfo=0",
             ];
         }
                
index 41d42c491656ff52e61618449ed517f5c8586fe3..86b22d3d8b749733c4c6fbd683e390c60e763dbf 100644 (file)
@@ -27,7 +27,7 @@ class CCGM_View_Helper_Actualites extends CubeIT_View_Helper_Abstract {
        protected function _actu($a) {\r
 \r
         $URL = CubeIT_Navigation_Page::generateAutoUri($a, Bootstrap::getNewsArticleURLTemplate());\r
-           $img = $this->imageProcess($a->getImage(), '', 410, 266, ['class' => 'home-news-image']);\r
+           $img = $a->getPosterImage(410, 266, 'home-news-image');\r
 \r
         if (!$img) {\r
             $img = '<div class="home-news-image home-news-image-empty"></div>';\r
@@ -37,7 +37,7 @@ class CCGM_View_Helper_Actualites extends CubeIT_View_Helper_Abstract {
         $res .= '<div class="home-news-article-content">';\r
         $res .= $this->link($this->htmlElement($a->getTitle(), 'h2'), $URL, ['class' => 'home-news-heading-link']);\r
         $res .= $this->markupDotclear($a->getExcerpt());\r
-        $res .= $this->link("Voir toute l'actualité &gt;", 'internal:news', ['class' => 'home-news-read-more']);\r
+        $res .= $this->link("Voir l'actualité &gt;", 'internal:news', ['class' => 'home-news-read-more']);\r
         $res .= '</div>'; // .home-news-article-content\r
         $res = $this->htmlElement($res, 'article', ['class' => 'home-news-article']);\r
         return $this->htmlElement($res, 'div', ['class' => 'home-news-item']);\r
index 823067795ed533a25e9179f3f0cecd0de800f09a..77f8ba63e6937cc0c045bfc0145257d33ed8dda8 100644 (file)
@@ -19,8 +19,7 @@ class CCGM_View_Helper_News extends CubeIT_View_Helper_Abstract {
 \r
            $URL = CubeIT_Navigation_Page::generateAutoUri($n, Bootstrap::getNewsArticleURLTemplate());\r
 \r
-\r
-               $img = $this->imageProcess($n->getImage(), '', 247, 247, ['class' => 'news-image']);\r
+               $img = $n->getPosterImage(247, 247, 'news-image');\r
 \r
                if (!$img) {\r
                    $img = '<div class="news-image news-image-empty"></div>';\r
index bc00357899349227cef4dcec198bdb43a350eecf..c7c473760fd2a07752f7336e3e5181fdacc757d0 100644 (file)
@@ -27,6 +27,7 @@ $f = $this->options['footer'];
                 </div>\r
 \r
                 <ul class="social">\r
+                    <?php if (!isset($f['social']) || !is_array($f['social'])) $f['social'] = []; ?>\r
                     <?php foreach ($f['social'] as $social): ?>\r
                     <li>\r
                         <a href="<?= $social['url'] ?>" title="<?= $social['name'] ?>" target="_blank" rel="noopener">\r
index b8f7435c23df7cd60e5157c4e6a6604e2df4edf6..81f6e2d03bb49ec146e4698bb36bb4b6e9d638e3 100644 (file)
@@ -28,7 +28,7 @@ $sharing_URL = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https"
         <?php endforeach; ?>
 
         <?php foreach ($news->getVideoDetails() as $video): ?>
-            <a href="<?= $video['embed'] ?>" target="_blank">
+            <a class="news-slider-video" href="<?= $video['embed'] ?>" target="_blank">
                 <img class="news-slider-image" src="<?= $video['image'] ?>">
             </a>
         <?php endforeach; ?>
diff --git a/images/facebook.svg b/images/facebook.svg
new file mode 100644 (file)
index 0000000..2b468c8
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+        width="112.2px" height="112.2px" viewBox="0 0 112.2 112.2" style="enable-background:new 0 0 112.2 112.2;" xml:space="preserve"
+       >
+<style type="text/css">
+       .st0{fill:#5e5e5e;}
+       .st1{fill:#FFFFFF;}
+</style>
+<g>
+       <path class="st0" d="M56.1,0c30.98,0,56.1,25.12,56.1,56.1s-25.12,56.1-56.1,56.1C25.12,112.2,0,87.08,0,56.1S25.12,0,56.1,0"/>
+       <path class="st1" d="M70.2,58.29H60.19v36.67H45.03V58.29h-7.21V45.41h7.21v-8.34c0-5.96,2.83-15.3,15.3-15.3l11.23,0.05v12.51
+               h-8.15c-1.34,0-3.22,0.67-3.22,3.51v7.58h11.33L70.2,58.29z"/>
+</g>
+</svg>
diff --git a/images/home-slider-next.svg b/images/home-slider-next.svg
new file mode 100644 (file)
index 0000000..f1d9501
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+        width="21.43px" height="40.02px" viewBox="0 0 21.43 40.02" style="enable-background:new 0 0 21.43 40.02;" xml:space="preserve"
+       >
+<style type="text/css">
+       .st0{clip-path:url(#SVGID_2_);fill:none;stroke:#8E8E8D;stroke-width:2;stroke-miterlimit:10;}
+</style>
+<g>
+       <defs>
+               <rect id="SVGID_1_" y="0" width="21.43" height="40.02"/>
+       </defs>
+       <clipPath id="SVGID_2_">
+               <use xlink:href="#SVGID_1_"  style="overflow:visible;"/>
+       </clipPath>
+       <polyline class="st0" points="0.71,0.71 20.01,20.01 0.71,39.32  "/>
+</g>
+</svg>
diff --git a/images/home-slider-prev.svg b/images/home-slider-prev.svg
new file mode 100644 (file)
index 0000000..d42dfaf
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+        width="21.43px" height="40.02px" viewBox="0 0 21.43 40.02" style="enable-background:new 0 0 21.43 40.02;" xml:space="preserve"
+       >
+<style type="text/css">
+       .st0{clip-path:url(#SVGID_2_);fill:none;stroke:#8E8E8D;stroke-width:2;stroke-miterlimit:10;}
+</style>
+<g>
+       <defs>
+               <rect id="SVGID_1_" y="0" width="21.43" height="40.02"/>
+       </defs>
+       <clipPath id="SVGID_2_">
+               <use xlink:href="#SVGID_1_"  style="overflow:visible;"/>
+       </clipPath>
+       <polyline class="st0" points="20.72,39.32 1.41,20.01 20.72,0.71         "/>
+</g>
+</svg>
diff --git a/images/play.svg b/images/play.svg
new file mode 100644 (file)
index 0000000..c272b49
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<svg version="1.1" id="Calque_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+     viewBox="0 0 78.7 90.6" style="enable-background:new 0 0 78.7 90.6;" xml:space="preserve">
+<style type="text/css">
+       .st0{fill:#FFFFFF;}
+</style>
+    <path class="st0" d="M5.9,0.5l70.9,41.4c2.6,1.5,2.6,5.3,0,6.8L5.9,90.1C3.3,91.6,0,89.7,0,86.7L0,3.9C0,0.9,3.3-1,5.9,0.5z"/>
+</svg>
diff --git a/images/slider-next.svg b/images/slider-next.svg
new file mode 100644 (file)
index 0000000..da5f86e
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+        width="53.39px" height="53.39px" viewBox="0 0 53.39 53.39" style="enable-background:new 0 0 53.39 53.39;" xml:space="preserve"
+       >
+<style type="text/css">
+       .st0{clip-path:url(#SVGID_2_);fill:#0EA0D1;}
+       .st1{clip-path:url(#SVGID_2_);fill:none;stroke:#FFFFFF;stroke-width:2;stroke-miterlimit:10;}
+</style>
+<g>
+       <defs>
+               <rect id="SVGID_1_" y="0" width="53.39" height="53.39"/>
+       </defs>
+       <clipPath id="SVGID_2_">
+               <use xlink:href="#SVGID_1_"  style="overflow:visible;"/>
+       </clipPath>
+       <path class="st0" d="M0,26.7C0,11.95,11.95,0,26.7,0s26.7,11.95,26.7,26.7s-11.95,26.7-26.7,26.7S0,41.44,0,26.7"/>
+       <polyline class="st1" points="23.15,15.52 34.32,26.7 23.15,37.87        "/>
+</g>
+</svg>
diff --git a/images/slider-prev.svg b/images/slider-prev.svg
new file mode 100644 (file)
index 0000000..ae833ee
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+        width="53.39px" height="53.39px" viewBox="0 0 53.39 53.39" style="enable-background:new 0 0 53.39 53.39;" xml:space="preserve"
+       >
+<style type="text/css">
+       .st0{clip-path:url(#SVGID_2_);fill:#0EA0D1;}
+       .st1{clip-path:url(#SVGID_2_);fill:none;stroke:#FFFFFF;stroke-width:2;stroke-miterlimit:10;}
+</style>
+<g>
+       <defs>
+               <rect id="SVGID_1_" y="0" width="53.39" height="53.39"/>
+       </defs>
+       <clipPath id="SVGID_2_">
+               <use xlink:href="#SVGID_1_"  style="overflow:visible;"/>
+       </clipPath>
+       <path class="st0" d="M53.39,26.7c0,14.74-11.95,26.7-26.7,26.7S0,41.44,0,26.7S11.95,0,26.7,0S53.39,11.95,53.39,26.7"/>
+       <polyline class="st1" points="30.25,37.87 19.07,26.7 30.25,15.52        "/>
+</g>
+</svg>
diff --git a/images/twitter.svg b/images/twitter.svg
new file mode 100644 (file)
index 0000000..e85390b
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+        width="112.19px" height="112.2px" viewBox="0 0 112.19 112.2" style="enable-background:new 0 0 112.19 112.2;"
+        xml:space="preserve">
+<style type="text/css">
+       .st0{fill:#FFFFFF;}
+       .st1{fill:#5e5e5e;}
+</style>
+<g>
+       <rect x="20.1" y="22" class="st0" width="72" height="65"/>
+       <path class="st1" d="M56.1,0C25.12,0,0,25.12,0,56.1s25.12,56.1,56.1,56.1c30.98,0,56.1-25.12,56.1-56.1S87.07,0,56.1,0
+                M81.71,43.74c0.02,0.55,0.04,1.11,0.04,1.66c0,17.01-12.95,36.63-36.63,36.63c-7.27,0-14.04-2.13-19.74-5.78
+               c1.01,0.12,2.03,0.18,3.07,0.18c6.03,0,11.59-2.06,15.99-5.51c-5.64-0.11-10.39-3.83-12.03-8.94c0.79,0.15,1.59,0.23,2.42,0.23
+               c1.18,0,2.31-0.16,3.4-0.45c-5.89-1.18-10.33-6.39-10.33-12.62c0-0.06,0-0.11,0-0.16c1.74,0.96,3.72,1.54,5.83,1.61
+               C30.27,48.27,28,44.33,28,39.86c0-2.36,0.64-4.57,1.74-6.47c6.35,7.79,15.84,12.92,26.54,13.45c-0.22-0.94-0.34-1.93-0.34-2.94
+               c0-7.11,5.77-12.87,12.88-12.87c3.7,0,7.05,1.56,9.4,4.07c2.93-0.58,5.69-1.65,8.18-3.12c-0.96,3-3,5.53-5.66,7.12
+               c2.61-0.31,5.09-1,7.39-2.03C86.41,39.65,84.23,41.92,81.71,43.74"/>
+</g>
+<polygon class="st0" points="462.1,-136 464.1,-136 464.1,-136 462.1,-136 "/>
+</svg>
index 44a1dab504d1ce1754da84aa27ff87d3aa67315e..c463136351272b56abcb58d3b848614f954e5dc9 100644 (file)
--- a/index.php
+++ b/index.php
@@ -7,8 +7,10 @@ ini_set('error_log', dirname(__FILE__) . '/log/php_error.log');
 if ($_SERVER['HTTP_HOST'] == 'www.ccgm.fr') {
        define('APPLICATION_ENV', 'production');
 } else if ($_SERVER['HTTP_HOST'] == 'medecins.ccgm.fr') {
-       define('APPLICATION_ENV', 'medecins');
-} else if ($_SERVER['HTTP_HOST'] == 'ccgm.test') {
+    define('APPLICATION_ENV', 'medecins');
+} else if ($_SERVER['HTTP_HOST'] == 'dev.ccgm.fr') {
+    define('APPLICATION_ENV', 'dev');
+} else if (strtolower($_SERVER['HTTP_HOST']) == 'ccgm.test') {
     define('APPLICATION_ENV', 'dev-local');
 }
 
index 632ad57281606bb1e6f918cee29bda8da6ded17f..a1af4b8081ebbd6a1881f1f108337c61977c9976 100644 (file)
@@ -10,6 +10,57 @@ function load_news_article() {
   });
 
   // Slider for lightbox
-  $slider.slickLightbox();
+  // Based on https://codepen.io/dileepmadusanka/pen/oLdkyq
+  // Extra code adapted from https://codepen.io/digistate/pen/MvapbE
+  $slider.slickLightbox({
+    // Since base slider is in infinite mode, we have to avoid collecting the cloned slides
+    itemSelector: '.slick-slide:not(.slick-cloned) a',
+  });
+
+  var lightbox = '.slick-lightbox';
+
+  $(document).on('init', lightbox, function(event, slick) {
+    slick = $(slick.$slider);
+    setTimeout(function(){ toggleVideo(slick, 'play'); }, 500);
+    setTimeout(function(){ toggleVideo(slick, 'play'); }, 1500);
+  });
+  $(document).on('beforeChange', lightbox, function(event, slick) {
+    slick = $(slick.$slider);
+    toggleVideo(slick, 'pause');
+  });
+  $(document).on('afterChange', lightbox, function(event, slick) {
+    slick = $(slick.$slider);
+    toggleVideo(slick, 'play');
+  });
+
+  function toggleVideo(slick, action) {
+    var currentSlide, player;
+
+    currentSlide = slick.find('.slick-current');
+    player = currentSlide.find('iframe').get(0);
+
+    switch (action) {
+      case 'play':
+        postMessageToPlayer(player, {
+          "event": "command",
+          "func": "playVideo"
+        });
+      break;
+      case 'pause':
+        postMessageToPlayer(player, {
+          "event": "command",
+          "func": "pauseVideo"
+        });
+      break;
+    }
+
+  }
+
+  // Send commands to YouTube iframe player
+  function postMessageToPlayer(player, command){
+    if (player == null || command == null) return;
+    player.contentWindow.postMessage(JSON.stringify(command), "*");
+  }
+
 
 }
index b49974a32b2c96f7b0ae172bac7f195a6c24849d..e4a0cfe856086ff66fcbf95f98698a54741cdc09 100644 (file)
@@ -62,8 +62,6 @@ Documentation generated by [CoffeeDoc](http://github.com/omarkhan/coffeedoc)
         })(this);
         a = this.element.find(this.options.itemSelector);
 
-        console.log("AAAA", a);
-
         if (index === 0 || index === -1) {
           links = $.map(a, createItem);
         } else {
index 169679da26d8386d454102e136ede1f53d2cf889..e36b910536d24a084a956396e6e0ce4fefb35f01 100644 (file)
     max-width: 100%;
   }
 
+  &-video {
+    position: relative;
+
+    &:before {
+      content: '';
+      position: absolute;
+      top: 0;
+      right: 0;
+      bottom: 0;
+      left: 0;
+      background: rgba(0, 0, 0, 0.3) url('/images/play.svg') center no-repeat;
+      background-size: 13%;
+      transition: background-size 0.2s ease-out;
+    }
+
+    &:hover:before {
+      background-size: 14.5%;
+    }
+  }
+
   .slick-track {
     display: flex;
     align-items: center;
index 7f22634c651c53d96c08a010a94f598055d0c554..16cbc6d11ab6bc9c896ff91145605949a5758c6b 100644 (file)
   background-color: transparent;
 }
 
-.slick-lightbox .slick-prev {
-  left: 15px;
+// Slider arrows
+.slick-prev, .slick-next {
+  width: 55px;
+  height: 55px;
+  background-size: contain;
+  z-index: 99;
+
+  &:before {
+    display: none;
+  }
+
+  &.slick-disabled {
+    opacity: .25;
+  }
 }
 
-.slick-lightbox .slick-next {
+.slick-prev {
+  left: 15px;
+  background: url('/images/slider-prev.svg') center no-repeat !important;
+}
+.slick-next {
   right: 15px;
+  background: url('/images/slider-next.svg') center no-repeat !important;
 }