discourse-subscriptions/plugin.rb

31 lines
933 B
Ruby
Raw Normal View History

2017-02-23 20:42:59 -05:00
# name: discourse-donations
# about: Integrating Discourse with Stripe for donations
2017-03-15 20:56:59 -04:00
# version: 1.9.5
2017-02-23 20:42:59 -05:00
# url: https://github.com/choiceaustralia/discourse-donations
2017-02-22 18:31:30 -05:00
# authors: Rimian Perkins
2017-01-30 21:28:41 -05:00
2017-02-22 18:31:30 -05:00
gem 'stripe', '2.0.1'
2017-02-23 21:23:11 -05:00
load File.expand_path('../lib/discourse_donations/engine.rb', __FILE__)
2017-02-27 21:36:41 -05:00
enabled_site_setting :discourse_donations_enabled
after_initialize do
2017-03-02 18:17:38 -05:00
# Must be placed on every page for fraud protection.
header_script = '<script src="https://js.stripe.com/v3/"></script>'
discourse_donations_customization = SiteCustomization.find_or_create_by({
2017-02-23 20:42:59 -05:00
name: 'Discourse Donations Header',
header: header_script,
mobile_header: header_script,
enabled: true,
user_id: -1
})
SiteCustomization.where(name: discourse_donations_customization.name).where.not(id: discourse_donations_customization.id).delete_all
end
2017-02-06 21:56:22 -05:00
Discourse::Application.routes.prepend do
2017-02-23 21:23:11 -05:00
mount ::DiscourseDonations::Engine, at: '/'
2017-01-30 21:28:41 -05:00
end