From: vincent@cubedesigners.com Date: Fri, 1 Dec 2017 17:33:39 +0000 (+0000) Subject: wip #1784 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=a6bd69c211748b85f73a5d99229f9feca2066ca0;p=ccgm.git wip #1784 @0.5 --- diff --git a/framework/application/views/helpers/Actualites.php b/framework/application/views/helpers/Actualites.php index 0248d75..067972c 100644 --- a/framework/application/views/helpers/Actualites.php +++ b/framework/application/views/helpers/Actualites.php @@ -9,22 +9,23 @@ class CCGM_View_Helper_Actualites extends Zend_View_Helper_Abstract { } $this->view->headScript()->addScriptAndStyle('actualites') - ->addGSAP(); + ->addGSAP(); $res = '
'; - $res.='
'; - $res.='
'; - $res.='
'; + $res .= '
'; + $res .= '
'; + $res .= '
'; foreach ($actus as $a) { - $res.=$this->_actu($a); + $res .= $this->_actu($a); } - $res.='
'; - $res.='
'; - $res.='
'; - $res.=''; - $res.=''; - $res.='
'; - $res.='
'; - $res.='
'; + $res .= '
'; + $res .= '
'; + $res .= '
'; + $res .= ''; + $res .= ''; + $res .= $this->view->link('Voir les actualités', 'internal:news', ['class' => 'news']); + $res .= '
'; + $res .= '
'; + $res .= ''; return $res; } @@ -36,13 +37,13 @@ class CCGM_View_Helper_Actualites extends Zend_View_Helper_Abstract { $res = '
'; $p = ''; if (!$a['noshowdate']) { - $p.=$this->view->dateTime($a['date'], Zend_Date::DAY . '/' . Zend_Date::MONTH . '/' . Zend_Date::YEAR, array('class' => 'date')) . ' '; + $p .= $this->view->dateTime($a['date'], Zend_Date::DAY . '/' . Zend_Date::MONTH . '/' . Zend_Date::YEAR, array('class' => 'date')) . ' '; } else { $attrs['class'] = 'nodate'; } - $p.=nl2br($a['news']); - $res.=$this->view->htmlElement($p, 'p', $attrs); - $res.='
'; + $p .= nl2br($a['news']); + $res .= $this->view->htmlElement($p, 'p', $attrs); + $res .= ''; return $res; } diff --git a/js/actualites.js b/js/actualites.js index bd9f362..61e606f 100644 --- a/js/actualites.js +++ b/js/actualites.js @@ -1,110 +1,111 @@ -(function($) { - function JQactualites(element) { - this.element = element; - this.currentIndex = -1; - this.number = this.element.find('.slide').length; - this.animating = false; - this.init(); - } - - JQactualites.prototype = { - init: function() { - var $this = this; - - if (this.number < 2) { - this.element.find('.btn-area').hide(); - } - - this.element.find('.btn-area a').click(function() { - if ($(this).hasClass('btn-next')) { - $this.goNext(); - } else if ($(this).hasClass('btn-prev')) { - $this.goPrev(); - } - return false; - }); - - this.gotoIndex(0); - }, - goNext: function() { - this.gotoIndex(this.currentIndex + 1); - }, - goPrev: function() { - this.gotoIndex(this.currentIndex - 1); - }, - gotoIndex: function(index) { - - if (this.animating) { - return; - } - var $this = this; - this.animating = true; - var w = 870; - var d = 0.5; - var dir = -1; - if (index > this.currentIndex) { - dir = 1; - } - dir *= -1; - index = (index + this.number) % this.number; - var nextActu = this.getActu(index); - - if (this.currentIndex == -1) { - $(nextActu).show(); - this.arrowsVisibility(index, d); - this.endTransition(index); - return; - } - var currentActu = this.getActu(this.currentIndex); - - - $(nextActu).css('left', w * -dir).show(); - TweenMax.to(nextActu, d, {left: 0}); - TweenMax.to(currentActu, d, {left: w * dir, onComplete: function() { - $this.endTransition(index); - } - }); - this.arrowsVisibility(index, d); - - - - - }, - arrowsVisibility: function(index, d) { - var prev = this.element.find('.btn-prev'); - var next = this.element.find('.btn-next'); - if (index == 0) { - $(prev).fadeOut(d * 1000); - } else { - $(prev).fadeIn(d * 1000); - } - - if (index == this.number - 1) { - $(next).fadeOut(d * 1000); - } else { - $(next).fadeIn(d * 1000); - } - }, - getActu: function(index) { - return this.element.find('.slide:eq(' + index + ')'); - }, - endTransition: function(index) { - this.animating = false; - this.getActu(this.currentIndex).hide(); - this.currentIndex = index; - }, - }; - - jQuery.fn.actualites = function() { - return this.each(function() { - var $this = $(this); - $(this).data('actualites', new JQactualites($this)); - }) - }; +(function ($) { + function JQactualites(element) { + this.element = element; + this.currentIndex = -1; + this.number = this.element.find('.slide').length; + this.animating = false; + this.init(); + } + + JQactualites.prototype = { + init: function () { + var $this = this; + + if (this.number < 2) { + this.element.find('.btn-area').hide(); + } + + this.element.find('.btn-area a').click(function () { + if ($(this).hasClass('btn-next')) { + $this.goNext(); + } else if ($(this).hasClass('btn-prev')) { + $this.goPrev(); + } else { + return true; + } + return false; + }); + + this.gotoIndex(0); + }, + goNext: function () { + this.gotoIndex(this.currentIndex + 1); + }, + goPrev: function () { + this.gotoIndex(this.currentIndex - 1); + }, + gotoIndex: function (index) { + + if (this.animating) { + return; + } + var $this = this; + this.animating = true; + var w = 870; + var d = 0.5; + var dir = -1; + if (index > this.currentIndex) { + dir = 1; + } + dir *= -1; + index = (index + this.number) % this.number; + var nextActu = this.getActu(index); + + if (this.currentIndex == -1) { + $(nextActu).show(); + this.arrowsVisibility(index, d); + this.endTransition(index); + return; + } + var currentActu = this.getActu(this.currentIndex); + + + $(nextActu).css('left', w * -dir).show(); + TweenMax.to(nextActu, d, {left: 0}); + TweenMax.to(currentActu, d, { + left: w * dir, onComplete: function () { + $this.endTransition(index); + } + }); + this.arrowsVisibility(index, d); + + + }, + arrowsVisibility: function (index, d) { + var prev = this.element.find('.btn-prev'); + var next = this.element.find('.btn-next'); + if (index == 0) { + $(prev).fadeOut(d * 1000); + } else { + $(prev).fadeIn(d * 1000); + } + + if (index == this.number - 1) { + $(next).fadeOut(d * 1000); + } else { + $(next).fadeIn(d * 1000); + } + }, + getActu: function (index) { + return this.element.find('.slide:eq(' + index + ')'); + }, + endTransition: function (index) { + this.animating = false; + this.getActu(this.currentIndex).hide(); + this.currentIndex = index; + }, + }; + + jQuery.fn.actualites = function () { + return this.each(function () { + var $this = $(this); + $(this).data('actualites', new JQactualites($this)); + }) + }; })(jQuery); TO_LOAD_ONCE[TO_LOAD_ONCE.length] = 'load_actualites();'; function load_actualites() { - $(".updates").actualites(); + $(".updates").actualites(); } diff --git a/less/actualites.less b/less/actualites.less index 521e71e..6e8f175 100644 --- a/less/actualites.less +++ b/less/actualites.less @@ -29,12 +29,11 @@ left:39px; .slide { - width: 870px; + width: 720px; display:none; position:absolute; top:0px; - p{ white-space: nowrap; overflow: hidden; @@ -72,7 +71,7 @@ text-indent: -9999px; overflow: hidden; top:0px; - right:35px; + right:185px; position:absolute; background-image: url(../images/arrow-news-left.svg); background-repeat: no-repeat; @@ -81,10 +80,28 @@ .btn-next { margin:0 0 0 5px; - right:0px; + right:150px; background-image: url(../images/arrow-news-right.svg); background-repeat: no-repeat; } + + .news{ + text-align: center; + box-sizing: border-box; + width: 140px; + white-space: nowrap; + background-color: #0ea6db; + font-weight: 300; + font-style: italic; + line-height: 29px; + display: inline-block; + border-radius: 3px; + color: #fff; + padding: 0 13px 1px 10px; + margin: 0 0 0 1px; + position: absolute; + right: 0; + } } }