Sha256: 2e271710f67657f37da0f4b7e7ca1bc224bb09ff8270d179cc057b578362ff02
Contents?: true
Size: 783 Bytes
Versions: 8
Compression:
Stored size: 783 Bytes
Contents
module Avo module Fields class SelectField < Field def initialize(name, **args, &block) @defaults = { sortable: true, component: 'select-field', } super(name, **args, &block) @options = args[:options].present? ? args[:options] : {} @enum = args[:enum].present? ? args[:enum] : nil @display_value = args[:display_value].present? ? args[:display_value] : false @placeholder = args[:placeholder].present? ? args[:placeholder].to_s : 'Choose an option' end def hydrate_field(fields, model, resource, view) { options: @options, enum: @enum, display_value: @display_value, placeholder: @placeholder, } end end end end
Version data entries
8 entries across 8 versions & 1 rubygems