Removes RJS from RepositoriesController.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10048 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
38060a2cf0
commit
87da04c808
|
@ -236,22 +236,6 @@ class RepositoriesController < ApplicationController
|
|||
|
||||
if @issue
|
||||
@changeset.issues << @issue
|
||||
respond_to do |format|
|
||||
format.js {
|
||||
render :update do |page|
|
||||
page.replace_html "related-issues", :partial => "related_issues"
|
||||
page.visual_effect :highlight, "related-issue-#{@issue.id}"
|
||||
end
|
||||
}
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.js {
|
||||
render :update do |page|
|
||||
page.alert(l(:label_issue) + ' ' + l('activerecord.errors.messages.invalid'))
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -262,14 +246,6 @@ class RepositoriesController < ApplicationController
|
|||
if @issue
|
||||
@changeset.issues.delete(@issue)
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js {
|
||||
render :update do |page|
|
||||
page.remove "related-issue-#{@issue.id}"
|
||||
end if @issue
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def diff
|
||||
|
@ -456,4 +432,3 @@ class RepositoriesController < ApplicationController
|
|||
graph.burn
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<% if @issue %>
|
||||
Element.update('related-issues', '<%= escape_javascript(render :partial => "related_issues") %>');
|
||||
Effect.highlight('related-issue-<%= @issue.id %>');
|
||||
<% else %>
|
||||
alert("<%= escape_javascript(l(:label_issue) + ' ' + l('activerecord.errors.messages.invalid')) %>");
|
||||
<% end %>
|
|
@ -0,0 +1 @@
|
|||
Element.remove('related-issue-<%= @issue.id %>');
|
|
@ -171,20 +171,25 @@ class RepositoriesControllerTest < ActionController::TestCase
|
|||
def test_add_related_issue
|
||||
@request.session[:user_id] = 2
|
||||
assert_difference 'Changeset.find(103).issues.size' do
|
||||
post :add_related_issue, :id => 1, :rev => 4, :issue_id => 2, :format => 'js'
|
||||
xhr :post, :add_related_issue, :id => 1, :rev => 4, :issue_id => 2, :format => 'js'
|
||||
assert_response :success
|
||||
assert_template 'add_related_issue'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
end
|
||||
assert_select_rjs :replace_html, 'related-issues'
|
||||
assert_equal [2], Changeset.find(103).issue_ids
|
||||
assert_include 'related-issues', response.body
|
||||
assert_include 'Feature request #2', response.body
|
||||
end
|
||||
|
||||
def test_add_related_issue_with_invalid_issue_id
|
||||
@request.session[:user_id] = 2
|
||||
assert_no_difference 'Changeset.find(103).issues.size' do
|
||||
post :add_related_issue, :id => 1, :rev => 4, :issue_id => 9999, :format => 'js'
|
||||
xhr :post, :add_related_issue, :id => 1, :rev => 4, :issue_id => 9999, :format => 'js'
|
||||
assert_response :success
|
||||
assert_template 'add_related_issue'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
end
|
||||
assert_include 'alert("Issue is invalid")', @response.body
|
||||
assert_include 'alert("Issue is invalid")', response.body
|
||||
end
|
||||
|
||||
def test_remove_related_issue
|
||||
|
@ -193,11 +198,13 @@ class RepositoriesControllerTest < ActionController::TestCase
|
|||
|
||||
@request.session[:user_id] = 2
|
||||
assert_difference 'Changeset.find(103).issues.size', -1 do
|
||||
delete :remove_related_issue, :id => 1, :rev => 4, :issue_id => 2, :format => 'js'
|
||||
xhr :delete, :remove_related_issue, :id => 1, :rev => 4, :issue_id => 2, :format => 'js'
|
||||
assert_response :success
|
||||
assert_template 'remove_related_issue'
|
||||
assert_equal 'text/javascript', response.content_type
|
||||
end
|
||||
assert_select_rjs :remove, 'related-issue-2'
|
||||
assert_equal [1], Changeset.find(103).issue_ids
|
||||
assert_include 'related-issue-2', response.body
|
||||
end
|
||||
|
||||
def test_graph_commits_per_month
|
||||
|
|
Loading…
Reference in New Issue