Wrap text custom fields in the issue list (#8064).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5332 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2011-04-05 22:18:49 +00:00
parent 47dccc53b3
commit 5823481d6e
4 changed files with 26 additions and 2 deletions

View File

@ -42,6 +42,10 @@ class QueryColumn
def value(issue)
issue.send name
end
def css_classes
name
end
end
class QueryCustomFieldColumn < QueryColumn
@ -68,6 +72,10 @@ class QueryCustomFieldColumn < QueryColumn
cv = issue.custom_values.detect {|v| v.custom_field_id == @cf.id}
cv && @cf.cast_value(cv.value)
end
def css_classes
@css_classes ||= "#{name} #{@cf.field_format}"
end
end
class Query < ActiveRecord::Base

View File

@ -28,7 +28,7 @@
<tr id="issue-<%= issue.id %>" class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
<td class="checkbox hide-when-print"><%= check_box_tag("ids[]", issue.id, false, :id => nil) %></td>
<td class="id"><%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %></td>
<% query.columns.each do |column| %><%= content_tag 'td', column_content(column, issue), :class => column.name %><% end %>
<% query.columns.each do |column| %><%= content_tag 'td', column_content(column, issue), :class => column.css_classes %><% end %>
</tr>
<% end -%>
</tbody>

View File

@ -127,9 +127,10 @@ tr.project.idnt-8 td.name {padding-left: 11em;}
tr.project.idnt-9 td.name {padding-left: 12.5em;}
tr.issue { text-align: center; white-space: nowrap; }
tr.issue td.subject, tr.issue td.category, td.assigned_to { white-space: normal; }
tr.issue td.subject, tr.issue td.category, td.assigned_to, tr.issue td.string, tr.issue td.text { white-space: normal; }
tr.issue td.subject { text-align: left; }
tr.issue td.done_ratio table.progress { margin-left:auto; margin-right: auto;}
tr.issue td.
tr.issue.idnt td.subject a {background: url(../images/bullet_arrow_right.png) no-repeat 0 50%; padding-left: 16px;}
tr.issue.idnt-1 td.subject {padding-left: 0.5em;}

View File

@ -262,6 +262,21 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal columns, session[:query][:column_names].map(&:to_s)
end
def test_index_with_custom_field_column
columns = %w(tracker subject cf_2)
get :index, :set_filter => 1, :c => columns
assert_response :success
# query should use specified columns
query = assigns(:query)
assert_kind_of Query, query
assert_equal columns, query.column_names.map(&:to_s)
assert_tag :td,
:attributes => {:class => 'cf_2 string'},
:ancestor => {:tag => 'table', :attributes => {:class => /issues/}}
end
def test_show_by_anonymous
get :show, :id => 1
assert_response :success