From d98ba20d0ded6979c2da5a38f7c9dc00bbf41f40 Mon Sep 17 00:00:00 2001 From: Rimian Perkins Date: Wed, 19 Apr 2017 12:51:15 +1000 Subject: [PATCH] Implement new Theme * remove old SiteCustomization (deprecated) * Create a theme and add a field for the header --- plugin.rb | 15 ++++----------- spec/support/dd_helper.rb | 1 + 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/plugin.rb b/plugin.rb index c2acab6..8cd7b4a 100644 --- a/plugin.rb +++ b/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 = '' - - 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 diff --git a/spec/support/dd_helper.rb b/spec/support/dd_helper.rb index 6dd0ef8..3c196f0 100644 --- a/spec/support/dd_helper.rb +++ b/spec/support/dd_helper.rb @@ -1,3 +1,4 @@ +require 'fakeweb' #TODO register some fixtures