0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2025-02-02 19:37:01 +01:00
discourse-custom-wizard/controllers/custom_wizard/admin/admin.rb

24 Zeilen
561 B
Ruby

2021-03-11 17:30:15 +11:00
# frozen_string_literal: true
2020-04-13 22:17:22 +10:00
class CustomWizard::AdminController < ::Admin::AdminController
before_action :ensure_admin
2021-03-11 17:30:15 +11:00
2020-04-13 22:17:22 +10:00
def index
end
2021-03-11 17:30:15 +11:00
2020-04-13 22:17:22 +10:00
private
2021-03-11 17:30:15 +11:00
2020-04-13 22:17:22 +10:00
def find_wizard
params.require(:wizard_id)
@wizard = CustomWizard::Wizard.create(params[:wizard_id].underscore)
2020-11-03 11:24:20 +11:00
raise Discourse::InvalidParameters.new(:wizard_id) unless @wizard
2020-04-13 22:17:22 +10:00
end
2021-03-11 17:30:15 +11:00
2020-10-20 16:40:23 +11:00
def custom_field_list
serialize_data(CustomWizard::CustomField.list, CustomWizard::CustomFieldSerializer)
end
2021-03-11 17:30:15 +11:00
def render_error(message)
render json: failed_json.merge(error: message)
end
2021-03-11 17:30:15 +11:00
end