Class: Redmine::FieldFormat::BoolFormat
- Inherits:
-
List
- Object
- Base
- List
- Redmine::FieldFormat::BoolFormat
show all
- Defined in:
- lib/redmine/field_format.rb
Instance Method Summary
collapse
-
#cast_single_value(custom_field, value, customized = nil) ⇒ Object
-
#edit_tag(view, tag_id, tag_name, custom_value, options = {}) ⇒ Object
-
#group_statement(custom_field) ⇒ Object
-
#label ⇒ Object
-
#possible_values_options(custom_field, object = nil) ⇒ Object
-
#single_check_box_edit_tag(view, tag_id, tag_name, custom_value, options = {}) ⇒ Object
Renders the edit tag as a simple check box.
Methods inherited from List
#bulk_edit_tag, #query_filter_options
Methods inherited from Base
#after_save_custom_value, #before_custom_field_save, #bulk_edit_tag, #cast_custom_value, #cast_value, field_attributes, #formatted_custom_value, #formatted_value, #join_for_order_statement, #name, #order_statement, #possible_custom_value_options, #query_filter_options, #set_custom_field_value, #target_class, #validate_custom_field, #validate_custom_value, #validate_single_value, #value_from_keyword
#uri_with_safe_scheme?
Methods included from I18n
#current_language, #day_letter, #day_name, #find_language, #format_date, #format_hours, #format_time, included, #l, #l_hours, #l_hours_short, #l_or_humanize, #languages_options, #ll, #lu, #month_name, #set_language_if_valid, #valid_languages
Instance Method Details
#cast_single_value(custom_field, value, customized = nil) ⇒ Object
659
660
661
|
# File 'lib/redmine/field_format.rb', line 659
def cast_single_value(custom_field, value, customized=nil)
value == '1' ? true : false
end
|
#edit_tag(view, tag_id, tag_name, custom_value, options = {}) ⇒ Object
671
672
673
674
675
676
677
678
679
680
|
# File 'lib/redmine/field_format.rb', line 671
def edit_tag(view, tag_id, tag_name, custom_value, options={})
case custom_value.custom_field.edit_tag_style
when 'check_box'
single_check_box_edit_tag(view, tag_id, tag_name, custom_value, options)
when 'radio'
check_box_edit_tag(view, tag_id, tag_name, custom_value, options)
else
select_edit_tag(view, tag_id, tag_name, custom_value, options)
end
end
|
#group_statement(custom_field) ⇒ Object
667
668
669
|
# File 'lib/redmine/field_format.rb', line 667
def group_statement(custom_field)
order_statement(custom_field)
end
|
#label ⇒ Object
655
656
657
|
# File 'lib/redmine/field_format.rb', line 655
def label
"label_boolean"
end
|
#possible_values_options(custom_field, object = nil) ⇒ Object
663
664
665
|
# File 'lib/redmine/field_format.rb', line 663
def possible_values_options(custom_field, object=nil)
[[::I18n.t(:general_text_Yes), '1'], [::I18n.t(:general_text_No), '0']]
end
|
#single_check_box_edit_tag(view, tag_id, tag_name, custom_value, options = {}) ⇒ Object
Renders the edit tag as a simple check box
683
684
685
686
687
688
|
# File 'lib/redmine/field_format.rb', line 683
def single_check_box_edit_tag(view, tag_id, tag_name, custom_value, options={})
s = ''.html_safe
s << view.hidden_field_tag(tag_name, '0', :id => nil)
s << view.check_box_tag(tag_name, '1', custom_value.value.to_s == '1', :id => tag_id)
view.content_tag('span', s, options)
end
|