From: Vincent Vanwaelscappel Date: Fri, 4 Sep 2020 14:15:40 +0000 (+0200) Subject: wip #3871 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=d30e70c6fb218b22f52be7e565598f8d43102bc6;p=fluidbook-html5.git wip #3871 @0.5 --- diff --git a/images/interface.svg b/images/interface.svg index 456143ff..b97cd6ab 100644 --- a/images/interface.svg +++ b/images/interface.svg @@ -145,4 +145,11 @@ 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"/> + + + diff --git a/js/libs/fluidbook/cart/fluidbook.cart.mopec.js b/js/libs/fluidbook/cart/fluidbook.cart.mopec.js index 44782f34..587e83cb 100644 --- a/js/libs/fluidbook/cart/fluidbook.cart.mopec.js +++ b/js/libs/fluidbook/cart/fluidbook.cart.mopec.js @@ -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 '
' + this.fluidbook.l10n.__('your cart is empty') + '
'; @@ -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) { diff --git a/js/libs/fluidbook/fluidbook.nav.js b/js/libs/fluidbook/fluidbook.nav.js index 37b659be..0d73fc85 100644 --- a/js/libs/fluidbook/fluidbook.nav.js +++ b/js/libs/fluidbook/fluidbook.nav.js @@ -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); diff --git a/style/fluidbook.less b/style/fluidbook.less index a60efa30..5e80e0a5 100644 --- a/style/fluidbook.less +++ b/style/fluidbook.less @@ -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;