From: vincent@cubedesigners.com Date: Wed, 19 Nov 2014 09:46:20 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=1c774cba065a4b097a749aaefb31b303ded40475;p=cubedesigners-v7.git --- diff --git a/framework/application/views/helpers/CasestudiesTagsList.php b/framework/application/views/helpers/CasestudiesTagsList.php index 64ff070..c557ca4 100644 --- a/framework/application/views/helpers/CasestudiesTagsList.php +++ b/framework/application/views/helpers/CasestudiesTagsList.php @@ -34,10 +34,7 @@ class Cubedesigners_View_Helper_CasestudiesTagsList extends CubeIT_View_Helper_A } } - $res.=$this->view->tags($tags); - - - + $res.=$this->view->tags($tags, array('data-perline' => 3)); return $res; } diff --git a/framework/application/views/helpers/CategoriesList.php b/framework/application/views/helpers/CategoriesList.php index 664ec92..01d35a8 100644 --- a/framework/application/views/helpers/CategoriesList.php +++ b/framework/application/views/helpers/CategoriesList.php @@ -2,7 +2,7 @@ class Cubedesigners_View_Helper_CategoriesList extends Zend_View_Helper_Abstract { - public function CategoriesList($rubrique) { + public function CategoriesList($rubrique, $listId) { $acl = Bootstrap::getInstance()->isAllowed("edition"); @@ -36,7 +36,7 @@ class Cubedesigners_View_Helper_CategoriesList extends Zend_View_Helper_Abstract $tags[$r->id] = $r->name; } } - $res.=$this->view->tags($tags); + $res.=$this->view->tags($tags, array('data-perline' => 3, 'data-list' => '#' . $listId)); return $res; diff --git a/framework/application/views/helpers/RealisationsList.php b/framework/application/views/helpers/RealisationsList.php index 66a6321..688692c 100644 --- a/framework/application/views/helpers/RealisationsList.php +++ b/framework/application/views/helpers/RealisationsList.php @@ -51,5 +51,3 @@ class Cubedesigners_View_Helper_RealisationsList extends CubeIT_View_Helper_Abst } } - -?> diff --git a/framework/application/views/helpers/TagList.php b/framework/application/views/helpers/TagList.php deleted file mode 100644 index ecd9886..0000000 --- a/framework/application/views/helpers/TagList.php +++ /dev/null @@ -1,11 +0,0 @@ -view->headLink()->appendStylesheet('/less/taglist.less'); + $this->addScriptAndStyle('taglist'); if (isset($attrs['class'])) { $attrs['class'].=" tags"; } else { @@ -14,10 +15,10 @@ class Cubedesigners_View_Helper_Tags extends CubeIT_View_Helper_ListUnordered { $items[] = array('content' => __('TOUT VOIR'), 'class' => 'active', 'data-id' => 0); foreach ($tags as $id => $name) { - - $items[] = array('content' => $name, 'data-id' => $id); } + fb($items); + fb($attrs); return $this->listUnordered($items, $attrs); } diff --git a/framework/application/views/scripts/templates/casestudies.phtml b/framework/application/views/scripts/templates/casestudies.phtml index 95b8739..d49ede2 100644 --- a/framework/application/views/scripts/templates/casestudies.phtml +++ b/framework/application/views/scripts/templates/casestudies.phtml @@ -7,7 +7,7 @@ $this->headScript()->addScriptAndStyle('casestudies');
CategoriesList('casestudies'); + echo $this->CategoriesList('casestudies', 'casestudies-list'); ?>
diff --git a/js/taglist.js b/js/taglist.js new file mode 100644 index 0000000..9d24339 --- /dev/null +++ b/js/taglist.js @@ -0,0 +1,57 @@ +(function ($) { + function JQtaglist(element) { + this.element = element; + this.perline = parseInt(this.element.data('perline')); + this.list = $(this.element.data('list')); + this.init(); + } + + JQtaglist.prototype = { + init: function () { + var $this = this; + this.element.on('click', "li[data-id]", function () { + fb(this); + if ($(this).hasClass('active')) { + return false; + } + + var id = $(this).data('id'); + + $this.filter(id); + + $(this).siblings().removeClass('active'); + $(this).addClass('active'); + return false; + }); + $this.filter(0); + }, + filter: function (id) { + var $this = this; + this.list.find('[data-cat]:hidden').show().removeClass('last'); + if (id != 0) { + this.list.find('[data-cat][data-cat!="' + id + '"]').hide(); + } + var i = 1; + this.list.find('[data-cat]:visible').each(function () { + if (i % $this.perline == 0) { + $(this).addClass('last'); + } + i++; + }); + } + }; + + jQuery.fn.taglist = function () { + return this.each(function () { + var $this = $(this); + $(this).data('taglist', new JQtaglist($this)); + }); + }; +})(jQuery); + + +registerLoader(load_taglist); + +function load_taglist() { + $('ul.tags').taglist(); +} \ No newline at end of file diff --git a/js/taglist_.js b/js/taglist_.js new file mode 100644 index 0000000..f406ac1 --- /dev/null +++ b/js/taglist_.js @@ -0,0 +1,22 @@ +registerLoader(load_taglist, true); + +function load_taglist() { + var t = $('ul.tags'); + var perline = $(t).data('perline'); + $(document).on('click', "ul.tags li[data-id]", function () { + if ($(this).hasClass('active')) { + return false; + } + + var id = $(this).data('id'); + + $('[data-cat]:hidden').show().removeClass('last'); + if (id != 0) { + $('[data-cat][data-cat!="' + id + '"]').hide(); + } + $('[data-cat]:visible:nth-child(3n)').addClass('last'); + + $(this).siblings().removeClass('active'); + $(this).addClass('active'); + }); +} \ No newline at end of file diff --git a/less/casestudies.less b/less/casestudies.less index 89b654d..1e0287a 100644 --- a/less/casestudies.less +++ b/less/casestudies.less @@ -33,7 +33,7 @@ color:#545454; margin-bottom: 20px; } - &:nth-child(3n){ + &.last{ margin-right: 0; } }