Sha256: 1f52c5a78d8831e086fd625d13a2b14dfe568ce7c6aa0213cf8e4783de7a7215
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
require 'voom/presenters/dsl/components/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, **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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
voom-presenters-0.2.0 | lib/voom/presenters/dsl/components/datetime_base.rb |