]> _ Git - fluidbook-html5.git/commitdiff
wip #3871 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 4 Sep 2020 14:15:40 +0000 (16:15 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 4 Sep 2020 14:15:40 +0000 (16:15 +0200)
images/interface.svg
js/libs/fluidbook/cart/fluidbook.cart.mopec.js
js/libs/fluidbook/fluidbook.nav.js
style/fluidbook.less

index 456143ff3c4815007f2fba7c1bb242360e47fca6..b97cd6abb0efe98ca9ab30af87590c588647b16e 100644 (file)
                C22.7,21.8,22,22.6,21.1,22.6z M3.9,3.9c-0.1,0-0.2,0.1-0.2,0.2v16.9c0,0.1,0.1,0.2,0.2,0.2h17.2c0.1,0,0.2-0.1,0.2-0.2V4.1
                c0-0.1-0.1-0.2-0.2-0.2H3.9z"/>
     </symbol>
+    <symbol id="nav-cart-caddie" viewBox="0 0 25 25">
+        <path d="M19.9,15.2l2.6-6.9c0.1-0.2,0.1-0.5-0.1-0.7c-0.1-0.2-0.4-0.3-0.6-0.3H7.1L6.7,5.5C6.6,5.2,6.3,4.9,6,4.9H2.7
+               c-0.4,0-0.8,0.3-0.8,0.8s0.3,0.8,0.8,0.8h2.7l2.8,11.7c-0.6,0.4-1,1.1-1,1.9c0,1.2,1,2.2,2.2,2.2s2.2-1,2.2-2.2
+               c0-0.3-0.1-0.5-0.1-0.7h4c-0.1,0.2-0.1,0.5-0.1,0.7c0,1.2,1,2.2,2.2,2.2s2.2-1,2.2-2.2s-1-2.2-2.2-2.2h-8l-0.5-2.1h10
+               C19.5,15.6,19.8,15.5,19.9,15.2z M10.2,20c0,0.4-0.3,0.7-0.7,0.7S8.8,20.4,8.8,20s0.3-0.7,0.7-0.7S10.2,19.6,10.2,20z M17.7,20.7
+               c-0.4,0-0.7-0.3-0.7-0.7s0.3-0.7,0.7-0.7s0.7,0.3,0.7,0.7S18.1,20.7,17.7,20.7z M8.8,14.1L7.5,8.8h13.2l-2,5.4H8.8V14.1z"/>
+    </symbol>
 </svg>
index 44782f34b08f22961b22ae280fd7d69f70c0a9a3..587e83cb24c3f55af035e48db2c9ecb42ecdea8f 100644 (file)
@@ -6,6 +6,7 @@ function FluidbookCartMopec(cart) {
     this.data;
     this.handleTooltips = true;
     this.handleTaxes = false;
+
     this.initBaseURL();
     this.init();
 }
@@ -32,7 +33,9 @@ FluidbookCartMopec.prototype = {
 
     updateCartFromData: function (data, callback) {
         this.data = data;
-        this.updateCart();
+        if (this.dataok()) {
+            this.updateCart();
+        }
         if (callback !== undefined) {
             callback();
         }
@@ -130,6 +133,9 @@ FluidbookCartMopec.prototype = {
         })
     },
     getItemsNumbers: function () {
+        if (!this.dataok()) {
+            return 0;
+        }
         return this.data.summary_count;
     },
     getAllQuantities: function () {
@@ -145,12 +151,19 @@ FluidbookCartMopec.prototype = {
     },
 
     openMenu: function (p1, p2, callback) {
+        if (!this.dataok()) {
+            callback();
+            return;
+        }
         this.fluidbook.menu.quickCloseView();
         return this.openCart(p2, callback);
     },
 
     openCart: function (p2, callback) {
-        var $this = this;
+        if (!this.dataok()) {
+            callback();
+            return;
+        }
         this._endMenu(this.fluidbook.l10n.__('your cart'), this.getCartContent(), function () {
             $('input[type="number"]').inputNumber();
 
@@ -158,6 +171,10 @@ FluidbookCartMopec.prototype = {
         });
     },
 
+    dataok: function () {
+        return this.data !== undefined && this.data !== null;
+    },
+
     getCartContent: function () {
         if (this.getItemsNumbers() == 0) {
             return '<div class="cart-empty">' + this.fluidbook.l10n.__('your cart is empty') + '</div>';
@@ -225,13 +242,14 @@ FluidbookCartMopec.prototype = {
     },
 
     updateCart: function () {
-
-        var $this = this;
-
+        if (!this.dataok()) {
+            return;
+        }
         $('[data-menu="cart"] .content').html(this.getCartContent());
         $('input[type="number"]').inputNumber();
         this.updateIcon();
         resize();
+
     },
 
     formatPrice: function (price, suffix) {
index 37b659be8de4613bc5261ee49c146b8af443d08f..0d73fc85ccd663fd371e68cba3e1bb008e114065 100644 (file)
@@ -451,7 +451,7 @@ FluidbookNav.prototype = {
             } else if (icon === 'print' && this.fluidbook.settings.print) {
                 link = this.addLink(navType, 'nav-print', '#', 'print', 'print', 'print', 'Control+P');
             } else if (icon === 'basket' && this.fluidbook.cart !== undefined && this.fluidbook.cart.enabled) {
-                link = this.addLink(navType, 'nav-basket', '#/cart', 'cart', 'basket', 'basket', 'Control+Alt+C');
+                link = this.addLink(navType, this.fluidbook.settings.cartIcon, '#/cart', 'cart', 'basket', 'basket', 'Control+Alt+C');
                 $(this.fluidbook).on('fluidbook.cart.updateIcon', {link: $(link).attr('id')}, function (e, data) {
                     var n = data.number;
                     var l = $("#" + e.data.link);
index a60efa304a1202d09a0f1f2fb8ab77db829a8495..5e80e0a5456abb20bf01fa0a2667fd05546ac9e5 100644 (file)
@@ -926,12 +926,16 @@ a.bookmark {
 
   span.number {
     position: absolute;
-    top: 0.7em;
-    left: 0;
-    color: @icon-color;
+    display: block;
+    top: 0.5em;
+    right: -0.5em;
+    background-color: @icon-color;
     text-align: center;
-    width: 100%;
+    width: 1.5em;
+    height: 1.5em;
     font-size: 0.7em;
+    border-radius: 50%;
+    color: #fff;
   }
 
   &#menu_cart {
@@ -1274,6 +1278,7 @@ html.ios body.portrait #interface {
 
   &.textLink {
     white-space: nowrap;
+
     &[data-animations] {
       transform-origin: 0 100%;
       opacity: 0;