]> _ Git - cubedesigners-v7.git/commitdiff
- Add "Fermer" link to portfolio items
authorstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 23 Dec 2014 14:49:50 +0000 (14:49 +0000)
committerstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 23 Dec 2014 14:49:50 +0000 (14:49 +0000)
- Make portfolio list remember last filter so state is preserved when going back from viewing a portfolio item
- Remove 'Voir le site' on portfolio items that have no URL set
- Ensure image(s) are positioned correctly in portfolio scroller when there are not many images

framework/application/views/helpers/Realisation.php
images/close-portfolio.png [new file with mode: 0644]
js/realisations.js
js/taglist.js
less/realisation.less

index e5fc38eb052555fdbbe54c20fb2933209d3b1043..12eaeaa60f8250cc8085c30bdfe2e5fc3fc2328a 100644 (file)
@@ -12,6 +12,7 @@ class Cubedesigners_View_Helper_Realisation extends CubeIT_View_Helper_Abstract
                $res .= '<div class="content">';
                $res .= '<h1>' . $r->titre . '</h1>';
                $res .= '<h2>' . Cubedesigners_Util::getCategoryById($r->categories) . '</h2>';
+               $res .= $this->view->link(__('Fermer'), $this->currentPage->getParent()->getHref(), array('class' => 'close'));
                $res.='</div>';
 
                $slides = array();
@@ -25,7 +26,11 @@ class Cubedesigners_View_Helper_Realisation extends CubeIT_View_Helper_Abstract
 
                $res.=$this->imageSlideshowScroll($slides, 439, array(), array('shortcuts' => false));
                $res.='<div class="content">';
-               $res.=$this->_button($r->url);
+
+               if (!empty($r->url->url)) {
+                       $res.=$this->_button($r->url);
+               }
+
                $res.=$this->markupDotclear($r->description);
                $res.='</div>';
                $res.='</article>';
diff --git a/images/close-portfolio.png b/images/close-portfolio.png
new file mode 100644 (file)
index 0000000..d8b66dd
Binary files /dev/null and b/images/close-portfolio.png differ
index fd14ecb310cf994289547624249fba852031d56a..b459321614f346a95794392efe2ea3733cf28852 100644 (file)
@@ -134,13 +134,13 @@ function load_realisations() {
                                                $('.close').css("top", $('#detailContent').offset().top);
                                                /*
                                                 $( "#detail" ).slideDown( "slow", function() {
-
+                                                
                                                 isAnim = false;
                                                 addCloseAction();
                                                 currentSlide = 1;
                                                 autoSlide = true;
                                                 initSlideShow();
-
+                                                
                                                 }).animate(
                                                 { opacity: 1 },
                                                 { queue: true, duration: 'slow' }
index 0d729c8a1d0fb9136aff1c23f32aeba6b95a8d6f..65bd71c59326f473c4302aef122520e8b34ee5d2 100644 (file)
@@ -1,27 +1,35 @@
 (function ($) {
        function JQtaglist(element) {
+
+               // Store name of the list
+               this.storageID = $(element).parent().attr('id') + '-filter';
+
                this.element = element;
                this.perline = parseInt(this.element.data('perline'));
                this.list = $(this.element.data('list'));
-               this.init();
+
+               var initFilter = 0;
+               if (Modernizr.sessionstorage) {
+                       var f = sessionStorage.getItem(this.storageID);
+                       if (f !== null) {
+                               initFilter = f;
+                       }
+               }
+
+               this.init(initFilter);
        }
 
        JQtaglist.prototype = {
-               init: function () {
+               init: function (initFilter) {
                        var $this = this;
                        this.element.on('click', "li[data-id]", function () {
-                               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);
+                       $this.filter(initFilter);
                },
                filter: function (id) {
                        var $this = this;
                                this.list.find('[data-cat][data-cat!="' + id + '"]').hide();
                        }
 
+                       this.element.find('[data-id]').removeClass('active');
+                       this.element.find('[data-id="' + id + '"]').addClass('active');
+
                        this.updateMargins();
                        setTimeout(function () {
                                $this.updateMargins();
                        }, 500);
+
+                       if (Modernizr.sessionstorage) {
+                               sessionStorage.setItem(this.storageID, id);
+                       }
                },
                updateMargins: function () {
                        var i = 1;
index 51ac7d7d5d180e55ce7c9fddbe602dde3a3d0884..dfd833307051c8c273cde5b1016a36205c7bb058 100644 (file)
                clear: both;
                margin:30px 0 30px 0;
        }
+
+       .content {
+               position: relative;
+
+               .close {
+                       display: inline-block;
+                       position: absolute;
+                       right: 0;
+                       top: 50%;
+                       margin-top: -13px; // Half of line-height to position vertically in the centre
+                       background-image: url(../images/close-portfolio.png);
+                       background-repeat: no-repeat;
+                       background-position: right center;
+                       padding-right: 33px;
+                       color: #545454;
+                       font-size: 14px;
+                       line-height: 26px;
+
+                       &:hover {
+                               color: #000;
+                       }
+               }
+       }
 }
\ No newline at end of file