Sha256: 8669c837cab8185f997c9b6b54980d0b2f3ccecc404b430184c335936f9a4272
Contents?: true
Size: 1.42 KB
Versions: 6
Compression:
Stored size: 1.42 KB
Contents
require_relative 'text_field' module Voom module Presenters module DSL module Components class DatetimeBase < TextField attr_reader :config def initialize(**attribs_, &block) super(**attribs_, &block) @config = {} map_config(:format, :alt_format, true) merge_config(:disable) merge_config(:enable) merge_config(:mode) my_id = self.id clear_icon(:clear) do event :click do clear my_id end end end def clear_icon(icon=nil, **attribs, &block) return @clear_icon if locked? @clear_icon = icon ? Components::Icon.new(parent: self, icon: icon, context: context, **attribs, &block) : nil end private def merge_config(attrib, default=false) attrib_value = attribs.delete(attrib) {default ? default(attrib) : nil} @config.merge!({attrib => attrib_value}) if attrib_value end def map_config(attrib, new_attrib, default=false) attrib_value = attribs.delete(attrib) {default ? default(attrib) : nil} @config.merge!({new_attrib => attrib_value}) if attrib_value end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems