From: vincent@cubedesigners.com Date: Fri, 1 Dec 2017 18:10:46 +0000 (+0000) Subject: done #1784 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=bf26221a0c192a886aefb7aa6e5e24fe42dc28b4;p=ccgm.git done #1784 @0.5 --- diff --git a/framework/application/views/helpers/Actualites.php b/framework/application/views/helpers/Actualites.php index 067972c..5a5ecf5 100644 --- a/framework/application/views/helpers/Actualites.php +++ b/framework/application/views/helpers/Actualites.php @@ -1,12 +1,9 @@ _filter($actus); - if (!count($actus)) { - return; - } + $actus = CCGM_Model_News::factory()->order('date DESC')->find(); $this->view->headScript()->addScriptAndStyle('actualites') ->addGSAP(); @@ -30,41 +27,18 @@ class CCGM_View_Helper_Actualites extends Zend_View_Helper_Abstract { } protected function _actu($a) { - $nline = min(substr_count($a['news'], "\n") + 1, 2); + $nline = 1; $attrs = array('data-lines' => $nline); $res = '
'; $p = ''; - if (!$a['noshowdate']) { - $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']); + $p .= $this->view->dateTime($a->getDate(), Zend_Date::DAY . '/' . Zend_Date::MONTH . '/' . Zend_Date::YEAR, array('class' => 'date')) . ' '; + $p .= $a->getTitle(); $res .= $this->view->htmlElement($p, 'p', $attrs); $res .= '
'; return $res; } - protected function _filter($actus) { - $res = array(); - foreach ($actus as $a) { - if (trim($a['news']) == '') { - continue; - } - $res[] = $a; - } - - usort($res, array($this, '_sort')); - return $res; - } - - protected function _sort($a, $b) { - $da = new Zend_Date($a['date'], CubeIT_Date::MYSQL); - $db = new Zend_Date($b['date'], CubeIT_Date::MYSQL); - - return -1 * $da->compare($db); - } } diff --git a/js/actualites.js b/js/actualites.js index 61e606f..5ff0b42 100644 --- a/js/actualites.js +++ b/js/actualites.js @@ -11,10 +11,6 @@ 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(); @@ -39,6 +35,14 @@ if (this.animating) { return; } + + if(this.number==1){ + this.getActu(index).show(); + this.arrowsVisibility(index, 0.5); + this.endTransition(0); + return; + } + var $this = this; this.animating = true; var w = 870; @@ -59,7 +63,6 @@ } var currentActu = this.getActu(this.currentIndex); - $(nextActu).css('left', w * -dir).show(); TweenMax.to(nextActu, d, {left: 0}); TweenMax.to(currentActu, d, { @@ -68,8 +71,6 @@ } }); this.arrowsVisibility(index, d); - - }, arrowsVisibility: function (index, d) { var prev = this.element.find('.btn-prev'); @@ -91,7 +92,9 @@ }, endTransition: function (index) { this.animating = false; - this.getActu(this.currentIndex).hide(); + if(this.number>1) { + this.getActu(this.currentIndex).hide(); + } this.currentIndex = index; }, };