231 |
231 |
|
232 |
232 |
def column_content(column, item)
|
233 |
233 |
value = column.value_object(item)
|
234 |
|
if value.is_a?(Array)
|
235 |
|
values = value.collect {|v| column_value(column, item, v)}.compact
|
236 |
|
safe_join(values, ', ')
|
237 |
|
else
|
238 |
|
column_value(column, item, value)
|
239 |
|
end
|
|
234 |
content =
|
|
235 |
if value.is_a?(Array)
|
|
236 |
values = value.collect {|v| column_value(column, item, v)}.compact
|
|
237 |
safe_join(values, ', ')
|
|
238 |
else
|
|
239 |
column_value(column, item, value)
|
|
240 |
end
|
|
241 |
|
|
242 |
call_hook(:helper_queries_column_content,
|
|
243 |
{:content => content, :column => column, :item => item})
|
|
244 |
|
|
245 |
content
|
240 |
246 |
end
|
241 |
247 |
|
242 |
248 |
def column_value(column, item, value)
|
243 |
|
case column.name
|
244 |
|
when :id
|
245 |
|
link_to value, issue_path(item)
|
246 |
|
when :subject
|
247 |
|
link_to value, issue_path(item)
|
248 |
|
when :parent
|
249 |
|
value ? (value.visible? ? link_to_issue(value, :subject => false) : "##{value.id}") : ''
|
250 |
|
when :description
|
251 |
|
item.description? ? content_tag('div', textilizable(item, :description), :class => "wiki") : ''
|
252 |
|
when :last_notes
|
253 |
|
item.last_notes.present? ? content_tag('div', textilizable(item, :last_notes), :class => "wiki") : ''
|
254 |
|
when :done_ratio
|
255 |
|
progress_bar(value)
|
256 |
|
when :relations
|
257 |
|
content_tag(
|
258 |
|
'span',
|
259 |
|
value.to_s(item) {|other| link_to_issue(other, :subject => false, :tracker => false)}.html_safe,
|
260 |
|
:class => value.css_classes_for(item))
|
261 |
|
when :hours, :estimated_hours, :total_estimated_hours
|
262 |
|
format_hours(value)
|
263 |
|
when :spent_hours
|
264 |
|
link_to_if(value > 0, format_hours(value), project_time_entries_path(item.project, :issue_id => "#{item.id}"))
|
265 |
|
when :total_spent_hours
|
266 |
|
link_to_if(value > 0, format_hours(value), project_time_entries_path(item.project, :issue_id => "~#{item.id}"))
|
267 |
|
when :attachments
|
268 |
|
value.to_a.map {|a| format_object(a)}.join(" ").html_safe
|
269 |
|
else
|
270 |
|
format_object(value)
|
271 |
|
end
|
|
249 |
content =
|
|
250 |
case column.name
|
|
251 |
when :id
|
|
252 |
link_to value, issue_path(item)
|
|
253 |
when :subject
|
|
254 |
link_to value, issue_path(item)
|
|
255 |
when :parent
|
|
256 |
value ? (value.visible? ? link_to_issue(value, :subject => false) : "##{value.id}") : ''
|
|
257 |
when :description
|
|
258 |
item.description? ? content_tag('div', textilizable(item, :description), :class => "wiki") : ''
|
|
259 |
when :last_notes
|
|
260 |
item.last_notes.present? ? content_tag('div', textilizable(item, :last_notes), :class => "wiki") : ''
|
|
261 |
when :done_ratio
|
|
262 |
progress_bar(value)
|
|
263 |
when :relations
|
|
264 |
content_tag(
|
|
265 |
'span',
|
|
266 |
value.to_s(item) {|other| link_to_issue(other, :subject => false, :tracker => false)}.html_safe,
|
|
267 |
:class => value.css_classes_for(item))
|
|
268 |
when :hours, :estimated_hours, :total_estimated_hours
|
|
269 |
format_hours(value)
|
|
270 |
when :spent_hours
|
|
271 |
link_to_if(value > 0, format_hours(value), project_time_entries_path(item.project, :issue_id => "#{item.id}"))
|
|
272 |
when :total_spent_hours
|
|
273 |
link_to_if(value > 0, format_hours(value), project_time_entries_path(item.project, :issue_id => "~#{item.id}"))
|
|
274 |
when :attachments
|
|
275 |
value.to_a.map {|a| format_object(a)}.join(" ").html_safe
|
|
276 |
else
|
|
277 |
format_object(value)
|
|
278 |
end
|
|
279 |
|
|
280 |
call_hook(:helper_queries_column_value,
|
|
281 |
{:content => content, :column => column, :item => item, :value => value})
|
|
282 |
|
|
283 |
content
|
272 |
284 |
end
|
273 |
285 |
|
274 |
286 |
def csv_content(column, item)
|