Class: Voom::Presenters::DSL::Components::DatetimeBase

Inherits:
TextField show all
Defined in:
lib/voom/presenters/dsl/components/datetime_base.rb

Direct Known Subclasses

DateField, DatetimeField, TimeField

Constant Summary

Constants inherited from TextField

TextField::VALID_CASE_TYPES

Instance Attribute Summary collapse

Attributes inherited from TextField

#auto_complete, #behavior, #case_type, #full_width, #required

Attributes inherited from Input

#dirtyable, #disabled, #name

Attributes inherited from EventBase

#event_parent_id

Attributes included from Mixins::Event

#events

Attributes inherited from Base

#attributes, #css_class, #draggable, #drop_zone, #id, #tag, #type

Instance Method Summary collapse

Methods inherited from TextField

#hint, #icon, #label, #pattern, #value

Methods inherited from Input

#validation_error

Methods included from Mixins::Tooltips

#tooltip

Methods included from Mixins::Event

#event

Methods inherited from Base

#expand!

Methods included from Pluggable

#include_plugins, #plugin, #plugin_module

Methods included from Mixins::YieldTo

#yield_to

Methods included from Serializer

#to_hash

Methods included from Lockable

#locked?

Constructor Details

#initialize(**attribs_, &block) ⇒ DatetimeBase

Returns a new instance of DatetimeBase.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 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

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



6
7
8
# File 'lib/voom/presenters/dsl/components/datetime_base.rb', line 6

def config
  @config
end

#pickerObject (readonly)

Returns the value of attribute picker.



6
7
8
# File 'lib/voom/presenters/dsl/components/datetime_base.rb', line 6

def picker
  @picker
end

Instance Method Details

#clear_icon(icon = nil, **attribs, &block) ⇒ Object



25
26
27
28
29
# 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