Implement new Theme
* remove old SiteCustomization (deprecated) * Create a theme and add a field for the header
This commit is contained in:
parent
66094fdfdd
commit
a0711a6a6c
15
plugin.rb
15
plugin.rb
|
@ -1,6 +1,6 @@
|
|||
# name: discourse-donations
|
||||
# about: Integrating Discourse with Stripe for donations
|
||||
# version: 1.7.3
|
||||
# version: 1.8.0
|
||||
# url: https://github.com/choiceaustralia/discourse-donations
|
||||
# authors: Rimian Perkins
|
||||
|
||||
|
@ -13,16 +13,9 @@ enabled_site_setting :discourse_donations_enabled
|
|||
after_initialize do
|
||||
# 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({
|
||||
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
|
||||
discourse_donations_theme = Theme.find_or_create_by(name: 'Discourse Donations Header', hidden: false, user_id: -1)
|
||||
discourse_donations_theme.set_field('common', 'head_tag', header_script)
|
||||
discourse_donations_theme.save
|
||||
end
|
||||
|
||||
Discourse::Application.routes.prepend do
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
require 'fakeweb'
|
||||
|
||||
#TODO register some fixtures
|
||||
|
||||
|
|
Loading…
Reference in New Issue