dynamically generate permitted params for admin wizard save
Dieser Commit ist enthalten in:
Ursprung
ce705d32da
Commit
f9f67c09e8
2 geänderte Dateien mit 22 neuen und 36 gelöschten Zeilen
|
@ -102,26 +102,10 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController
|
|||
permitted_params: mapped_params,
|
||||
condition: mapped_params,
|
||||
fields: [
|
||||
:id,
|
||||
:index,
|
||||
:label,
|
||||
:image,
|
||||
:description,
|
||||
:required,
|
||||
:key,
|
||||
:type,
|
||||
:min_length,
|
||||
:max_length,
|
||||
:char_counter,
|
||||
:file_types,
|
||||
:format,
|
||||
:limit,
|
||||
:property,
|
||||
prefill: mapped_params,
|
||||
content: mapped_params,
|
||||
condition: mapped_params,
|
||||
index: mapped_params,
|
||||
validations: {},
|
||||
*CustomWizard::Field.type_attributes(:permitted),
|
||||
CustomWizard::Field.type_attributes(:mapped).map do |attribute|
|
||||
[attribute, mapped_params]
|
||||
end.to_h
|
||||
]
|
||||
],
|
||||
actions: [
|
||||
|
|
|
@ -6,27 +6,29 @@ class CustomWizard::Field
|
|||
def self.attribute_map
|
||||
{
|
||||
raw: [],
|
||||
id: [:serializable],
|
||||
index: [:accessible, :serializable],
|
||||
type: [:serializable],
|
||||
id: [:serializable, :permitted],
|
||||
index: [:accessible, :serializable, :permitted, :mapped],
|
||||
type: [:serializable, :permitted],
|
||||
step: [:accessible],
|
||||
required: [:serializable],
|
||||
required: [:serializable, :permitted],
|
||||
value: [:serializable],
|
||||
description: [:serializable],
|
||||
image: [:serializable],
|
||||
key: [],
|
||||
description: [:serializable, :permitted],
|
||||
image: [:serializable, :permitted],
|
||||
key: [:permitted],
|
||||
validations: [:serializable],
|
||||
min_length: [],
|
||||
max_length: [:serializable],
|
||||
char_counter: [:serializable],
|
||||
file_types: [:serializable],
|
||||
format: [:serializable],
|
||||
limit: [:serializable],
|
||||
property: [:serializable],
|
||||
content: [:serializable],
|
||||
min_length: [:permitted],
|
||||
max_length: [:serializable, :permitted],
|
||||
char_counter: [:serializable, :permitted],
|
||||
file_types: [:serializable, :permitted],
|
||||
format: [:serializable, :permitted],
|
||||
limit: [:serializable, :permitted],
|
||||
property: [:serializable, :permitted],
|
||||
# label is excluded so that it isn't initialized and the value
|
||||
# returned by `label` method is used for serialization
|
||||
label: [:excluded, :serializable]
|
||||
label: [:excluded, :serializable, :permitted],
|
||||
content: [:serializable, :permitted, :mapped],
|
||||
prefill: [:permitted, :mapped],
|
||||
condition: [:permitted, :mapped],
|
||||
}
|
||||
end
|
||||
|
||||
|
|
Laden …
In neuem Issue referenzieren