Class: TempusDominusInput

Inherits:
SimpleForm::Inputs::Base
  • Object
show all
Defined in:
app/inputs/tempus_dominus_input.rb

Instance Method Summary collapse

Instance Method Details

#div_buttonObject



19
20
21
22
23
# File 'app/inputs/tempus_dominus_input.rb', line 19

def div_button
  template.(:div, class: 'input-group-append', data: {target: "##{options[:date_time_picker_identifier]}", toggle: 'datetimepicker'}) do
    span_table
  end
end

#icon_removeObject



31
32
33
# File 'app/inputs/tempus_dominus_input.rb', line 31

def icon_remove
  "<i class='glyphicon glyphicon-remove'></i>".html_safe
end

#icon_tableObject



35
36
37
# File 'app/inputs/tempus_dominus_input.rb', line 35

def icon_table
  "<i class='fa fa-calendar'></i>".html_safe
end

#input(wrapper_options) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
# File 'app/inputs/tempus_dominus_input.rb', line 2

def input(wrapper_options)

  template.(:div, class: "input-group date #{ has_errors? ? 'is-invalid' : ''}", data: { target_input: 'nearest'}, id: options[:date_time_picker_identifier]) do

    tmp = ActiveSupport::SafeBuffer.new
    merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
    tmp << @builder.text_field(attribute_name, merged_input_options)
    tmp << div_button

    tmp
  end
end

#input_html_optionsObject



15
16
17
# File 'app/inputs/tempus_dominus_input.rb', line 15

def input_html_options
  super.merge({class: 'form-control datetimepicker-input'})
end

#span_tableObject



25
26
27
28
29
# File 'app/inputs/tempus_dominus_input.rb', line 25

def span_table
  template.(:div, class: 'input-group-text') do
    icon_table
  end
end