2016-08-25 12:14:56 -05:00
|
|
|
require_dependency 'wizard'
|
2016-09-09 15:51:07 -05:00
|
|
|
require_dependency 'wizard/builder'
|
2016-08-25 12:14:56 -05:00
|
|
|
|
|
|
|
class WizardController < ApplicationController
|
2018-01-31 19:26:45 -06:00
|
|
|
prepend_before_action :check_xhr, :ensure_admin, except: [:qunit]
|
|
|
|
prepend_before_action :check_xhr, :ensure_logged_in, except: [:qunit]
|
2017-08-30 23:06:56 -05:00
|
|
|
before_action :ensure_wizard_enabled, only: [:index]
|
|
|
|
skip_before_action :check_xhr, :preload_json
|
2016-08-25 12:14:56 -05:00
|
|
|
|
|
|
|
layout false
|
|
|
|
|
|
|
|
def index
|
|
|
|
respond_to do |format|
|
|
|
|
format.json do
|
2016-09-09 15:51:07 -05:00
|
|
|
wizard = Wizard::Builder.new(current_user).build
|
2016-08-25 12:14:56 -05:00
|
|
|
render_serialized(wizard, WizardSerializer)
|
|
|
|
end
|
|
|
|
format.html {}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def qunit
|
2017-07-27 10:29:18 -05:00
|
|
|
raise Discourse::InvalidAccess.new if Rails.env.production?
|
2016-08-25 12:14:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|