From ca0cb5effa2e02808e4095fc66230ff933ea71ec Mon Sep 17 00:00:00 2001 From: Angus Date: Mon, 16 Jul 2018 14:28:24 +1000 Subject: [PATCH] theme key has changed to theme id --- .../discourse/components/wizard-custom-action.js.es6 | 6 +++--- assets/javascripts/discourse/models/custom-wizard.js.es6 | 2 +- assets/javascripts/discourse/templates/admin-wizard.hbs | 4 ++-- config/locales/client.en.yml | 2 +- controllers/wizard.rb | 6 +++--- lib/template.rb | 6 +++--- views/layouts/wizard.html.erb | 6 +++--- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/assets/javascripts/discourse/components/wizard-custom-action.js.es6 b/assets/javascripts/discourse/components/wizard-custom-action.js.es6 index cff46d04..976501e5 100644 --- a/assets/javascripts/discourse/components/wizard-custom-action.js.es6 +++ b/assets/javascripts/discourse/components/wizard-custom-action.js.es6 @@ -16,7 +16,7 @@ const PROFILE_FIELDS = [ 'bio_raw', 'profile_background', 'card_background', - 'theme_key' + 'theme_id' ]; export default Ember.Component.extend({ @@ -60,8 +60,8 @@ export default Ember.Component.extend({ @computed() builderUserFields() { - const noThemeKey = PROFILE_FIELDS.filter((f) => f !== 'theme_key'); - const fields = noThemeKey.concat(['email', 'username']); + const noTheme = PROFILE_FIELDS.filter((f) => f !== 'theme_id'); + const fields = noTheme.concat(['email', 'username']); return fields.map((f) => ` u{${f}}`); }, diff --git a/assets/javascripts/discourse/models/custom-wizard.js.es6 b/assets/javascripts/discourse/models/custom-wizard.js.es6 index fa550bb5..34248250 100644 --- a/assets/javascripts/discourse/models/custom-wizard.js.es6 +++ b/assets/javascripts/discourse/models/custom-wizard.js.es6 @@ -11,7 +11,7 @@ const wizardProperties = [ 'required', 'prompt_completion', 'min_trust', - 'theme_key' + 'theme_id' ]; const CustomWizard = Discourse.Model.extend({ diff --git a/assets/javascripts/discourse/templates/admin-wizard.hbs b/assets/javascripts/discourse/templates/admin-wizard.hbs index c4de31a0..ed610b8c 100644 --- a/assets/javascripts/discourse/templates/admin-wizard.hbs +++ b/assets/javascripts/discourse/templates/admin-wizard.hbs @@ -104,10 +104,10 @@
-

{{i18n 'admin.wizard.theme_key'}}

+

{{i18n 'admin.wizard.theme_id'}}

- {{combo-box content=model.themes valueAttribute='key' value=model.theme_key none='admin.wizard.no_theme'}} + {{combo-box content=model.themes valueAttribute='id' value=model.theme_id none='admin.wizard.no_theme'}}
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 558ea1b1..5d06c32d 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -35,7 +35,7 @@ en: prompt_completion_label: "Prompt user to complete wizard." min_trust: "Trust" min_trust_label: "Trust level required to access wizard." - theme_key: "Theme" + theme_id: "Theme" no_theme: "Select a Theme (optional)" save: "Save Changes" remove: "Delete Wizard" diff --git a/controllers/wizard.rb b/controllers/wizard.rb index 4595fc09..57e48cbc 100644 --- a/controllers/wizard.rb +++ b/controllers/wizard.rb @@ -4,7 +4,7 @@ class CustomWizard::WizardController < ::ApplicationController requires_login helper_method :wizard_page_title - helper_method :theme_key + helper_method :theme_id def wizard CustomWizard::Template.new(PluginStore.get('custom_wizard', params[:wizard_id].underscore)) @@ -14,8 +14,8 @@ class CustomWizard::WizardController < ::ApplicationController wizard ? (wizard.name || wizard.id) : I18n.t('wizard.custom_title') end - def theme_key - wizard ? wizard.theme_key : nil + def theme_id + wizard ? wizard.theme_id : nil end def index diff --git a/lib/template.rb b/lib/template.rb index aabe94a0..ec1237f3 100644 --- a/lib/template.rb +++ b/lib/template.rb @@ -12,7 +12,7 @@ class CustomWizard::Template :after_time, :after_time_scheduled, :required, - :theme_key + :theme_id def initialize(data) data = data.is_a?(String) ? ::JSON.parse(data) : data @@ -31,11 +31,11 @@ class CustomWizard::Template @after_time = data['after_time'] @after_time_scheduled = data['after_time_scheduled'] @required = data['required'] || false - @theme_key = data['theme_key'] + @theme_id = data['theme_id'] if data['theme'] theme = Theme.find_by(name: data['theme']) - @theme_key = theme.key if theme + @theme_id = theme.id if theme end end end diff --git a/views/layouts/wizard.html.erb b/views/layouts/wizard.html.erb index e0f5e5c2..089c48d2 100644 --- a/views/layouts/wizard.html.erb +++ b/views/layouts/wizard.html.erb @@ -1,11 +1,11 @@ - <%= discourse_stylesheet_link_tag :wizard, theme_key: nil %> + <%= discourse_stylesheet_link_tag :wizard, theme_id: nil %> <%= stylesheet_link_tag "wizard_custom", media: "all", "data-turbolinks-track" => "reload" %> <%= stylesheet_link_tag "wizard_composer", media: "all", "data-turbolinks-track" => "reload" %> <%= stylesheet_link_tag "wizard_variables", media: "all", "data-turbolinks-track" => "reload" %> <%= stylesheet_link_tag "wizard_custom_mobile", media: "all", "data-turbolinks-track" => "reload" if mobile_view?%> - <%- if theme_key %> + <%- if theme_id %> <%= discourse_stylesheet_link_tag (mobile_view? ? :mobile_theme : :desktop_theme) %> <%- end %> <%= preload_script "ember_jquery" %> @@ -26,7 +26,7 @@ <%= server_plugin_outlet "custom_wizard" %> - + <%= render partial: "layouts/head" %>