2016-08-25 13:14:56 -04:00
|
|
|
require_dependency 'wizard'
|
2016-09-09 16:51:07 -04:00
|
|
|
require_dependency 'wizard/builder'
|
2016-08-25 13:14:56 -04:00
|
|
|
|
|
|
|
class WizardController < ApplicationController
|
2016-09-14 16:36:08 -04:00
|
|
|
before_filter :ensure_wizard_enabled, only: [:index]
|
2017-07-27 11:29:18 -04:00
|
|
|
before_filter :ensure_logged_in, except: [:qunit]
|
|
|
|
before_filter :ensure_admin, except: [:qunit]
|
2016-08-25 13:14:56 -04:00
|
|
|
|
|
|
|
skip_before_filter :check_xhr, :preload_json
|
|
|
|
|
|
|
|
layout false
|
|
|
|
|
|
|
|
def index
|
|
|
|
respond_to do |format|
|
|
|
|
format.json do
|
2016-09-09 16:51:07 -04:00
|
|
|
wizard = Wizard::Builder.new(current_user).build
|
2016-08-25 13:14:56 -04:00
|
|
|
render_serialized(wizard, WizardSerializer)
|
|
|
|
end
|
|
|
|
format.html {}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def qunit
|
2017-07-27 11:29:18 -04:00
|
|
|
raise Discourse::InvalidAccess.new if Rails.env.production?
|
2016-08-25 13:14:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|