Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-09 20:02:54 +01:00
25 Zeilen
791 B
Ruby
25 Zeilen
791 B
Ruby
class CustomWizard::WizardController < ::ApplicationController
|
|
prepend_view_path(Rails.root.join('plugins', 'discourse-custom-wizard', 'views'))
|
|
layout 'wizard'
|
|
helper_method :wizard_page_title
|
|
|
|
def wizard_page_title
|
|
wizard = PluginStore.get('custom_wizard', params[:wizard_id].underscore)
|
|
wizard ? (wizard['name'] || wizard['id']) : I18n.t('wizard.custom_title')
|
|
end
|
|
|
|
def index
|
|
respond_to do |format|
|
|
format.json do
|
|
template = CustomWizard::Builder.new(current_user, params[:wizard_id].underscore)
|
|
if template.wizard.present?
|
|
wizard = template.build
|
|
render_serialized(wizard, WizardSerializer)
|
|
else
|
|
render json: { error: I18n.t('wizard.none') }
|
|
end
|
|
end
|
|
format.html {}
|
|
end
|
|
end
|
|
end
|