add jquery button yo

This commit is contained in:
Rimian Perkins 2017-03-02 16:40:16 +11:00
commit 1f3b3cf857
4 changed files with 37 additions and 10 deletions

View File

@ -17,9 +17,9 @@ Visit `/admin/plugins` and configure your private and public keys.
## Testing ## Testing
To run the rails specs, install the plugin and run `bundle exec rake plugin:spec[discourse-donations]` in the discourse root directory. * To run the rails specs, install the plugin and run `bundle exec rake plugin:spec[discourse-donations]` in the discourse root directory.
* To run qunit tests: `MODULE='Acceptance: Discourse Donations' bundle exec rake qunit:test[20000]`.
To run qunit tests: `MODULE='Acceptance: Discourse Donations' bundle exec rake qunit:test[20000]`. * To run Component tests: `MODULE='component:stripe-card' bundle exec rake qunit:test[20000]`.
**Note:** **Note:**

View File

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

View File

@ -1,6 +1,6 @@
# name: discourse-donations # name: discourse-donations
# about: Integrating Discourse with Stripe for donations # about: Integrating Discourse with Stripe for donations
# version: 1.6.8 # version: 1.7.0
# url: https://github.com/choiceaustralia/discourse-donations # url: https://github.com/choiceaustralia/discourse-donations
# authors: Rimian Perkins # authors: Rimian Perkins
@ -11,7 +11,15 @@ load File.expand_path('../lib/discourse_donations/engine.rb', __FILE__)
enabled_site_setting :discourse_donations_enabled enabled_site_setting :discourse_donations_enabled
after_initialize do after_initialize do
header_script = '<script src="https://js.stripe.com/v3/"></script>' header_script = <<-EOF.strip_heredoc.chomp
<script src="https://js.stripe.com/v3/"></script>
<script>
$(document).ready(function(){
var payments_url = $("ul[role='navigation'] #current-user a").attr('href') + '/payments';
$("ul[role='navigation']").append('<li><a href=' + payments_url + '>Donate</a></li>');
});
</script>
EOF
discourse_donations_customization = SiteCustomization.find_or_create_by({ discourse_donations_customization = SiteCustomization.find_or_create_by({
name: 'Discourse Donations Header', name: 'Discourse Donations Header',

View File

@ -0,0 +1,24 @@
import componentTest from 'helpers/component-test';
moduleForComponent('stripe-card', { integration: true });
window.Stripe = function() {
return {
elements: function() {
return {
create: function() {
return {
mount: function() {}
};
}
};
},
};
};
componentTest('stripe card', {
template: `{{stripe-card}}`,
test(assert) {
assert.ok(true);
}
});