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.



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

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.



6
7
8
# File 'lib/tao_form/components/moment_picker/base.rb', line 6

def block_for_render
  @block_for_render
end

#list_optionsObject (readonly)

Returns the value of attribute list_options.



6
7
8
# File 'lib/tao_form/components/moment_picker/base.rb', line 6

def list_options
  @list_options
end

#result_optionsObject (readonly)

Returns the value of attribute result_options.



6
7
8
# File 'lib/tao_form/components/moment_picker/base.rb', line 6

def result_options
  @result_options
end

Instance Method Details

#default_segmentObject



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

def default_segment
  # to be implemented
end

#input_typeObject



15
16
17
# File 'lib/tao_form/components/moment_picker/base.rb', line 15

def input_type
  # to be implemented
end

#placeholderObject



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

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

#render(&block) ⇒ Object



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

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

#render_resultObject



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

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

#render_segment_listObject



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

def render_segment_list
  view.tao_moment_picker_segment_list list_options
end

#segmentsObject



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

def segments
  # to be implemented
end