From b33b3fa1e7965f6201979a8b31024b2d457ad9d8 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 27 May 2020 11:16:36 +0700 Subject: [PATCH] Clean code --- Helper/Data.php | 1 + Helper/PrintProcess.php | 2 +- composer.json | 2 +- view/frontend/layout/default.xml | 102 +++++++-------- view/frontend/web/js/view/minicart.js | 154 +++++++++++------------ view/frontend/web/template/minicart.html | 58 ++++----- 6 files changed, 160 insertions(+), 159 deletions(-) diff --git a/Helper/Data.php b/Helper/Data.php index 5b9feed..0002a76 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -35,6 +35,7 @@ class Data extends AbstractData { const CONFIG_MODULE_PATH = 'sharecart'; const BUSINESS_CONFIG_PATH = 'business_information'; + /** * @var PriceCurrencyInterface */ diff --git a/Helper/PrintProcess.php b/Helper/PrintProcess.php index 443ca23..9529d36 100644 --- a/Helper/PrintProcess.php +++ b/Helper/PrintProcess.php @@ -27,6 +27,7 @@ use Magento\Framework\Exception\FileSystemException; use Magento\Framework\Filesystem; use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Pricing\PriceCurrencyInterface; use Magento\Framework\Stdlib\DateTime\DateTime; use Magento\Framework\Stdlib\DateTime\TimeZone; use Magento\Quote\Model\Quote; @@ -34,7 +35,6 @@ use Mageplaza\ShareCart\Model\Template\Processor; use Mpdf\Mpdf; use Mpdf\MpdfException; -use Magento\Framework\Pricing\PriceCurrencyInterface; /** * Class PrintProcess diff --git a/composer.json b/composer.json index 4f9b926..87907f6 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "mageplaza/module-core": "^1.4.5", "mpdf/mpdf": "^7.1.0" }, - "version": "1.1.0", + "version": "1.1.1", "license": "proprietary", "authors": [ { diff --git a/view/frontend/layout/default.xml b/view/frontend/layout/default.xml index 12a3cfd..157cc19 100644 --- a/view/frontend/layout/default.xml +++ b/view/frontend/layout/default.xml @@ -1,51 +1,51 @@ - - - - - - - - - - - - - - - - - Mageplaza_ShareCart/js/view/minicart - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + Mageplaza_ShareCart/js/view/minicart + + + + + + + + + + + + + + diff --git a/view/frontend/web/js/view/minicart.js b/view/frontend/web/js/view/minicart.js index 3b16403..36dedce 100644 --- a/view/frontend/web/js/view/minicart.js +++ b/view/frontend/web/js/view/minicart.js @@ -1,77 +1,77 @@ -/** - * Mageplaza - * - * NOTICE OF LICENSE - * - * This source file is subject to the Mageplaza.com license that is - * available through the world-wide-web at this URL: - * https://www.mageplaza.com/LICENSE.txt - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade this extension to newer - * version in the future. - * - * @category Mageplaza - * @package Mageplaza_ShareCart - * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) - * @license https://www.mageplaza.com/LICENSE.txt - */ -define([ - 'jquery', - 'uiComponent', - 'Magento_Customer/js/customer-data', - 'mage/translate' -], function ($, Component, customerData, $t) { - 'use strict'; - - var isReload = true; - - return Component.extend({ - defaults: { - template: 'Mageplaza_ShareCart/minicart' - }, - - initialize: function () { - this._super(); - - if (isReload) { - customerData.reload(['cart'], false); - isReload = false; - } - this.customer = customerData.get('cart'); - }, - - moveShareCart: function(){ - $(document).ready(function () { - $('.secondary.sharecart').appendTo($('.action.viewcart').parent()); - }); - }, - - getQuoteId: function () { - return customerData.get('cart')().quote_url; - }, - - copyQuote: function (object, e) { - var quoteUrl = document.createElement('textarea'); - - quoteUrl.value = customerData.get('cart')().quote_url; - document.body.appendChild(quoteUrl); - quoteUrl.select(); - document.execCommand('copy'); - document.body.removeChild(quoteUrl); - - e.currentTarget.setAttribute('class', 'mp-tooltipped'); - e.currentTarget.setAttribute('aria-label', $t('Copied!')); - }, - - leaveQuote: function (object, e) { - e.currentTarget.removeAttribute('class'); - e.currentTarget.removeAttribute('aria-label'); - }, - - isDisplay: function () { - return customerData.get('cart')().summary_count; - } - }); -}); +/** + * Mageplaza + * + * NOTICE OF LICENSE + * + * This source file is subject to the Mageplaza.com license that is + * available through the world-wide-web at this URL: + * https://www.mageplaza.com/LICENSE.txt + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category Mageplaza + * @package Mageplaza_ShareCart + * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) + * @license https://www.mageplaza.com/LICENSE.txt + */ +define([ + 'jquery', + 'uiComponent', + 'Magento_Customer/js/customer-data', + 'mage/translate' +], function ($, Component, customerData, $t) { + 'use strict'; + + var isReload = true; + + return Component.extend({ + defaults: { + template: 'Mageplaza_ShareCart/minicart' + }, + + initialize: function () { + this._super(); + + if (isReload) { + customerData.reload(['cart'], false); + isReload = false; + } + this.customer = customerData.get('cart'); + }, + + moveShareCart: function(){ + $(document).ready(function () { + $('.secondary.sharecart').appendTo($('.action.viewcart').parent()); + }); + }, + + getQuoteId: function () { + return customerData.get('cart')().quote_url; + }, + + copyQuote: function (object, e) { + var quoteUrl = document.createElement('textarea'); + + quoteUrl.value = customerData.get('cart')().quote_url; + document.body.appendChild(quoteUrl); + quoteUrl.select(); + document.execCommand('copy'); + document.body.removeChild(quoteUrl); + + e.currentTarget.setAttribute('class', 'mp-tooltipped'); + e.currentTarget.setAttribute('aria-label', $t('Copied!')); + }, + + leaveQuote: function (object, e) { + e.currentTarget.removeAttribute('class'); + e.currentTarget.removeAttribute('aria-label'); + }, + + isDisplay: function () { + return customerData.get('cart')().summary_count; + } + }); +}); diff --git a/view/frontend/web/template/minicart.html b/view/frontend/web/template/minicart.html index 3312bde..c7d69e3 100644 --- a/view/frontend/web/template/minicart.html +++ b/view/frontend/web/template/minicart.html @@ -1,29 +1,29 @@ - - -
- - - -
- + + +
+ + + +
+