@@ -42,6 +42,10 class QueryColumn | |||||
42 | def value(issue) |
|
42 | def value(issue) | |
43 | issue.send name |
|
43 | issue.send name | |
44 | end |
|
44 | end | |
|
45 | ||||
|
46 | def css_classes | |||
|
47 | name | |||
|
48 | end | |||
45 | end |
|
49 | end | |
46 |
|
50 | |||
47 | class QueryCustomFieldColumn < QueryColumn |
|
51 | class QueryCustomFieldColumn < QueryColumn | |
@@ -68,6 +72,10 class QueryCustomFieldColumn < QueryColumn | |||||
68 | cv = issue.custom_values.detect {|v| v.custom_field_id == @cf.id} |
|
72 | cv = issue.custom_values.detect {|v| v.custom_field_id == @cf.id} | |
69 | cv && @cf.cast_value(cv.value) |
|
73 | cv && @cf.cast_value(cv.value) | |
70 | end |
|
74 | end | |
|
75 | ||||
|
76 | def css_classes | |||
|
77 | @css_classes ||= "#{name} #{@cf.field_format}" | |||
|
78 | end | |||
71 | end |
|
79 | end | |
72 |
|
80 | |||
73 | class Query < ActiveRecord::Base |
|
81 | class Query < ActiveRecord::Base |
@@ -28,7 +28,7 | |||||
28 | <tr id="issue-<%= issue.id %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>"> |
|
28 | <tr id="issue-<%= issue.id %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>"> | |
29 | <td class="checkbox hide-when-print"><%= check_box_tag("ids[]", issue.id, false, :id => nil) %></td> |
|
29 | <td class="checkbox hide-when-print"><%= check_box_tag("ids[]", issue.id, false, :id => nil) %></td> | |
30 | <td class="id"><%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %></td> |
|
30 | <td class="id"><%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %></td> | |
31 |
<% query.columns.each do |column| %><%= content_tag 'td', column_content(column, issue), :class => column. |
|
31 | <% query.columns.each do |column| %><%= content_tag 'td', column_content(column, issue), :class => column.css_classes %><% end %> | |
32 | </tr> |
|
32 | </tr> | |
33 | <% end -%> |
|
33 | <% end -%> | |
34 | </tbody> |
|
34 | </tbody> |
@@ -127,9 +127,10 tr.project.idnt-8 td.name {padding-left: 11em;} | |||||
127 | tr.project.idnt-9 td.name {padding-left: 12.5em;} |
|
127 | tr.project.idnt-9 td.name {padding-left: 12.5em;} | |
128 |
|
128 | |||
129 | tr.issue { text-align: center; white-space: nowrap; } |
|
129 | tr.issue { text-align: center; white-space: nowrap; } | |
130 | tr.issue td.subject, tr.issue td.category, td.assigned_to { white-space: normal; } |
|
130 | tr.issue td.subject, tr.issue td.category, td.assigned_to, tr.issue td.string, tr.issue td.text { white-space: normal; } | |
131 | tr.issue td.subject { text-align: left; } |
|
131 | tr.issue td.subject { text-align: left; } | |
132 | tr.issue td.done_ratio table.progress { margin-left:auto; margin-right: auto;} |
|
132 | tr.issue td.done_ratio table.progress { margin-left:auto; margin-right: auto;} | |
|
133 | tr.issue td. | |||
133 |
|
134 | |||
134 | tr.issue.idnt td.subject a {background: url(../images/bullet_arrow_right.png) no-repeat 0 50%; padding-left: 16px;} |
|
135 | tr.issue.idnt td.subject a {background: url(../images/bullet_arrow_right.png) no-repeat 0 50%; padding-left: 16px;} | |
135 | tr.issue.idnt-1 td.subject {padding-left: 0.5em;} |
|
136 | tr.issue.idnt-1 td.subject {padding-left: 0.5em;} |
@@ -261,6 +261,21 class IssuesControllerTest < ActionController::TestCase | |||||
261 | assert_kind_of Array, session[:query][:column_names] |
|
261 | assert_kind_of Array, session[:query][:column_names] | |
262 | assert_equal columns, session[:query][:column_names].map(&:to_s) |
|
262 | assert_equal columns, session[:query][:column_names].map(&:to_s) | |
263 | end |
|
263 | end | |
|
264 | ||||
|
265 | def test_index_with_custom_field_column | |||
|
266 | columns = %w(tracker subject cf_2) | |||
|
267 | get :index, :set_filter => 1, :c => columns | |||
|
268 | assert_response :success | |||
|
269 | ||||
|
270 | # query should use specified columns | |||
|
271 | query = assigns(:query) | |||
|
272 | assert_kind_of Query, query | |||
|
273 | assert_equal columns, query.column_names.map(&:to_s) | |||
|
274 | ||||
|
275 | assert_tag :td, | |||
|
276 | :attributes => {:class => 'cf_2 string'}, | |||
|
277 | :ancestor => {:tag => 'table', :attributes => {:class => /issues/}} | |||
|
278 | end | |||
264 |
|
279 | |||
265 | def test_show_by_anonymous |
|
280 | def test_show_by_anonymous | |
266 | get :show, :id => 1 |
|
281 | get :show, :id => 1 |
General Comments 0
You need to be logged in to leave comments.
Login now