class Ecoportal::API::V2::Page::Component::ReferenceField
Public Instance Methods
configure(*conf)
click to toggle source
Quick config helper @param conf [Symbol, Array<Symbol>]
- `:show_fields` specify if the public register fields should be shown (requires `register_id`) - `:create` specify if the `NEW` button should appear - `:attach` specify if the `ATTACH` button should appear - `:metadata` specify if `metadata` should be shown (i.e. status)
Calls superclass method
Ecoportal::API::V2::Page::Component#configure
# File lib/ecoportal/api/v2/page/component/reference_field.rb, line 18 def configure(*conf) conf.each_with_object([]) do |cnf, unused| case cnf when :show_fields self.display_fields = true self.display_fields_in_lookup = true when Hash supported = [:create, :attach, :metadata] unless (rest = hash_except(cnf.dup, *supported)).empty? unused.push(rest) end if cnf.key?(:create) then self.hide_create = !cnf[:create] end if cnf.key?(:attach) then self.hide_attach = !cnf[:attach] end if cnf.key?(:metadata) then self.hide_metadata = !cnf[:metadata] end else unused.push(cnf) end end.yield_self do |unused| super(*unused) end end