respond_to do |format|
format.html {redirect_to issue_path(@issue)}
format.js do
- @relations = @issue.reload.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible?}
+ @relations = select_relations(@issue)
@unsaved_relations = unsaved_relations
end
format.api do
respond_to do |format|
format.html {redirect_to issue_path(@relation.issue_from)}
- format.js
+ format.js do
+ find_issue
+ @relations = select_relations(@issue)
+ end
format.api {render_api_ok}
end
end
# ToDo: Find a better method to return an error if the param is missing.
['']
end
+
+ def select_relations(issue)
+ issue.reload.relations.select {|r| r.other_issue(issue) && r.other_issue(issue).visible?}
+ end
end
if manage_relations
link_to(
l(:label_relation_delete),
- relation_path(relation),
+ relation_path(relation, issue_id: issue.id),
:remote => true,
:method => :delete,
:data => {:confirm => l(:text_are_you_sure)},
$('#relation-<%= @relation.id %>').remove();
+$(".issues-stat").replaceWith('<%= escape_javascript(render_relations_stats(@issue, @relations)) %>')
end
assert_difference 'IssueRelation.count', -1 do
- delete(:destroy, :params => {:id => '2'}, :xhr => true)
+ delete(:destroy, :params => {:id => '2', :issue_id => '2'}, :xhr => true)
assert_response :success
assert_equal 'text/javascript', response.media_type
assert_include 'relation-2', response.body