From 1ca69f2af1eb152264fa0b0493f5173900da2f08 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 11 Jan 2009 11:01:35 +0000 Subject: [PATCH] Different icon for closed issues in search result (#992). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2256 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/issue.rb | 3 ++- public/stylesheets/application.css | 3 +++ test/fixtures/issues.yml | 17 +++++++++++++++++ test/functional/search_controller_test.rb | 11 +++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index e3a9e17e..fa059cbd 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -40,7 +40,8 @@ class Issue < ActiveRecord::Base # sort by id so that limited eager loading doesn't break with postgresql :order_column => "#{table_name}.id" acts_as_event :title => Proc.new {|o| "#{o.tracker.name} ##{o.id}: #{o.subject}"}, - :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.id}} + :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.id}}, + :type => Proc.new {|o| 'issue' + (o.closed? ? ' closed' : '') } acts_as_activity_provider :find_options => {:include => [:project, :author, :tracker]}, :author_key => :author_id diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 824b4cb7..e73d0df7 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -195,6 +195,7 @@ div#activity span.project:after, #search-results span.project:after { content: " div#activity dd span.description, #search-results dd span.description { display:block; } #search-results dd { margin-bottom: 1em; padding-left: 20px; margin-left:0px; } + div#search-results-counts {float:right;} div#search-results-counts ul { margin-top: 0.5em; } div#search-results-counts li { list-style-type:none; float: left; margin-left: 1em; } @@ -212,6 +213,8 @@ dt.attachment { background-image: url(../images/attachment.png); } dt.document { background-image: url(../images/document.png); } dt.project { background-image: url(../images/projects.png); } +#search-results dt.issue.closed { background-image: url(../images/ticket_checked.png); } + div#roadmap fieldset.related-issues { margin-bottom: 1em; } div#roadmap fieldset.related-issues ul { margin-top: 0.3em; margin-bottom: 0.3em; } div#roadmap .wiki h1:first-child { display: none; } diff --git a/test/fixtures/issues.yml b/test/fixtures/issues.yml index 4e141637..921ba40c 100644 --- a/test/fixtures/issues.yml +++ b/test/fixtures/issues.yml @@ -108,4 +108,21 @@ issues_007: start_date: <%= 10.days.ago.to_s(:db) %> due_date: <%= Date.today.to_s(:db) %> lock_version: 0 +issues_008: + created_on: <%= 10.days.ago.to_date.to_s(:db) %> + project_id: 1 + updated_on: <%= 10.days.ago.to_date.to_s(:db) %> + priority_id: 3 + subject: Closed issue + id: 8 + fixed_version_id: + category_id: + description: This is a closed issue. + tracker_id: 1 + assigned_to_id: + author_id: 2 + status_id: 5 + start_date: + due_date: + lock_version: 0 \ No newline at end of file diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb index ce06ec29..b804bbd2 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.rb @@ -45,6 +45,17 @@ class SearchControllerTest < Test::Unit::TestCase assert_tag :a, :content => 'Changesets (4)' end + def test_search_issues + get :index, :q => 'issue', :issues => 1 + assert_response :success + assert_template 'index' + + assert assigns(:results).include?(Issue.find(8)) + assert assigns(:results).include?(Issue.find(5)) + assert_tag :dt, :attributes => { :class => /issue closed/ }, + :child => { :tag => 'a', :content => /Closed/ } + end + def test_search_project_and_subprojects get :index, :id => 1, :q => 'recipe subproject', :scope => 'subprojects', :submit => 'Search' assert_response :success