Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-15 14:22:53 +01:00
Merge branch 'master' into mapper_documentation
Dieser Commit ist enthalten in:
Commit
f3c29aba3c
5 geänderte Dateien mit 14 neuen und 8 gelöschten Zeilen
|
@ -21,7 +21,7 @@ export default {
|
||||||
actions: {
|
actions: {
|
||||||
willTransition(transition) {
|
willTransition(transition) {
|
||||||
const redirectToWizard = this.get("currentUser.redirect_to_wizard");
|
const redirectToWizard = this.get("currentUser.redirect_to_wizard");
|
||||||
const excludedPaths = Discourse.SiteSettings.wizard_redirect_exclude_paths
|
const excludedPaths = this.siteSettings.wizard_redirect_exclude_paths
|
||||||
.split("|")
|
.split("|")
|
||||||
.concat(["loading"]);
|
.concat(["loading"]);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { get, set } from "@ember/object";
|
import { get, set } from "@ember/object";
|
||||||
|
import { getOwner } from "discourse-common/lib/get-owner";
|
||||||
|
|
||||||
const wizard = {
|
const wizard = {
|
||||||
basic: {
|
basic: {
|
||||||
|
@ -222,7 +223,8 @@ export function buildFieldValidations(validations) {
|
||||||
wizardSchema.field.validations = validations;
|
wizardSchema.field.validations = validations;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Discourse.SiteSettings.wizard_apis_enabled) {
|
const siteSettings = getOwner(this).lookup("site-settings:main");
|
||||||
|
if (siteSettings.wizard_apis_enabled) {
|
||||||
wizardSchema.action.types.send_to_api = {
|
wizardSchema.action.types.send_to_api = {
|
||||||
api: null,
|
api: null,
|
||||||
api_endpoint: null,
|
api_endpoint: null,
|
||||||
|
|
|
@ -11,7 +11,9 @@ class CustomWizard::WizardController < ::ApplicationController
|
||||||
helper_method :wizard_theme_translations_lookup
|
helper_method :wizard_theme_translations_lookup
|
||||||
|
|
||||||
def wizard
|
def wizard
|
||||||
CustomWizard::Wizard.create(params[:wizard_id].underscore, current_user)
|
@builder = CustomWizard::Builder.new(params[:wizard_id].underscore, current_user)
|
||||||
|
@wizard ||= @builder.build
|
||||||
|
@wizard
|
||||||
end
|
end
|
||||||
|
|
||||||
def wizard_page_title
|
def wizard_page_title
|
||||||
|
|
|
@ -31,7 +31,7 @@ class CustomWizard::Field
|
||||||
@index = attrs[:index]
|
@index = attrs[:index]
|
||||||
@type = attrs[:type]
|
@type = attrs[:type]
|
||||||
@required = !!attrs[:required]
|
@required = !!attrs[:required]
|
||||||
@value = attrs[:value]
|
@value = attrs[:value] || default_value
|
||||||
@description = attrs[:description]
|
@description = attrs[:description]
|
||||||
@image = attrs[:image]
|
@image = attrs[:image]
|
||||||
@key = attrs[:key]
|
@key = attrs[:key]
|
||||||
|
@ -50,6 +50,12 @@ class CustomWizard::Field
|
||||||
@label ||= PrettyText.cook(@raw[:label])
|
@label ||= PrettyText.cook(@raw[:label])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def default_value
|
||||||
|
if @type == 'checkbox'
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self.types
|
def self.types
|
||||||
@types ||= {
|
@types ||= {
|
||||||
text: {
|
text: {
|
||||||
|
|
|
@ -40,10 +40,6 @@ class CustomWizard::FieldSerializer < ::ApplicationSerializer
|
||||||
object.value
|
object.value
|
||||||
end
|
end
|
||||||
|
|
||||||
def include_value?
|
|
||||||
object.value.present?
|
|
||||||
end
|
|
||||||
|
|
||||||
def i18n_key
|
def i18n_key
|
||||||
@i18n_key ||= "wizard.step.#{object.step.id}.fields.#{object.id}".underscore
|
@i18n_key ||= "wizard.step.#{object.step.id}.fields.#{object.id}".underscore
|
||||||
end
|
end
|
||||||
|
|
Laden …
In neuem Issue referenzieren