Last active
August 29, 2015 13:56
-
-
Save nacengineer/8944861 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class DateTimePickerInput < SimpleForm::Inputs::Base | |
| def input | |
| template.content_tag(:div, class: 'input-group date form_datetime') do | |
| template.concat @builder.text_field(attribute_name, input_html_options) | |
| template.concat span_remove | |
| template.concat span_table | |
| end | |
| end | |
| private | |
| def input_html_options | |
| {class: 'form-control', readonly: true} | |
| end | |
| def span_remove | |
| template.content_tag(:span, class: 'input-group-addon') do | |
| template.concat icon_remove | |
| end | |
| end | |
| def span_table | |
| template.content_tag(:span, class: 'input-group-addon') do | |
| template.concat icon_table | |
| end | |
| end | |
| def icon_remove | |
| "<i class='glyphicon glyphicon-remove'></i>".html_safe | |
| end | |
| def icon_table | |
| "<i class='glyphicon glyphicon-th'></i>".html_safe | |
| end | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
add to simple form via app/inputs/date_time_picker_input.rb
call in simple form with as: :date_time_picker