Removed hardcoded formats for right-click edit.
git-svn-id: http://svn.redmine.org/redmine/trunk@12402 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
32f782f1aa
commit
ebb8e86122
|
@ -55,12 +55,10 @@ class ContextMenusController < ApplicationController
|
|||
|
||||
@options_by_custom_field = {}
|
||||
if @can[:edit]
|
||||
custom_fields = @issues.map(&:available_custom_fields).reduce(:&).select do |f|
|
||||
%w(bool list user version).include?(f.field_format) && !f.multiple?
|
||||
end
|
||||
custom_fields = @issues.map(&:available_custom_fields).reduce(:&).reject(&:multiple?)
|
||||
custom_fields.each do |field|
|
||||
values = field.possible_values_options(@projects)
|
||||
if values.any?
|
||||
if values.present?
|
||||
@options_by_custom_field[field] = values
|
||||
end
|
||||
end
|
||||
|
|
|
@ -118,7 +118,7 @@ module Redmine
|
|||
end
|
||||
|
||||
def possible_values_options(custom_field, object=nil)
|
||||
custom_field.possible_values
|
||||
[]
|
||||
end
|
||||
|
||||
# Returns the validation errors for custom_field
|
||||
|
@ -476,7 +476,7 @@ module Redmine
|
|||
self.form_partial = 'custom_fields/formats/list'
|
||||
|
||||
def possible_custom_value_options(custom_value)
|
||||
options = super
|
||||
options = possible_values_options(custom_value.custom_field)
|
||||
missing = [custom_value.value].flatten.reject(&:blank?) - options
|
||||
if missing.any?
|
||||
options += missing
|
||||
|
@ -484,6 +484,10 @@ module Redmine
|
|||
options
|
||||
end
|
||||
|
||||
def possible_values_options(custom_field, object=nil)
|
||||
custom_field.possible_values
|
||||
end
|
||||
|
||||
def validate_custom_field(custom_field)
|
||||
errors = []
|
||||
errors << [:possible_values, :blank] if custom_field.possible_values.blank?
|
||||
|
|
Loading…
Reference in New Issue