From 9b2ca50671e061d57616e28e65e454e92e34ed34 Mon Sep 17 00:00:00 2001 From: Rimian Perkins Date: Wed, 28 Aug 2019 18:24:55 +1000 Subject: [PATCH] fix deprecations --- .../discourse/components/stripe-card.js.es6 | 4 +- .../initializers/donations-edits.js.es6 | 71 ++++++++++--------- 2 files changed, 39 insertions(+), 36 deletions(-) diff --git a/assets/javascripts/discourse/components/stripe-card.js.es6 b/assets/javascripts/discourse/components/stripe-card.js.es6 index 16c315e..8573424 100644 --- a/assets/javascripts/discourse/components/stripe-card.js.es6 +++ b/assets/javascripts/discourse/components/stripe-card.js.es6 @@ -179,11 +179,11 @@ export default Ember.Component.extend({ didInsertElement() { this._super(); this.get("card").mount("#card-element"); - Ember.$(document).on("click", Ember.run.bind(this, this.documentClick)); + jQuery(document).on("click", Ember.run.bind(this, this.documentClick)); }, willDestroyElement() { - Ember.$(document).off("click", Ember.run.bind(this, this.documentClick)); + jQuery(document).off("click", Ember.run.bind(this, this.documentClick)); }, documentClick(e) { diff --git a/assets/javascripts/discourse/initializers/donations-edits.js.es6 b/assets/javascripts/discourse/initializers/donations-edits.js.es6 index f6b7b0f..9741855 100644 --- a/assets/javascripts/discourse/initializers/donations-edits.js.es6 +++ b/assets/javascripts/discourse/initializers/donations-edits.js.es6 @@ -6,40 +6,43 @@ export default { const siteSettings = container.lookup("site-settings:main"); withPluginApi("0.8.12", api => { - api.decorateCooked($post => { - const $form = $post.find(".stripe-checkout"); - if ($form.length) { - const $input = $form.find("input"); - var s = document.createElement("script"); - s.src = "https://checkout.stripe.com/checkout.js"; - s.setAttribute("class", "stripe-button"); - s.setAttribute( - "data-key", - siteSettings.discourse_donations_public_key - ); - s.setAttribute("data-amount", $input.attr("amount")); - s.setAttribute( - "data-name", - siteSettings.discourse_donations_shop_name - ); - s.setAttribute("data-description", $form.attr("content")); - s.setAttribute("data-image", $form.attr("image") || ""); - s.setAttribute("data-locale", "auto"); - s.setAttribute( - "data-zip-code", - siteSettings.discourse_donations_zip_code - ); - s.setAttribute( - "data-billing-address", - siteSettings.discourse_donations_billing_address - ); - s.setAttribute( - "data-currency", - siteSettings.discourse_donations_currency - ); - $form.append(s); - } - }); + api.decorateCooked( + $post => { + const $form = $post.find(".stripe-checkout"); + if ($form.length) { + const $input = $form.find("input"); + var s = document.createElement("script"); + s.src = "https://checkout.stripe.com/checkout.js"; + s.setAttribute("class", "stripe-button"); + s.setAttribute( + "data-key", + siteSettings.discourse_donations_public_key + ); + s.setAttribute("data-amount", $input.attr("amount")); + s.setAttribute( + "data-name", + siteSettings.discourse_donations_shop_name + ); + s.setAttribute("data-description", $form.attr("content")); + s.setAttribute("data-image", $form.attr("image") || ""); + s.setAttribute("data-locale", "auto"); + s.setAttribute( + "data-zip-code", + siteSettings.discourse_donations_zip_code + ); + s.setAttribute( + "data-billing-address", + siteSettings.discourse_donations_billing_address + ); + s.setAttribute( + "data-currency", + siteSettings.discourse_donations_currency + ); + $form.append(s); + } + }, + { id: "discourse-donations" } + ); if (siteSettings.discourse_donations_cause_category) { api.decorateWidget("category-header-widget:after", helper => {