Sha256: affe94b38c33c208ca12740565dcfc69ed6093450016e2313ef6b10803bad5ac

Contents?: true

Size: 1.04 KB

Versions: 9

Compression:

Stored size: 1.04 KB

Contents

class TempusDominusInput < SimpleForm::Inputs::Base
  def input(wrapper_options)

    template.content_tag(: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

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

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

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

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
kono_utils_bootstrap_view4-0.3.2 app/inputs/tempus_dominus_input.rb
kono_utils_bootstrap_view4-0.3.1 app/inputs/tempus_dominus_input.rb
kono_utils_bootstrap_view4-0.3 app/inputs/tempus_dominus_input.rb
kono_utils_bootstrap_view4-0.2.3 app/inputs/tempus_dominus_input.rb
kono_utils_bootstrap_view4-0.2.2 app/inputs/tempus_dominus_input.rb
kono_utils_bootstrap_view4-0.2.1 app/inputs/tempus_dominus_input.rb
kono_utils_bootstrap_view4-0.2 app/inputs/tempus_dominus_input.rb
kono_utils_bootstrap_view4-0.1.2 app/inputs/tempus_dominus_input.rb
kono_utils_bootstrap_view4-0.1.1 app/inputs/tempus_dominus_input.rb