Class: TaoForm::Components::MomentPicker::Base

Inherits:
FieldComponent
  • Object
show all
Defined in:
lib/tao_form/components/moment_picker/base.rb

Instance Attribute Summary collapse

Attributes inherited from FieldComponent

#attribute_name, #builder

Instance Method Summary collapse

Constructor Details

#initialize(view, builder = nil, attribute_name = nil, options = {}) ⇒ Base

Returns a new instance of Base.



12
13
14
15
# File 'lib/tao_form/components/moment_picker/base.rb', line 12

def initialize view, builder = nil, attribute_name = nil, options = {}
  super view, builder, attribute_name, options
  init_result_options
end

Instance Attribute Details

#block_for_renderObject (readonly)

Returns the value of attribute block_for_render.



10
11
12
# File 'lib/tao_form/components/moment_picker/base.rb', line 10

def block_for_render
  @block_for_render
end

#result_optionsObject (readonly)

Returns the value of attribute result_options.



10
11
12
# File 'lib/tao_form/components/moment_picker/base.rb', line 10

def result_options
  @result_options
end

Instance Method Details

#default_segmentObject



26
27
28
# File 'lib/tao_form/components/moment_picker/base.rb', line 26

def default_segment
  # to be implemented
end

#input_typeObject



18
19
20
# File 'lib/tao_form/components/moment_picker/base.rb', line 18

def input_type
  # to be implemented
end

#placeholderObject



46
47
48
# File 'lib/tao_form/components/moment_picker/base.rb', line 46

def placeholder
  @placeholder ||= options.delete(:placeholder) || t(:placeholder)
end

#render(&block) ⇒ Object



30
31
32
33
# File 'lib/tao_form/components/moment_picker/base.rb', line 30

def render &block
  @block_for_render = block
  render_template 'moment_picker', &block
end

#render_resultObject



35
36
37
38
39
# File 'lib/tao_form/components/moment_picker/base.rb', line 35

def render_result
  view.tao_moment_picker_result(
    builder, attribute_name, result_options, &block_for_render
  )
end

#render_segment_listObject



41
42
43
44
# File 'lib/tao_form/components/moment_picker/base.rb', line 41

def render_segment_list
  view.tao_moment_picker_segment_list segments: segments,
    default_segment: default_segment
end

#segmentsObject



22
23
24
# File 'lib/tao_form/components/moment_picker/base.rb', line 22

def segments
  # to be implemented
end