Class: TabularFormBuilder
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- TabularFormBuilder
- Includes:
- Redmine::I18n
- Defined in:
- lib/tabular_form_builder.rb
Instance Method Summary (collapse)
-
- (TabularFormBuilder) initialize(object_name, object, template, options, proc)
constructor
A new instance of TabularFormBuilder.
-
- (Object) label_for_field(field, options = {})
Returns a label tag for the given field.
- - (Object) select(field, choices, options = {}, html_options = {})
Methods included from Redmine::I18n
#current_language, #day_name, #find_language, #format_date, #format_time, included, #l, #l_hours, #l_or_humanize, #ll, #month_name, #set_language_if_valid, #valid_languages
Constructor Details
- (TabularFormBuilder) initialize(object_name, object, template, options, proc)
A new instance of TabularFormBuilder
20 21 22 23 |
# File 'lib/tabular_form_builder.rb', line 20 def initialize(object_name, object, template, , proc) set_language_if_valid .delete(:lang) super end |
Instance Method Details
- (Object) label_for_field(field, options = {})
Returns a label tag for the given field
39 40 41 42 43 44 45 46 |
# File 'lib/tabular_form_builder.rb', line 39 def label_for_field(field, = {}) return '' if .delete(:no_label) text = [:label].is_a?(Symbol) ? l([:label]) : [:label] text ||= l(("field_" + field.to_s.gsub(/\_id$/, "")).to_sym) text += @template.content_tag("span", " *", :class => "required") if .delete(:required) @template.label(@object_name, field.to_s, text, :class => (@object && @object.errors[field] ? "error" : nil)) end |
- (Object) select(field, choices, options = {}, html_options = {})
34 35 36 |
# File 'lib/tabular_form_builder.rb', line 34 def select(field, choices, = {}, = {}) label_for_field(field, ) + super end |