summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-07-14 14:02:02 +0000
committerGo MAEDA <maeda@farend.jp>2021-07-14 14:02:02 +0000
commit9fcf5af844ec223675cee32c2c52947be2f0669f (patch)
tree645196bae3df9884698aefdc176988d6f8ad36aa /app
parentd496d8c4edd3ef5ba2c10ad2bbdd7350b09773b0 (diff)
downloadredmine-9fcf5af844ec223675cee32c2c52947be2f0669f.tar.gz
redmine-9fcf5af844ec223675cee32c2c52947be2f0669f.zip
Hooks for queries helper (#34743).
Patch by Alexander Meindl. git-svn-id: http://svn.redmine.org/redmine/trunk@21068 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/helpers/queries_helper.rb82
1 files changed, 47 insertions, 35 deletions
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)