@@ -39,8 +39,7 module Redmine | |||
|
39 | 39 | |
|
40 | 40 | # Return an array of custom field formats which can be used in select_tag |
|
41 | 41 | def self.as_select(class_name=nil) |
|
42 | formats = all.values | |
|
43 | formats.select! do |format| | |
|
42 | formats = all.values.select do |format| | |
|
44 | 43 | format.class.customized_class_names.nil? || format.class.customized_class_names.include?(class_name) |
|
45 | 44 | end |
|
46 | 45 | formats.map {|format| [::I18n.t(format.label), format.name] }.sort_by(&:first) |
@@ -547,7 +546,8 module Redmine | |||
|
547 | 546 | missing = [custom_value.value_was].flatten.reject(&:blank?) - options.map(&:last) |
|
548 | 547 | if missing.any? |
|
549 | 548 | options += target_class.find_all_by_id(missing.map(&:to_i)).map {|o| [o.to_s, o.id.to_s]} |
|
550 | options.sort_by!(&:first) | |
|
549 | #TODO: use #sort_by! when ruby1.8 support is dropped | |
|
550 | options = options.sort_by(&:first) | |
|
551 | 551 | end |
|
552 | 552 | options |
|
553 | 553 | end |
General Comments 0
You need to be logged in to leave comments.
Login now