lib/ecoportal/api/v2/page/component/selection_field.rb in ecoportal-api-oozes-0.7.2 vs lib/ecoportal/api/v2/page/component/selection_field.rb in ecoportal-api-oozes-0.7.3
- old
+ new
@@ -2,11 +2,12 @@
module API
class V2
class Page
class Component
class SelectionField < Page::Component
- passthrough :multiple, :other, :other_desc
+ passthrough :multiple, :flat
+ passthrough :other, :other_desc
#class_resolver :selection_option_class, "Ecoportal::API::V2::Page::Component::SelectionOption"
embeds_multiple :options, klass: "Ecoportal::API::V2::Page::Component::SelectionOption", order_key: :weight
def select(value)
@@ -31,10 +32,9 @@
else
selected&.value
end
end
- # a server bug prevents to add new options to an existing field
def add_option(name:, value:, pos: NOT_USED, before: NOT_USED, after: NOT_USED)
opt_doc = Ecoportal::API::V2::Page::Component::SelectionOption.new_doc
options.upsert!(opt_doc, pos: pos, before: before, after: after) do |option|
option.name = name
option.value = value