0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 01:10:28 +01:00

theme key has changed to theme id

Dieser Commit ist enthalten in:
Angus 2018-07-16 14:28:24 +10:00
Ursprung ea9a7c1654
Commit 7a781b24d0
7 geänderte Dateien mit 16 neuen und 16 gelöschten Zeilen

Datei anzeigen

@ -16,7 +16,7 @@ const PROFILE_FIELDS = [
'bio_raw', 'bio_raw',
'profile_background', 'profile_background',
'card_background', 'card_background',
'theme_key' 'theme_id'
]; ];
export default Ember.Component.extend({ export default Ember.Component.extend({
@ -60,8 +60,8 @@ export default Ember.Component.extend({
@computed() @computed()
builderUserFields() { builderUserFields() {
const noThemeKey = PROFILE_FIELDS.filter((f) => f !== 'theme_key'); const noTheme = PROFILE_FIELDS.filter((f) => f !== 'theme_id');
const fields = noThemeKey.concat(['email', 'username']); const fields = noTheme.concat(['email', 'username']);
return fields.map((f) => ` u{${f}}`); return fields.map((f) => ` u{${f}}`);
}, },

Datei anzeigen

@ -11,7 +11,7 @@ const wizardProperties = [
'required', 'required',
'prompt_completion', 'prompt_completion',
'min_trust', 'min_trust',
'theme_key' 'theme_id'
]; ];
const CustomWizard = Discourse.Model.extend({ const CustomWizard = Discourse.Model.extend({

Datei anzeigen

@ -104,10 +104,10 @@
<div class="setting"> <div class="setting">
<div class="setting-label"> <div class="setting-label">
<h3>{{i18n 'admin.wizard.theme_key'}}</h3> <h3>{{i18n 'admin.wizard.theme_id'}}</h3>
</div> </div>
<div class="setting-value"> <div class="setting-value">
{{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'}}
</div> </div>
</div> </div>

Datei anzeigen

@ -35,7 +35,7 @@ en:
prompt_completion_label: "Prompt user to complete wizard." prompt_completion_label: "Prompt user to complete wizard."
min_trust: "Trust" min_trust: "Trust"
min_trust_label: "Trust level required to access wizard." min_trust_label: "Trust level required to access wizard."
theme_key: "Theme" theme_id: "Theme"
no_theme: "Select a Theme (optional)" no_theme: "Select a Theme (optional)"
save: "Save Changes" save: "Save Changes"
remove: "Delete Wizard" remove: "Delete Wizard"

Datei anzeigen

@ -4,7 +4,7 @@ class CustomWizard::WizardController < ::ApplicationController
requires_login requires_login
helper_method :wizard_page_title helper_method :wizard_page_title
helper_method :theme_key helper_method :theme_id
def wizard def wizard
CustomWizard::Template.new(PluginStore.get('custom_wizard', params[:wizard_id].underscore)) 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') wizard ? (wizard.name || wizard.id) : I18n.t('wizard.custom_title')
end end
def theme_key def theme_id
wizard ? wizard.theme_key : nil wizard ? wizard.theme_id : nil
end end
def index def index

Datei anzeigen

@ -12,7 +12,7 @@ class CustomWizard::Template
:after_time, :after_time,
:after_time_scheduled, :after_time_scheduled,
:required, :required,
:theme_key :theme_id
def initialize(data) def initialize(data)
data = data.is_a?(String) ? ::JSON.parse(data) : data data = data.is_a?(String) ? ::JSON.parse(data) : data
@ -31,11 +31,11 @@ class CustomWizard::Template
@after_time = data['after_time'] @after_time = data['after_time']
@after_time_scheduled = data['after_time_scheduled'] @after_time_scheduled = data['after_time_scheduled']
@required = data['required'] || false @required = data['required'] || false
@theme_key = data['theme_key'] @theme_id = data['theme_id']
if data['theme'] if data['theme']
theme = Theme.find_by(name: data['theme']) theme = Theme.find_by(name: data['theme'])
@theme_key = theme.key if theme @theme_id = theme.id if theme
end end
end end
end end

Datei anzeigen

@ -1,11 +1,11 @@
<html> <html>
<head> <head>
<%= 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_custom", media: "all", "data-turbolinks-track" => "reload" %>
<%= stylesheet_link_tag "wizard_composer", 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_variables", media: "all", "data-turbolinks-track" => "reload" %>
<%= stylesheet_link_tag "wizard_custom_mobile", media: "all", "data-turbolinks-track" => "reload" if mobile_view?%> <%= 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) %> <%= discourse_stylesheet_link_tag (mobile_view? ? :mobile_theme : :desktop_theme) %>
<%- end %> <%- end %>
<%= preload_script "ember_jquery" %> <%= preload_script "ember_jquery" %>
@ -26,7 +26,7 @@
<%= server_plugin_outlet "custom_wizard" %> <%= server_plugin_outlet "custom_wizard" %>
<meta name="discourse_theme_key" content="<%= theme_key %>"> <meta name="discourse_theme_id" content="<%= theme_id %>">
<meta name="discourse-base-uri" content="<%= Discourse.base_uri %>"> <meta name="discourse-base-uri" content="<%= Discourse.base_uri %>">
<%= render partial: "layouts/head" %> <%= render partial: "layouts/head" %>