Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-15 14:22:53 +01:00
modified docs according to new field model structure
Dieser Commit ist enthalten in:
Ursprung
f9f67c09e8
Commit
28094ab17b
4 geänderte Dateien mit 16 neuen und 15 gelöschten Zeilen
|
@ -20,7 +20,7 @@ export default {
|
||||||
/*
|
/*
|
||||||
* unit: custom_wizard:templates_and_builder
|
* unit: custom_wizard:templates_and_builder
|
||||||
* type: step
|
* type: step
|
||||||
* number: 9
|
* number: 8
|
||||||
* title: Handle the attribute in the wizard client
|
* title: Handle the attribute in the wizard client
|
||||||
* description: We can now handle our new attribute in the wizard client.
|
* description: We can now handle our new attribute in the wizard client.
|
||||||
* For our "highlighted" attribute, we would add a
|
* For our "highlighted" attribute, we would add a
|
||||||
|
|
|
@ -66,14 +66,6 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
|
||||||
# type: step
|
|
||||||
# number: 3
|
|
||||||
# title: Add a permitted parameter
|
|
||||||
# description: The custom wizard server admin controller will only accept
|
|
||||||
# permitted attributes...
|
|
||||||
##
|
|
||||||
|
|
||||||
def save_wizard_params
|
def save_wizard_params
|
||||||
params.require(:wizard).permit(
|
params.require(:wizard).permit(
|
||||||
:id,
|
:id,
|
||||||
|
|
|
@ -3,6 +3,21 @@
|
||||||
class CustomWizard::Field
|
class CustomWizard::Field
|
||||||
include ActiveModel::SerializerSupport
|
include ActiveModel::SerializerSupport
|
||||||
|
|
||||||
|
##
|
||||||
|
# type: step
|
||||||
|
# number: 3
|
||||||
|
# title: Add the field name to attribute map
|
||||||
|
# description: The attribute map serves as a global registry for field attributes. Set the
|
||||||
|
# key as the attribute name and value as an array of properties. Use the properties according to the
|
||||||
|
# your usecase. Here's a list and description of each of the properties.
|
||||||
|
# accessible: The attribute is passed to attr_accessor
|
||||||
|
# serializable: The attribute is serialized to the client
|
||||||
|
# permitted: The attribute is permitted to be passed to the admin side controller for saving
|
||||||
|
# mapped: The attribute is a mapped attributed and is permitted to be passed to the admin side controller for saving
|
||||||
|
# excluded: The attribute is not initialized in the constructor. This is used
|
||||||
|
# if the attribute needs a method
|
||||||
|
##
|
||||||
|
|
||||||
def self.attribute_map
|
def self.attribute_map
|
||||||
{
|
{
|
||||||
raw: [],
|
raw: [],
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
##
|
|
||||||
# type: step
|
|
||||||
# number: 8
|
|
||||||
# title: Add it to the serializer
|
|
||||||
# description: We want our new attribute to be serialized to the wizard client...
|
|
||||||
##
|
|
||||||
class CustomWizard::FieldSerializer < ::ApplicationSerializer
|
class CustomWizard::FieldSerializer < ::ApplicationSerializer
|
||||||
|
|
||||||
attributes *CustomWizard::Field.serializable_attributes
|
attributes *CustomWizard::Field.serializable_attributes
|
||||||
|
|
Laden …
In neuem Issue referenzieren