apply the css colour to the card
This commit is contained in:
parent
8d8e9f9ad1
commit
e539c34653
|
@ -2,6 +2,7 @@ import { ajax } from "discourse/lib/ajax";
|
||||||
import { formatAnchor, zeroDecimalCurrencies } from "../lib/donation-utilities";
|
import { formatAnchor, zeroDecimalCurrencies } from "../lib/donation-utilities";
|
||||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||||
import { emailValid as emailValidHelper } from "discourse/lib/utilities";
|
import { emailValid as emailValidHelper } from "discourse/lib/utilities";
|
||||||
|
import { currentThemeId } from "discourse/lib/theme-selector";
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
result: [],
|
result: [],
|
||||||
|
@ -12,15 +13,16 @@ export default Ember.Component.extend({
|
||||||
includeTransactionFee: true,
|
includeTransactionFee: true,
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super();
|
this._super(...arguments);
|
||||||
|
|
||||||
const user = this.get("currentUser");
|
const user = this.get("currentUser");
|
||||||
const settings = Discourse.SiteSettings;
|
const settings = Discourse.SiteSettings;
|
||||||
|
|
||||||
this.set(
|
this.setProperties({
|
||||||
"create_accounts",
|
"create_accounts": !user && settings.discourse_donations_enable_create_accounts,
|
||||||
!user && settings.discourse_donations_enable_create_accounts
|
"stripe": Stripe(settings.discourse_donations_public_key),
|
||||||
);
|
"color": jQuery("body").css("color"),
|
||||||
this.set("stripe", Stripe(settings.discourse_donations_public_key));
|
});
|
||||||
|
|
||||||
const types = settings.discourse_donations_types.split("|") || [];
|
const types = settings.discourse_donations_types.split("|") || [];
|
||||||
const amounts = this.get("donateAmounts");
|
const amounts = this.get("donateAmounts");
|
||||||
|
@ -100,10 +102,18 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
@computed("stripe")
|
@computed("stripe")
|
||||||
card(stripe) {
|
card(stripe) {
|
||||||
let elements = stripe.elements();
|
const color = this.get("color");
|
||||||
let card = elements.create("card", {
|
const hidePostalCode = !Discourse.SiteSettings.discourse_donations_zip_code;
|
||||||
hidePostalCode: !Discourse.SiteSettings.discourse_donations_zip_code
|
const elements = stripe.elements();
|
||||||
});
|
|
||||||
|
const style = {
|
||||||
|
base: {
|
||||||
|
iconColor: color,
|
||||||
|
'::placeholder': { color: color },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const card = elements.create("card", { style, hidePostalCode });
|
||||||
|
|
||||||
card.addEventListener("change", event => {
|
card.addEventListener("change", event => {
|
||||||
if (event.error) {
|
if (event.error) {
|
||||||
|
|
Loading…
Reference in New Issue