summaryrefslogtreecommitdiffstats
path: root/app/models/query.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-04-06 11:11:52 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-04-06 11:11:52 +0000
commit22b2a1f699279b1b2b11880c77854c25114fc27c (patch)
treee2c7f3acb6f50fa7068146fdd5b10b04483a8215 /app/models/query.rb
parent5b8a96472f7148efec03954bb524fa8a10351795 (diff)
downloadredmine-22b2a1f699279b1b2b11880c77854c25114fc27c.tar.gz
redmine-22b2a1f699279b1b2b11880c77854c25114fc27c.zip
Fixed that Link custom fields are not displayed as links on the issue list (#16496).
git-svn-id: http://svn.redmine.org/redmine/trunk@13054 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/query.rb')
-rw-r--r--app/models/query.rb23
1 files changed, 19 insertions, 4 deletions
diff --git a/app/models/query.rb b/app/models/query.rb
index 449361651..206d0ab2e 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -57,6 +57,10 @@ class QueryColumn
object.send name
end
+ def value_object(object)
+ object.send name
+ end
+
def css_classes
name
end
@@ -80,10 +84,21 @@ class QueryCustomFieldColumn < QueryColumn
@cf
end
- def value(object)
+ def value_object(object)
if custom_field.visible_by?(object.project, User.current)
- cv = object.custom_values.select {|v| v.custom_field_id == @cf.id}.collect {|v| @cf.cast_value(v.value)}
- cv.size > 1 ? cv.sort {|a,b| a.to_s <=> b.to_s} : cv.first
+ cv = object.custom_values.select {|v| v.custom_field_id == @cf.id}
+ cv.size > 1 ? cv.sort {|a,b| a.value.to_s <=> b.value.to_s} : cv.first
+ else
+ nil
+ end
+ end
+
+ def value(object)
+ raw = value_object(object)
+ if raw.is_a?(Array)
+ raw.map {|r| @cf.cast_value(r.value)}
+ elsif raw
+ @cf.cast_value(raw.value)
else
nil
end
@@ -105,7 +120,7 @@ class QueryAssociationCustomFieldColumn < QueryCustomFieldColumn
@association = association
end
- def value(object)
+ def value_object(object)
if assoc = object.send(@association)
super(assoc)
end