From 66561031eb719131a38d37d62a9a75d8e5cc7d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=A4fer?= Date: Thu, 12 May 2011 11:29:08 +0200 Subject: [PATCH 1/3] [#400] Fix the event types (icons on activity and search views). --- app/models/issue.rb | 10 +++++++++- .../acts_as_journalized/lib/acts_as_journalized.rb | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index 90fdacbdb4..09bfcf83ed 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -39,7 +39,15 @@ class Issue < ActiveRecord::Base acts_as_watchable acts_as_journalized :event_title => Proc.new {|o| "#{o.tracker.name} ##{o.journaled_id} (#{o.status}): #{o.subject}"}, - :event_type => Proc.new {|o| 'issue' + (o.closed? ? ' closed' : '')} + :event_type => Proc.new {|o| + t = 'issue' + if o.changes.empty? + t << '-note' unless o.initial? + else + t << (IssueStatus.find_by_id(o.new_value_for(:status_id)).try(:is_closed?) ? '-closed' : '-edit') + end + t }, + :except => [:description] register_on_journal_formatter(:id, 'parent_id') register_on_journal_formatter(:named_association, 'project_id', 'status_id', 'tracker_id', 'assigned_to_id', diff --git a/vendor/plugins/acts_as_journalized/lib/acts_as_journalized.rb b/vendor/plugins/acts_as_journalized/lib/acts_as_journalized.rb index 72f6b2bd23..7a3b7b458a 100644 --- a/vendor/plugins/acts_as_journalized/lib/acts_as_journalized.rb +++ b/vendor/plugins/acts_as_journalized/lib/acts_as_journalized.rb @@ -172,6 +172,7 @@ module Redmine :anchor => ("note-#{journal.anchor}" unless journal.initial?) } end end + options[:type] ||= self.name.underscore.dasherize # Make sure the name of the journalized model and not the name of the journal is used for events { :description => :notes, :author => :user }.reverse_merge options end end From a4f7629f1f098ebdcde8c9c1e4f6b5658265a3a0 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Fri, 20 May 2011 14:22:55 -0700 Subject: [PATCH 2/3] [#400] Fix some tests broken by 6656103 --- app/models/issue.rb | 3 +-- test/functional/search_controller_test.rb | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index 09bfcf83ed..aed7600299 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -46,8 +46,7 @@ class Issue < ActiveRecord::Base else t << (IssueStatus.find_by_id(o.new_value_for(:status_id)).try(:is_closed?) ? '-closed' : '-edit') end - t }, - :except => [:description] + t } register_on_journal_formatter(:id, 'parent_id') register_on_journal_formatter(:named_association, 'project_id', 'status_id', 'tracker_id', 'assigned_to_id', diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb index 9dd2b22287..d2e6c17f20 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.rb @@ -49,10 +49,10 @@ class SearchControllerTest < ActionController::TestCase 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/ }, + assert_tag :dt, :attributes => { :class => /issue/ }, :child => { :tag => 'a', :content => /Closed/ } end From 078df72345cb6c6c8edc3f219647cce56b66a4a4 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Fri, 20 May 2011 14:23:54 -0700 Subject: [PATCH 3/3] [#400] Refactor old assert_tag to assert_select --- test/functional/search_controller_test.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb index d2e6c17f20..bcc0b3e8c7 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.rb @@ -52,8 +52,9 @@ class SearchControllerTest < ActionController::TestCase assert assigns(:results).include?(Issue.find(8)) assert assigns(:results).include?(Issue.find(5)) - assert_tag :dt, :attributes => { :class => /issue/ }, - :child => { :tag => 'a', :content => /Closed/ } + assert_select "dt.issue" do + assert_select "a", :text => /Closed/ + end end def test_search_project_and_subprojects