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