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



12
13
14
15
16
# 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
  init_list_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

#list_optionsObject (readonly)

Returns the value of attribute list_options.



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

def list_options
  @list_options
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



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

def default_segment
  # to be implemented
end

#input_typeObject



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

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



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

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

#render_resultObject



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

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

#render_segment_listObject



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

def render_segment_list
  view.tao_moment_picker_segment_list list_options
end

#segmentsObject



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

def segments
  # to be implemented
end