2017-09-25 16:47:40 +02:00
|
|
|
class CustomWizard::WizardController < ::ApplicationController
|
2017-10-17 09:18:53 +02:00
|
|
|
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['name'] || wizard['id']
|
2017-09-25 16:47:40 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def index
|
2017-09-23 04:34:07 +02:00
|
|
|
respond_to do |format|
|
|
|
|
format.json do
|
2017-10-07 04:27:38 +02:00
|
|
|
wizard = CustomWizard::Builder.new(current_user, params[:wizard_id].underscore).build
|
2017-09-23 04:34:07 +02:00
|
|
|
render_serialized(wizard, WizardSerializer)
|
|
|
|
end
|
|
|
|
format.html {}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|