Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-15 22:32:54 +01:00
specify serializable attributes in field model
Dieser Commit ist enthalten in:
Ursprung
442f096940
Commit
4b559fb74e
2 geänderte Dateien mit 44 neuen und 38 gelöschten Zeilen
|
@ -4,27 +4,27 @@ class CustomWizard::Field
|
||||||
include ActiveModel::SerializerSupport
|
include ActiveModel::SerializerSupport
|
||||||
|
|
||||||
def self.attributes
|
def self.attributes
|
||||||
%i{
|
%i{
|
||||||
raw
|
raw
|
||||||
id
|
id
|
||||||
index
|
index
|
||||||
type
|
type
|
||||||
step
|
step
|
||||||
required
|
required
|
||||||
value
|
value
|
||||||
description
|
description
|
||||||
image
|
image
|
||||||
key
|
key
|
||||||
validations
|
validations
|
||||||
min_length
|
min_length
|
||||||
max_length
|
max_length
|
||||||
char_counter
|
char_counter
|
||||||
file_types
|
file_types
|
||||||
format
|
format
|
||||||
limit
|
limit
|
||||||
property
|
property
|
||||||
content
|
content
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.accessible_attributes
|
def self.accessible_attributes
|
||||||
|
@ -44,6 +44,28 @@ class CustomWizard::Field
|
||||||
attributes - accessible_attributes - excluded_attributes
|
attributes - accessible_attributes - excluded_attributes
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.serializable_attributes
|
||||||
|
%i{
|
||||||
|
id
|
||||||
|
index
|
||||||
|
type
|
||||||
|
required
|
||||||
|
value
|
||||||
|
label
|
||||||
|
placeholder
|
||||||
|
description
|
||||||
|
image
|
||||||
|
file_types
|
||||||
|
format
|
||||||
|
limit
|
||||||
|
property
|
||||||
|
content
|
||||||
|
validations
|
||||||
|
max_length
|
||||||
|
char_counter
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
attr_reader *readonly_attributes
|
attr_reader *readonly_attributes
|
||||||
attr_accessor *accessible_attributes
|
attr_accessor *accessible_attributes
|
||||||
|
|
||||||
|
|
|
@ -8,23 +8,7 @@
|
||||||
##
|
##
|
||||||
class CustomWizard::FieldSerializer < ::ApplicationSerializer
|
class CustomWizard::FieldSerializer < ::ApplicationSerializer
|
||||||
|
|
||||||
attributes :id,
|
attributes *CustomWizard::Field.serializable_attributes
|
||||||
:index,
|
|
||||||
:type,
|
|
||||||
:required,
|
|
||||||
:value,
|
|
||||||
:label,
|
|
||||||
:placeholder,
|
|
||||||
:description,
|
|
||||||
:image,
|
|
||||||
:file_types,
|
|
||||||
:format,
|
|
||||||
:limit,
|
|
||||||
:property,
|
|
||||||
:content,
|
|
||||||
:validations,
|
|
||||||
:max_length,
|
|
||||||
:char_counter
|
|
||||||
|
|
||||||
def id
|
def id
|
||||||
object.id
|
object.id
|
||||||
|
|
Laden …
In neuem Issue referenzieren