summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-04-05 22:18:49 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-04-05 22:18:49 +0000
commit5823481d6ef074904c495bb25ee76c86b1972d4e (patch)
tree65718d736462b3f12350c2c6c34859e075cf15d4
parent47dccc53b36265a9b552a2c15e44e4d8b0b89acd (diff)
downloadredmine-5823481d6ef074904c495bb25ee76c86b1972d4e.tar.gz
redmine-5823481d6ef074904c495bb25ee76c86b1972d4e.zip
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
-rw-r--r--app/models/query.rb8
-rw-r--r--app/views/issues/_list.rhtml2
-rw-r--r--public/stylesheets/application.css3
-rw-r--r--test/functional/issues_controller_test.rb15
4 files changed, 26 insertions, 2 deletions
diff --git a/app/models/query.rb b/app/models/query.rb
index 87663aca8..9f4d6d5c2 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -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
diff --git a/app/views/issues/_list.rhtml b/app/views/issues/_list.rhtml
index 7d3a03c2e..1d08d5498 100644
--- a/app/views/issues/_list.rhtml
+++ b/app/views/issues/_list.rhtml
@@ -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>
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index 2589b327f..83e786b49 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -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;}
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 2630e9684..4c6e33266 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -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