Sha256: 475003b041f9df8c78bdfa76849f4a7cfe817f6af02144e1b463f485f858fa8d
Contents?: true
Size: 1.32 KB
Versions: 5
Compression:
Stored size: 1.32 KB
Contents
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, **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
5 entries across 5 versions & 1 rubygems