]> _ Git - fluidbook-html5.git/commitdiff
wait #4008 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 30 Oct 2020 13:47:37 +0000 (14:47 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 30 Oct 2020 13:47:37 +0000 (14:47 +0100)
js/libs/fluidbook/cart/fluidbook.cart.puma.js
js/libs/fluidbook/fluidbook.cart.js
style/cart/puma.less

index 4d4b7b7614560854bc1a58aa312388fd5925bbf5..a565021da6fd47aaf9ee66fe5662bedd8daa44a6 100644 (file)
@@ -39,6 +39,10 @@ FluidbookCartPuma.prototype = {
 
     save: function () {
         this.fluidbook.cache.set('cart', this.items);
+        this.fluidbook.cart.updateLinks();
+    },
+    getItemsReferences: function () {
+        return this.items;
     },
     getItemsNumbers: function () {
         return this.items.length;
index 194f2d5efa61eae6b448d02b485437ccb327f821..4e6fc68ef7977f8faa014fae9618f50321919230 100644 (file)
@@ -26,17 +26,34 @@ FluidbookCart.prototype = {
                 qty = parseInt($(this).attr('data-cart-qty'));
             }
 
-            var tooltipStyle='';
-            try{
-                tooltipStyle= $this.instance.getTooltipStyle();
-            }catch (e){
+            var tooltipStyle = '';
+            try {
+                tooltipStyle = $this.instance.getTooltipStyle();
+            } catch (e) {
 
             }
             if ($this.instance.addToCart($(this).data('cart-ref'), qty)) {
-                $this.fluidbook.tooltip.displayTooltip($this.fluidbook.l10n.__("the item has been added to your cart"),tooltipStyle);
+                $this.fluidbook.tooltip.displayTooltip($this.fluidbook.l10n.__("the item has been added to your cart"), tooltipStyle);
             }
             return false;
         });
+
+        $(this.fluidbook).on('fluidbook.links.ready', function () {
+            $this.updateLinks();
+        });
+    },
+
+    updateLinks: function () {
+        $('a[data-cart-ref]').removeClass('active');
+        try {
+            var references = this.instance.getItemsReferences();
+        } catch (err) {
+            return;
+        }
+
+        $.each(references, function (k, ref) {
+            $('a[data-cart-ref="' + ref + '"]').addClass('active');
+        });
     },
     getMenuWidth: function () {
         try {
index e69273308c45a11c7fc23ae816b37b6286bdfe08..63bf22794f4e12fed004c179253fb481c6381ecc 100644 (file)
@@ -3,10 +3,29 @@
     margin-top: 10px;
     text-transform: uppercase;
   }
+}
 
+[data-type="7"] {
+  .on {
+    visibility: hidden;
+  }
 
+  .off {
+    visibility: visible;
+  }
+
+  &.active {
+    .off {
+      visibility: hidden;
+    }
+
+    .on {
+      visibility: visible;
+    }
+  }
 }
 
+
 #pumacarttable {
   [data-cart-delete] {
     color: #fff;