From: vincent@cubedesigners.com Date: Tue, 13 Aug 2013 13:19:50 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=dedb0b6e4e1668a4523478f88fa7682ebf3b49ba;p=ccgm.git --- diff --git a/css/actualites.css b/css/actualites.css new file mode 100644 index 0000000..62795ab --- /dev/null +++ b/css/actualites.css @@ -0,0 +1,60 @@ +.updates { + background:#f4f1f1; + position: relative; + font-weight:400; + font-style:italic; + font-size:14px; + line-height:31px; +} +.updates .holder{ + margin:0 auto; + width:981px; + position:relative; + padding: 19px 0 16px; + background-image:url(../images/news.svg); + background-position: 0 50%; +} +.updates .mask { + position: relative; + overflow: hidden; + width: 910px; +} +.updates .slideset { + position: relative; + overflow: hidden; + width: 870px; + height: 30px; + left:39px; +} +.updates .slide { + width: 870px; + display:none; + position:absolute; + top:0px; +} +.updates .btn-prev, +.updates .btn-next { + width: 30px; + height: 31px; + text-indent: -9999px; + overflow: hidden; + bottom: 68px; + float:left; + background-image: url(../images/arrow-news-left.svg); + background-size: 30px 30px; +} +.updates .btn-next { + margin:0 0 0 5px; + background-image: url(../images/arrow-news-right.svg); +} +.updates .btn-area{ + position:absolute; + right:0; + top:20px; +} +.updates p{white-space: nowrap;overflow: hidden;text-overflow: ellipsis;} +.updates .date{ + font-weight:500; + margin: 0 5px 0 0; + font-style:italic; +} \ No newline at end of file diff --git a/css/home.css b/css/home.css index d93ca67..7968528 100644 --- a/css/home.css +++ b/css/home.css @@ -113,58 +113,3 @@ padding: 0 0 0 17px; } .services .col p{margin:0 0 17px;} -.updates { - background:#f4f1f1; - position: relative; - font-weight:400; - font-style:italic; - font-size:14px; - line-height:31px; -} -.updates .holder{ - margin:0 auto; - width:981px; - position:relative; - padding: 19px 0 16px; - background-image:url(../images/news.svg); - background-position: 0 50%; -} -.updates .mask { - position: relative; - overflow: hidden; - width: 910px; -} -.updates .slideset { - width: 9999px; - float: left; -} -.updates .slide { - width: 910px; - float: left; -} -.updates .btn-prev, -.updates .btn-next { - width: 30px; - height: 31px; - text-indent: -9999px; - overflow: hidden; - bottom: 68px; - float:left; - background-image: url(../images/arrow-news-left.svg); - background-size: 30px 30px; -} -.updates .btn-next { - margin:0 0 0 5px; - background-image: url(../images/arrow-news-right.svg); -} -.updates .btn-area{ - position:absolute; - right:0; - top:20px; -} -.updates p{margin:0 0 0 39px;} -.updates .date{ - font-weight:500; - margin: 0 5px 0 0; - font-style:italic; -} \ No newline at end of file diff --git a/framework/application/forms/CMS/Home.php b/framework/application/forms/CMS/Home.php index 351bb07..3328092 100644 --- a/framework/application/forms/CMS/Home.php +++ b/framework/application/forms/CMS/Home.php @@ -1,9 +1,14 @@ setLegend('Actualités'); + $this->addSubForm($actualites, 'actualites'); } + } -?> diff --git a/framework/application/forms/CMS/Sub/Home/Actualite.php b/framework/application/forms/CMS/Sub/Home/Actualite.php new file mode 100644 index 0000000..88bb7f5 --- /dev/null +++ b/framework/application/forms/CMS/Sub/Home/Actualite.php @@ -0,0 +1,24 @@ +setLabel('Date'); + $date->setPrecision(CubeIT_Date::DAY); + $this->addElement($date); + + $news = new Zend_Form_Element_Textarea('news'); + $news->setLabel('Information'); + $news->setAttrib('rows', 2); + $this->addElement($news); + + $lien = new CubeIT_Form_Element_Link(); + $lien->setLabel('Lien'); + $lien->removeElement('label'); + $this->addSubForm($lien, 'lien'); + } + +} \ No newline at end of file diff --git a/framework/application/forms/CMS/Sub/Home/Actualites.php b/framework/application/forms/CMS/Sub/Home/Actualites.php new file mode 100644 index 0000000..5d80ab1 --- /dev/null +++ b/framework/application/forms/CMS/Sub/Home/Actualites.php @@ -0,0 +1,14 @@ +setBaseSubForm($actualite); + $this->setBaseLegend('Edition de l`actualité « $news »'); + $this->setNewLegend('Nouvelle actualité'); + } + +} \ No newline at end of file diff --git a/framework/application/views/helpers/Actualites.php b/framework/application/views/helpers/Actualites.php new file mode 100644 index 0000000..f842242 --- /dev/null +++ b/framework/application/views/helpers/Actualites.php @@ -0,0 +1,59 @@ +_filter($actus); + if (!count($actus)) { + return; + } + + $this->view->headScript()->addScriptAndStyle('actualites') + ->addGSAP(); + $res = '
'; + $res.='
'; + $res.='
'; + $res.='
'; + foreach ($actus as $a) { + $res.=$this->_actu($a); + } + $res.='
'; + $res.='
'; + $res.='
'; + $res.=''; + $res.=''; + $res.='
'; + $res.='
'; + $res.='
'; + return $res; + } + + protected function _actu($a) { + $res = '

'; + $res.=$this->view->dateTime($a['date'], Zend_Date::DAY . '/' . Zend_Date::MONTH . '/' . Zend_Date::YEAR, array('class' => 'date')) . ' '; + $res.=$a['news']; + $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/framework/application/views/scripts/templates/home.phtml b/framework/application/views/scripts/templates/home.phtml index f8f0f80..0317d15 100644 --- a/framework/application/views/scripts/templates/home.phtml +++ b/framework/application/views/scripts/templates/home.phtml @@ -53,18 +53,7 @@ $this->headScript()->addScriptAndStyle('home'); -
-
-
-
-

Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe autem quibusdam et aut officiis debitis

-

Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe autem quibusdam et aut officiis debitis

-

Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe autem quibusdam et aut officiis debitis

-
-
-
- Previous - Next -
-
-
\ No newline at end of file +actualites($this->actualites); +?> \ No newline at end of file diff --git a/js/actualites.js b/js/actualites.js new file mode 100644 index 0000000..7ed9c71 --- /dev/null +++ b/js/actualites.js @@ -0,0 +1,92 @@ +(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 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.endTransition(index); + return; + } + var currentActu = this.getActu(this.currentIndex); + var w = 870; + + $(nextActu).css('left', w * -dir).show(); + TweenMax.to(nextActu, 0.5, {left: 0}); + TweenMax.to(currentActu, 0.5, {left: w * dir, onComplete: function() { + $this.endTransition(index); + } + }); + }, + getActu: function(index) { + return this.element.find('.slide:eq(' + index + ')'); + }, + endTransition: function(index) { + this.animating = false; + this.getActu(this.currentIndex).hide(); + this.currentIndex = index; + if (this.currentIndex == 0) { + TweenMax.to(this.element.find('.btn-prev'), 0.5, {opacity: 0}); + } else { + + } + }, + }; + + 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(); +}