diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index 465e79a09..a76ae9573 100644 --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -231,44 +231,56 @@ module QueriesHelper def column_content(column, item) value = column.value_object(item) - if value.is_a?(Array) - values = value.collect {|v| column_value(column, item, v)}.compact - safe_join(values, ', ') - else - column_value(column, item, value) - end + content = + if value.is_a?(Array) + values = value.collect {|v| column_value(column, item, v)}.compact + safe_join(values, ', ') + else + column_value(column, item, value) + end + + call_hook(:helper_queries_column_content, + {:content => content, :column => column, :item => item}) + + content end def column_value(column, item, value) - case column.name - when :id - link_to value, issue_path(item) - when :subject - link_to value, issue_path(item) - when :parent - value ? (value.visible? ? link_to_issue(value, :subject => false) : "##{value.id}") : '' - when :description - item.description? ? content_tag('div', textilizable(item, :description), :class => "wiki") : '' - when :last_notes - item.last_notes.present? ? content_tag('div', textilizable(item, :last_notes), :class => "wiki") : '' - when :done_ratio - progress_bar(value) - when :relations - content_tag( - 'span', - value.to_s(item) {|other| link_to_issue(other, :subject => false, :tracker => false)}.html_safe, - :class => value.css_classes_for(item)) - when :hours, :estimated_hours, :total_estimated_hours - format_hours(value) - when :spent_hours - link_to_if(value > 0, format_hours(value), project_time_entries_path(item.project, :issue_id => "#{item.id}")) - when :total_spent_hours - link_to_if(value > 0, format_hours(value), project_time_entries_path(item.project, :issue_id => "~#{item.id}")) - when :attachments - value.to_a.map {|a| format_object(a)}.join(" ").html_safe - else - format_object(value) - end + content = + case column.name + when :id + link_to value, issue_path(item) + when :subject + link_to value, issue_path(item) + when :parent + value ? (value.visible? ? link_to_issue(value, :subject => false) : "##{value.id}") : '' + when :description + item.description? ? content_tag('div', textilizable(item, :description), :class => "wiki") : '' + when :last_notes + item.last_notes.present? ? content_tag('div', textilizable(item, :last_notes), :class => "wiki") : '' + when :done_ratio + progress_bar(value) + when :relations + content_tag( + 'span', + value.to_s(item) {|other| link_to_issue(other, :subject => false, :tracker => false)}.html_safe, + :class => value.css_classes_for(item)) + when :hours, :estimated_hours, :total_estimated_hours + format_hours(value) + when :spent_hours + link_to_if(value > 0, format_hours(value), project_time_entries_path(item.project, :issue_id => "#{item.id}")) + when :total_spent_hours + link_to_if(value > 0, format_hours(value), project_time_entries_path(item.project, :issue_id => "~#{item.id}")) + when :attachments + value.to_a.map {|a| format_object(a)}.join(" ").html_safe + else + format_object(value) + end + + call_hook(:helper_queries_column_value, + {:content => content, :column => column, :item => item, :value => value}) + + content end def csv_content(column, item)