Add a second action menu to IssuesController#show. (#4331)

Will have the update, log time, watch, copy, etc buttons.  Had to rework
how the watchers button works since it requires a unique DOM id for the
Ajax response.  Also modified the WatchersController to be able to replace
multiple sections of the page, e.g. two Watch links.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3119 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis
2009-12-03 18:41:00 +00:00
parent 97c5362cfe
commit e02da72947
5 changed files with 66 additions and 14 deletions
+22 -1
View File
@@ -47,6 +47,16 @@ class WatchersControllerTest < ActionController::TestCase
end
assert Issue.find(1).watched_by?(User.find(3))
end
def test_watch_with_multiple_replacements
@request.session[:user_id] = 3
assert_difference('Watcher.count') do
xhr :post, :watch, :object_type => 'issue', :object_id => '1', :replace => ['watch_item_1','watch_item_2']
assert_response :success
assert_select_rjs :replace_html, 'watch_item_1'
assert_select_rjs :replace_html, 'watch_item_2'
end
end
def test_unwatch
@request.session[:user_id] = 3
@@ -57,7 +67,18 @@ class WatchersControllerTest < ActionController::TestCase
end
assert !Issue.find(1).watched_by?(User.find(3))
end
def test_unwatch_with_multiple_replacements
@request.session[:user_id] = 3
assert_difference('Watcher.count', -1) do
xhr :post, :unwatch, :object_type => 'issue', :object_id => '2', :replace => ['watch_item_1', 'watch_item_2']
assert_response :success
assert_select_rjs :replace_html, 'watch_item_1'
assert_select_rjs :replace_html, 'watch_item_2'
end
assert !Issue.find(1).watched_by?(User.find(3))
end
def test_new_watcher
@request.session[:user_id] = 2
assert_difference('Watcher.count') do