Mercurial > hg > soundsoftware-site
diff app/helpers/.svn/text-base/custom_fields_helper.rb.svn-base @ 441:cbce1fd3b1b7 redmine-1.2
Update to Redmine 1.2-stable branch (Redmine SVN rev 6000)
author | Chris Cannam |
---|---|
date | Mon, 06 Jun 2011 14:24:13 +0100 |
parents | 8661b858af72 |
children |
line wrap: on
line diff
--- a/app/helpers/.svn/text-base/custom_fields_helper.rb.svn-base Thu Mar 03 11:42:28 2011 +0000 +++ b/app/helpers/.svn/text-base/custom_fields_helper.rb.svn-base Mon Jun 06 14:24:13 2011 +0100 @@ -1,5 +1,5 @@ -# redMine - project management software -# Copyright (C) 2006 Jean-Philippe Lang +# Redmine - project management software +# Copyright (C) 2006-2011 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -37,7 +37,7 @@ field_id = "#{name}_custom_field_values_#{custom_field.id}" field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format) - case field_format.edit_as + case field_format.try(:edit_as) when "date" text_field_tag(field_name, custom_value.value, :id => field_id, :size => 10) + calendar_for(field_id) @@ -49,7 +49,7 @@ blank_option = custom_field.is_required? ? (custom_field.default_value.blank? ? "<option value=\"\">--- #{l(:actionview_instancetag_blank_option)} ---</option>" : '') : '<option></option>' - select_tag(field_name, blank_option + options_for_select(custom_field.possible_values, custom_value.value), :id => field_id) + select_tag(field_name, blank_option + options_for_select(custom_field.possible_values_options(custom_value.customized), custom_value.value), :id => field_id) else text_field_tag(field_name, custom_value.value, :id => field_id) end @@ -68,11 +68,11 @@ custom_field_label_tag(name, custom_value) + custom_field_tag(name, custom_value) end - def custom_field_tag_for_bulk_edit(name, custom_field) + def custom_field_tag_for_bulk_edit(name, custom_field, projects=nil) field_name = "#{name}[custom_field_values][#{custom_field.id}]" field_id = "#{name}_custom_field_values_#{custom_field.id}" field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format) - case field_format.edit_as + case field_format.try(:edit_as) when "date" text_field_tag(field_name, '', :id => field_id, :size => 10) + calendar_for(field_id) @@ -83,7 +83,7 @@ [l(:general_text_yes), '1'], [l(:general_text_no), '0']]), :id => field_id) when "list" - select_tag(field_name, options_for_select([[l(:label_no_change_option), '']] + custom_field.possible_values), :id => field_id) + select_tag(field_name, options_for_select([[l(:label_no_change_option), '']] + custom_field.possible_values_options(projects)), :id => field_id) else text_field_tag(field_name, '', :id => field_id) end @@ -101,8 +101,8 @@ end # Return an array of custom field formats which can be used in select_tag - def custom_field_formats_for_select - Redmine::CustomFieldFormat.as_select + def custom_field_formats_for_select(custom_field) + Redmine::CustomFieldFormat.as_select(custom_field.class.customized_class.name) end # Renders the custom_values in api views