@@ -1,55 +1,61 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | module QueriesHelper |
|
18 | module QueriesHelper | |
19 |
|
19 | |||
20 | def operators_for_select(filter_type) |
|
20 | def operators_for_select(filter_type) | |
21 | Query.operators_by_filter_type[filter_type].collect {|o| [l(Query.operators[o]), o]} |
|
21 | Query.operators_by_filter_type[filter_type].collect {|o| [l(Query.operators[o]), o]} | |
22 | end |
|
22 | end | |
23 |
|
23 | |||
24 | def column_header(column) |
|
24 | def column_header(column) | |
25 | column.sortable ? sort_header_tag(column.name.to_s, :caption => column.caption, |
|
25 | column.sortable ? sort_header_tag(column.name.to_s, :caption => column.caption, | |
26 | :default_order => column.default_order) : |
|
26 | :default_order => column.default_order) : | |
27 | content_tag('th', column.caption) |
|
27 | content_tag('th', column.caption) | |
28 | end |
|
28 | end | |
29 |
|
29 | |||
30 | def column_content(column, issue) |
|
30 | def column_content(column, issue) | |
31 | if column.is_a?(QueryCustomFieldColumn) |
|
31 | if column.is_a?(QueryCustomFieldColumn) | |
32 | cv = issue.custom_values.detect {|v| v.custom_field_id == column.custom_field.id} |
|
32 | cv = issue.custom_values.detect {|v| v.custom_field_id == column.custom_field.id} | |
33 | show_value(cv) |
|
33 | show_value(cv) | |
34 | else |
|
34 | else | |
35 | value = issue.send(column.name) |
|
35 | value = issue.send(column.name) | |
36 | if value.is_a?(Date) |
|
36 | if value.is_a?(Date) | |
37 | format_date(value) |
|
37 | format_date(value) | |
38 | elsif value.is_a?(Time) |
|
38 | elsif value.is_a?(Time) | |
39 | format_time(value) |
|
39 | format_time(value) | |
40 | else |
|
40 | else | |
41 | case column.name |
|
41 | case column.name | |
42 | when :subject |
|
42 | when :subject | |
43 | h((!@project.nil? && @project != issue.project) ? "#{issue.project.name} - " : '') + |
|
43 | h((!@project.nil? && @project != issue.project) ? "#{issue.project.name} - " : '') + | |
44 | link_to(h(value), :controller => 'issues', :action => 'show', :id => issue) |
|
44 | link_to(h(value), :controller => 'issues', :action => 'show', :id => issue) | |
|
45 | when :project | |||
|
46 | link_to(h(value), :controller => 'projects', :action => 'show', :id => value) | |||
|
47 | when :assigned_to | |||
|
48 | link_to(h(value), :controller => 'account', :action => 'show', :id => value) | |||
|
49 | when :author | |||
|
50 | link_to(h(value), :controller => 'account', :action => 'show', :id => value) | |||
45 | when :done_ratio |
|
51 | when :done_ratio | |
46 | progress_bar(value, :width => '80px') |
|
52 | progress_bar(value, :width => '80px') | |
47 | when :fixed_version |
|
53 | when :fixed_version | |
48 | link_to(h(value), { :controller => 'versions', :action => 'show', :id => issue.fixed_version_id }) |
|
54 | link_to(h(value), { :controller => 'versions', :action => 'show', :id => issue.fixed_version_id }) | |
49 | else |
|
55 | else | |
50 | h(value) |
|
56 | h(value) | |
51 | end |
|
57 | end | |
52 | end |
|
58 | end | |
53 | end |
|
59 | end | |
54 | end |
|
60 | end | |
55 | end |
|
61 | end |
General Comments 0
You need to be logged in to leave comments.
Login now