only show the link when the plugin is enabled

This commit is contained in:
Rimian Perkins 2017-02-27 12:10:53 +11:00
commit d0d1902329
9 changed files with 25 additions and 15 deletions

View File

@ -2,7 +2,7 @@ import { ajax } from 'discourse/lib/ajax';
export default Ember.Component.extend({
result: null,
paymentAmounts: [5, 10],
donateAmounts: [5, 10],
amount: null,
stripe: Stripe('pk_test_b8RmhzlL8QPizJRqOrKF3JEV'),

View File

@ -1,22 +1,22 @@
<form id="payment-form" class="form-horizontal">
<div class="control-group" style="width: 550px;">
<label class="control-label" for="card-element">{{i18n 'discourse_payments.amount'}}</label>
<label class="control-label" for="card-element">{{i18n 'discourse_donations.amount'}}</label>
<div class="controls controls-dropdown">
{{combo-box valueAttribute="value" content=paymentAmounts value=amount}}
{{combo-box valueAttribute="value" content=donateAmounts value=amount}}
</div>
</div>
<div class="control-group" style="width: 550px;">
<label class="control-label" for="card-element">{{i18n 'discourse_payments.card'}}</label>
<label class="control-label" for="card-element">{{i18n 'discourse_donations.card'}}</label>
<div id="card-element" class="controls"></div>
</div>
<div class="control-group save-button">
<div class="controls">
<button {{action "submitStripeCard"}} class="btn btn-primary">{{i18n 'discourse_payments.submit'}}</button>
<button {{action "submitStripeCard"}} class="btn btn-primary">{{i18n 'discourse_donations.submit'}}</button>
{{#if result}}
<span>{{i18n 'discourse_payments.success'}}</span>
<span>{{i18n 'discourse_donations.success'}}</span>
{{/if}}
</div>
</div>

View File

@ -1,4 +1,5 @@
<div class="discourse-donations">
<a href="/users/{{model.username}}/payments">Donate</a>
</div>
{{#if siteSettings.discourse_donations_enabled}}
<div class="discourse-donations">
<a href="/users/{{model.username}}/payments">Donate</a>
</div>
{{/if}}

View File

@ -1,9 +1,9 @@
{{#d-section pageClass="user-payments" class="user-content user-payments"}}
{{#d-section pageClass="user-donations" class="user-content user-donations"}}
<div class="user-table">
<div class="wrapper">
<section class="user-navigation">
<ul class="action-list nav-stacked">
<li class="no-glyph">{{i18n 'discourse_payments.title'}}</li>
<li class="no-glyph">{{i18n 'discourse_donations.title'}}</li>
</ul>
</section>
<section class="user-right">

View File

@ -1,6 +1,6 @@
en:
js:
discourse_payments:
discourse_donations:
title: Spenden
amount: Betrag
card: Kreditkarte oder Bankkarte

View File

@ -1,6 +1,6 @@
en:
js:
discourse_payments:
discourse_donations:
title: Donate
amount: Amount
card: Credit or debit card

View File

@ -0,0 +1,3 @@
en:
site_settings:
discourse_donations_enabled: "Enable the discourse donations plugin."

4
config/settings.yml Normal file
View File

@ -0,0 +1,4 @@
plugins:
discourse_donations_enabled:
default: true
client: true

View File

@ -1,6 +1,6 @@
# name: discourse-donations
# about: Integrating Discourse with Stripe for donations
# version: 1.6.1
# version: 1.6.2
# url: https://github.com/choiceaustralia/discourse-donations
# authors: Rimian Perkins
@ -9,6 +9,8 @@ gem 'stripe', '2.0.1'
load File.expand_path('../lib/discourse_donations/engine.rb', __FILE__)
load File.expand_path('../config/stripe.rb', __FILE__)
enabled_site_setting :discourse_donations_enabled
after_initialize do
header_script = '<script src="https://js.stripe.com/v3/"></script>'