Class: Redmine::FieldFormat::DateFormat
Overview
Instance Method Summary
collapse
-
#bulk_edit_tag(view, tag_id, tag_name, custom_field, objects, value, options = {}) ⇒ Object
-
#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
-
#query_filter_options(custom_field, query) ⇒ Object
-
#validate_single_value(custom_field, value, customized = nil) ⇒ Object
Methods inherited from Base
#after_save_custom_value, #before_custom_field_save, #cast_custom_value, #cast_value, field_attributes, #formatted_custom_value, #formatted_value, #join_for_order_statement, #label, #name, #order_statement, #possible_custom_value_options, #possible_values_options, #set_custom_field_value, #target_class, #validate_custom_field, #validate_custom_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, #l, #l_hours, #l_hours_short, #l_or_humanize, #languages_options, #ll, #lu, #month_name, #set_language_if_valid, #valid_languages
Instance Method Details
#bulk_edit_tag(view, tag_id, tag_name, custom_field, objects, value, options = {}) ⇒ Object
545
546
547
548
549
|
# File 'lib/redmine/field_format.rb', line 545
def bulk_edit_tag(view, tag_id, tag_name, custom_field, objects, value, options={})
view.date_field_tag(tag_name, value, options.merge(:id => tag_id, :size => 10)) +
view.calendar_for(tag_id) +
bulk_clear_tag(view, tag_id, tag_name, custom_field, value)
end
|
#cast_single_value(custom_field, value, customized = nil) ⇒ Object
528
529
530
|
# File 'lib/redmine/field_format.rb', line 528
def cast_single_value(custom_field, value, customized=nil)
value.to_date rescue nil
end
|
#edit_tag(view, tag_id, tag_name, custom_value, options = {}) ⇒ Object
540
541
542
543
|
# File 'lib/redmine/field_format.rb', line 540
def edit_tag(view, tag_id, tag_name, custom_value, options={})
view.date_field_tag(tag_name, custom_value.value, options.merge(:id => tag_id, :size => 10)) +
view.calendar_for(tag_id)
end
|
#group_statement(custom_field) ⇒ Object
555
556
557
|
# File 'lib/redmine/field_format.rb', line 555
def group_statement(custom_field)
order_statement(custom_field)
end
|
#query_filter_options(custom_field, query) ⇒ Object
551
552
553
|
# File 'lib/redmine/field_format.rb', line 551
def query_filter_options(custom_field, query)
{:type => :date}
end
|
#validate_single_value(custom_field, value, customized = nil) ⇒ Object
532
533
534
535
536
537
538
|
# File 'lib/redmine/field_format.rb', line 532
def validate_single_value(custom_field, value, customized=nil)
if value =~ /^\d{4}-\d{2}-\d{2}$/ && (value.to_date rescue false)
[]
else
[::I18n.t('activerecord.errors.messages.not_a_date')]
end
end
|