From 73561ed87efb4577a5cdc1be0486ae8f3724ddfd Mon Sep 17 00:00:00 2001 From: aaronjudd Date: Sun, 27 Nov 2016 13:36:47 -0800 Subject: [PATCH] updated payments styling, missing i18n - single card payment layout - removes default payment method and collapse handling in checkout - commented in dashboard payment settings. TBD. - resolves #1408 --- client/modules/core/helpers/apps.js | 7 +- .../client/templates/layout/admin/admin.js | 86 +++++++------------ .../payments/client/checkout/payment/index.js | 3 +- .../client/checkout/payment/methods.html | 18 ++++ .../checkout/payment/methods/cards.html | 34 -------- .../client/checkout/payment/methods/cards.js | 30 ------- .../payments/client/settings/settings.html | 4 +- .../client/styles/cart/checkout.less | 6 +- .../client/checkout/authnet.html | 4 +- .../client/checkout/braintree.html | 4 +- .../client/checkout/example.html | 4 +- .../payments-paypal/client/paypal.less | 13 ++- .../checkout/express/checkoutButton.html | 34 ++++---- .../checkout/payflow/payflowForm.html | 8 +- .../templates/checkout/payflow/payflowForm.js | 15 ++-- .../included/payments-paypal/register.js | 5 +- .../payments-paypal/server/i18n/en.json | 9 +- .../client/checkout/stripe.html | 4 +- server/publications/collections/packages.js | 2 - 19 files changed, 111 insertions(+), 179 deletions(-) create mode 100644 imports/plugins/core/payments/client/checkout/payment/methods.html delete mode 100644 imports/plugins/core/payments/client/checkout/payment/methods/cards.html delete mode 100644 imports/plugins/core/payments/client/checkout/payment/methods/cards.js diff --git a/client/modules/core/helpers/apps.js b/client/modules/core/helpers/apps.js index e6b6dde943a..1896155e0f4 100644 --- a/client/modules/core/helpers/apps.js +++ b/client/modules/core/helpers/apps.js @@ -72,8 +72,7 @@ export function Apps(optionHash) { filter["registry." + key] = value; registryFilter[key] = value; } else { - // perhaps not the best way to check - // but lets admin see all packages + // perhaps not the best way to check but lets admin see all packages if (!Reaction.hasAdminAccess()) { if (key !== "shopId") { registryFilter[key] = value; @@ -84,6 +83,7 @@ export function Apps(optionHash) { } } } + // fetch the packages Packages.find(filter).forEach((app) => { const matchingRegistry = _.filter(app.registry, registryFilter); @@ -91,8 +91,7 @@ export function Apps(optionHash) { reactionApps.push(registry); } }); - // sort cycle to ensure order aka. is registry.priority working? - // .sort((a, b) => a.priority - b.priority).slice(); + // sort cycle to ensure order aka. is registry.priority working? .sort((a, b) => a.priority - b.priority).slice(); return reactionApps; } diff --git a/imports/plugins/core/layout/client/templates/layout/admin/admin.js b/imports/plugins/core/layout/client/templates/layout/admin/admin.js index dab2a073c23..fffaddb08e7 100644 --- a/imports/plugins/core/layout/client/templates/layout/admin/admin.js +++ b/imports/plugins/core/layout/client/templates/layout/admin/admin.js @@ -1,10 +1,9 @@ import Drop from "tether-drop"; -import { Meteor } from "meteor/meteor"; -import { Blaze } from "meteor/blaze"; -import { Template } from "meteor/templating"; -import { Reaction, i18next } from "/client/api"; -import { Packages } from "/lib/collections"; - +import {Meteor} from "meteor/meteor"; +import {Blaze} from "meteor/blaze"; +import {Template} from "meteor/templating"; +import {Reaction, i18next} from "/client/api"; +import {Packages} from "/lib/collections"; Template.coreAdminLayout.onRendered(function () { $("body").addClass("admin"); @@ -17,31 +16,26 @@ Template.coreAdminLayout.onDestroyed(() => { Template.coreAdminLayout.helpers({ shortcutButtons() { const instance = Template.instance(); - const shortcuts = Reaction.Apps({ - provides: "shortcut", - enabled: true, - container: undefined - }); - + const shortcuts = Reaction.Apps({provides: "shortcut", enabled: true}); const items = []; if (_.isArray(shortcuts)) { for (const shortcut of shortcuts) { - items.push({ - type: "link", - href: Reaction.Router.pathFor(shortcut.name), - className: Reaction.Router.isActiveClassName(shortcut.name), - icon: shortcut.icon, - tooltip: shortcut.label || "", - i18nKeyTooltip: shortcut.i18nKeyLabel, - tooltipPosition: "left middle" - }); + if (!shortcut.container) { + items.push({ + type: "link", + href: Reaction.Router.pathFor(shortcut.name), + className: Reaction.Router.isActiveClassName(shortcut.name), + icon: shortcut.icon, + tooltip: shortcut.label || "", + i18nKeyTooltip: shortcut.i18nKeyLabel, + tooltipPosition: "left middle" + }); + } } } - items.push({ - type: "seperator" - }); + items.push({type: "seperator"}); items.push({ icon: "plus", @@ -50,13 +44,7 @@ Template.coreAdminLayout.helpers({ tooltipPosition: "left middle", onClick(event) { if (!instance.dropInstance) { - instance.dropInstance = new Drop({ - target: event.currentTarget, - content: "", - constrainToWindow: true, - classes: "drop-theme-arrows", - position: "right center" - }); + instance.dropInstance = new Drop({target: event.currentTarget, content: "", constrainToWindow: true, classes: "drop-theme-arrows", position: "right center"}); Blaze.renderWithData(Template.createContentMenu, {}, instance.dropInstance.content); } @@ -144,36 +132,20 @@ Template.coreAdminLayout.helpers({ } }); -// Template.coreAdminLayout.events({ -// /** +// Template.coreAdminLayout.events({ /** // * Submit sign up form // * @param {Event} event - jQuery Event // * @param {Template} template - Blaze Template -// * @return {void} -// */ -// "click .admin-controls-quicklinks a, click .admin-controls-quicklinks button"(event) { -// if (this.name === "createProduct") { -// event.preventDefault(); -// event.stopPropagation(); +// * @return {void} */ "click .admin-controls-quicklinks a, click .admin-controls-quicklinks button"(event) { +// if (this.name === "createProduct") { event.preventDefault(); event.stopPropagation(); // -// if (!this.dropInstance) { -// this.dropInstance = new Drop({ -// target: event.target, -// content: "", -// constrainToWindow: true, -// classes: "drop-theme-arrows", -// position: "right center" -// }); +// if (!this.dropInstance) { this.dropInstance = new Drop({ target: event.target, +// content: "", constrainToWindow: true, classes: "drop-theme-arrows", position: "right +// center" }); // -// Blaze.renderWithData(Template.createContentMenu, {}, this.dropInstance.content); -// } +// Blaze.renderWithData(Template.createContentMenu, {}, this.dropInstance.content); } // -// this.dropInstance.open(); -// } else if (this.route) { -// event.preventDefault(); -// event.stopPropagation(); +// this.dropInstance.open(); } else if (this.route) { event.preventDefault(); +// event.stopPropagation(); // -// Reaction.Router.go(this.name); -// } -// } -// }); +// Reaction.Router.go(this.name); } } }); diff --git a/imports/plugins/core/payments/client/checkout/payment/index.js b/imports/plugins/core/payments/client/checkout/payment/index.js index c985fe13913..c9d6221f1b0 100644 --- a/imports/plugins/core/payments/client/checkout/payment/index.js +++ b/imports/plugins/core/payments/client/checkout/payment/index.js @@ -1,3 +1,2 @@ -import "./methods/cards.html"; -import "./methods/cards.js"; +import "./methods.html"; import "./payment.html"; diff --git a/imports/plugins/core/payments/client/checkout/payment/methods.html b/imports/plugins/core/payments/client/checkout/payment/methods.html new file mode 100644 index 00000000000..9a3d629b464 --- /dev/null +++ b/imports/plugins/core/payments/client/checkout/payment/methods.html @@ -0,0 +1,18 @@ + diff --git a/imports/plugins/core/payments/client/checkout/payment/methods/cards.html b/imports/plugins/core/payments/client/checkout/payment/methods/cards.html deleted file mode 100644 index de79539a3a0..00000000000 --- a/imports/plugins/core/payments/client/checkout/payment/methods/cards.html +++ /dev/null @@ -1,34 +0,0 @@ - diff --git a/imports/plugins/core/payments/client/checkout/payment/methods/cards.js b/imports/plugins/core/payments/client/checkout/payment/methods/cards.js deleted file mode 100644 index 36c4d35cd90..00000000000 --- a/imports/plugins/core/payments/client/checkout/payment/methods/cards.js +++ /dev/null @@ -1,30 +0,0 @@ -import { Shops } from "/lib/collections"; -import { Template } from "meteor/templating"; - -const openClassName = "in"; - -Template.corePaymentMethods.onCreated(function () { - // Set the default paymentMethod - // Note: we do this once, so if the admin decides to change the default payment method - // while a user is trying to checkout, they wont get a jarring experience. - const shop = Shops.findOne(); - - this.state = new ReactiveDict(); - this.state.setDefault({ - defaultPaymentMethod: shop.defaultPaymentMethod || "none" - }); -}); - -Template.corePaymentMethods.helpers({ - isOpen(current) { - const instance = Template.instance(); - const state = instance.state; - const name = current.packageName; - const priority = current.priority; - - if (state.equals("defaultPaymentMethod", name) || priority === "0" && state.equals("defaultPaymentMethod", "none")) { - return openClassName; - } - return ""; - } -}); diff --git a/imports/plugins/core/payments/client/settings/settings.html b/imports/plugins/core/payments/client/settings/settings.html index bf3008f882d..7eac9605f23 100644 --- a/imports/plugins/core/payments/client/settings/settings.html +++ b/imports/plugins/core/payments/client/settings/settings.html @@ -1,6 +1,6 @@