Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-13 21:42:53 +01:00
Allow theme to be added by name && use template when loading wizard for controller
Dieser Commit ist enthalten in:
Ursprung
4b4ed53a46
Commit
9d8424a35f
2 geänderte Dateien mit 8 neuen und 3 gelöschten Zeilen
|
@ -7,15 +7,15 @@ class CustomWizard::WizardController < ::ApplicationController
|
||||||
helper_method :theme_key
|
helper_method :theme_key
|
||||||
|
|
||||||
def wizard
|
def wizard
|
||||||
PluginStore.get('custom_wizard', params[:wizard_id].underscore)
|
CustomWizard::Template.new(PluginStore.get('custom_wizard', params[:wizard_id].underscore))
|
||||||
end
|
end
|
||||||
|
|
||||||
def wizard_page_title
|
def wizard_page_title
|
||||||
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_key
|
||||||
wizard ? wizard['theme_key'] : nil
|
wizard ? wizard.theme_key : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -29,5 +29,10 @@ class CustomWizard::Template
|
||||||
@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_key = data['theme_key']
|
||||||
|
|
||||||
|
if data['theme']
|
||||||
|
theme = Theme.find_by(name: data['theme'])
|
||||||
|
@theme_key = theme.key if theme
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Laden …
In neuem Issue referenzieren