Class: DatePairInput
- Inherits:
-
SimpleForm::Inputs::Base
- Object
- SimpleForm::Inputs::Base
- DatePairInput
- Defined in:
- app/inputs/date_pair_input.rb
Overview
Copyright © 2008-2013 Michael Dvorkin and contributors.
Fat Free CRM is freely distributable under the terms of MIT license. See MIT-LICENSE file or www.opensource.org/licenses/mit-license.php
Direct Known Subclasses
Instance Method Summary collapse
-
#input(wrapper_options) ⇒ Object
Output two date fields: start and end ——————————————————————————.
Instance Method Details
#input(wrapper_options) ⇒ Object
Output two date fields: start and end
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/inputs/date_pair_input.rb', line 11 def input() add_autocomplete! out = "<br />".html_safe field1, field2 = get_fields [field1, field2].compact.each do |field| out << '<div>'.html_safe label = field == field1 ? I18n.t('pair.start') : I18n.t('pair.end') %i[required disabled].each { |k| .delete(k) } # ensure these come from field not default options .merge!(field.) [:value] = value(field) out << "<label#{' class="req"' if [:required]}>#{label}</label>".html_safe text = @builder.text_field(field.name, (, )) out << text << '</div>'.html_safe end out end |