Commit 4de4c335 authored by jplang's avatar jplang
Browse files

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

git-svn-id: https://svn.redmine.org/redmine/trunk@5332 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 386edb6b
......@@ -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
......
......@@ -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>
......
......@@ -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;}
......
......@@ -261,6 +261,21 @@ class IssuesControllerTest < ActionController::TestCase
assert_kind_of Array, session[:query][:column_names]
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment