class Voom::Presenters::DSL::Components::DatetimeBase
Attributes
config[R]
picker[R]
Public Class Methods
new(**attribs_, &block)
click to toggle source
Calls superclass method
# File lib/voom/presenters/dsl/components/datetime_base.rb, line 8 def initialize(**attribs_, &block) super(**attribs_, &block) @config = {} map_config(:format, :alt_format, true) merge_config(:disable) merge_config(:enable) merge_config(:mode) @picker = attribs_.delete(:picker){ true } my_id = self.id clear_icon(:clear) do event :click do clear my_id end end end
Public Instance Methods
clear_icon(icon=nil, **attribs, &block)
click to toggle source
# File lib/voom/presenters/dsl/components/datetime_base.rb, line 25 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 Instance Methods
map_config(attrib, new_attrib, default=false)
click to toggle source
# File lib/voom/presenters/dsl/components/datetime_base.rb, line 37 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
merge_config(attrib, default=false)
click to toggle source
# File lib/voom/presenters/dsl/components/datetime_base.rb, line 32 def merge_config(attrib, default=false) attrib_value = attribs.delete(attrib) {default ? default(attrib) : nil} @config.merge!({attrib => attrib_value}) if attrib_value end