From: Simon Brandhof Date: Tue, 16 Jul 2013 15:20:18 +0000 (+0200) Subject: SONAR-4373 The confirmation of an issue comment 'Delete' action must not be done... X-Git-Tag: 3.7~90 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=48cd247ea58d79222670bd58a85247af4ca2b26f;p=sonarqube.git SONAR-4373 The confirmation of an issue comment 'Delete' action must not be done in a modal window --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb index ea985230a3f..0695d27692f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb @@ -124,13 +124,6 @@ class IssueController < ApplicationController render :partial => 'issue/issue', :locals => {:issue => @issue_results.issues.get(0)} end - # Form in a modal window to delete comment - def delete_comment_form - verify_ajax_request - require_parameters :id - render :partial => 'issue/delete_comment_form' - end - # Delete an existing comment def delete_comment verify_post_request diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_delete_comment_form.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_delete_comment_form.html.erb deleted file mode 100644 index 26b6e7d4aed..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_delete_comment_form.html.erb +++ /dev/null @@ -1,31 +0,0 @@ -
- -
- - - -
-
- \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_issue.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_issue.html.erb index 56e8e7dcc89..5b7cd5ff905 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_issue.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_issue.html.erb @@ -59,7 +59,7 @@ <%= image_tag 'sep12.png' -%>   <%= message('edit') -%> - <%= message('delete') -%> + <%= message('delete') -%> <% end %> <%= Internal.text.markdownToHtml(comment.markdownText) -%> diff --git a/sonar-server/src/main/webapp/javascripts/issue.js b/sonar-server/src/main/webapp/javascripts/issue.js index 8ae078bdcda..d3ed8d9a43f 100644 --- a/sonar-server/src/main/webapp/javascripts/issue.js +++ b/sonar-server/src/main/webapp/javascripts/issue.js @@ -100,11 +100,20 @@ function doIssueTransition(elt, transition) { return doIssueAction(elt, 'transition', parameters); } -function formDeleteIssueComment(elt) { +function deleteIssueComment(elt, confirmMsg) { var commentElt = $j(elt).closest("[data-comment-key]"); - var htmlId = commentElt.attr('id'); var commentKey = commentElt.attr('data-comment-key'); - return openModalWindow(baseUrl + '/issue/delete_comment_form/' + commentKey + '?htmlId=' + htmlId, {}); + var issueElt = commentElt.closest('[data-issue-key]'); + if (confirm(confirmMsg)) { + $j.ajax({ + type: "POST", + url: baseUrl + "/issue/delete_comment?id=" + commentKey, + success: function (htmlResponse) { + issueElt.replaceWith($j(htmlResponse)); + } + }); + } + return false; } function formEditIssueComment(elt) {