From d60c6660d19f6a3ea2f6bd2b5d3dad87773c05d3 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Tue, 4 Jun 2013 16:27:06 +0200 Subject: [PATCH] SONAR-4303 fix canceling of comment edit form --- .../app/controllers/issue_controller.rb | 7 ++++++- .../src/main/webapp/javascripts/issue.js | 20 +------------------ 2 files changed, 7 insertions(+), 20 deletions(-) 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 bc5ae43b029..ea985230a3f 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 @@ -39,7 +39,12 @@ class IssueController < ApplicationController if params[:modal] render :partial => 'issue/show_modal' elsif request.xhr? - render :partial => 'issue/show' + if params[:only_detail] + # used when canceling edition of comment -> see issue.js#refreshIssue() + render :partial => 'issue/issue', :locals => {:issue => @issue_results.first} + else + render :partial => 'issue/show' + end else render :action => 'show' end diff --git a/sonar-server/src/main/webapp/javascripts/issue.js b/sonar-server/src/main/webapp/javascripts/issue.js index f57267528b3..410d37a1ed8 100644 --- a/sonar-server/src/main/webapp/javascripts/issue.js +++ b/sonar-server/src/main/webapp/javascripts/issue.js @@ -52,10 +52,6 @@ function submitIssueForm(elt) { var issueKey = issueElt.attr('data-issue-key'); var replaced = $j(htmlResponse); issueElt.replaceWith(replaced); - - // re-enable the links opening modal popups - replaced.find('.open-modal').modal(); - notifyIssueChange(issueKey) } ).fail(function (jqXHR, textStatus) { @@ -80,10 +76,6 @@ function doIssueAction(elt, action, parameters) { ).success(function (htmlResponse) { var replaced = $j(htmlResponse); issueElt.replaceWith(replaced); - - // re-enable the links opening modal popups - replaced.find('.open-modal').modal(); - notifyIssueChange(issueKey); } ).fail(function (jqXHR, textStatus) { @@ -140,10 +132,6 @@ function doEditIssueComment(elt) { success: function (htmlResponse) { var replaced = $j(htmlResponse); issueElt.replaceWith(replaced); - - // re-enable the links opening modal popups - replaced.find('.open-modal').modal(); - notifyIssueChange(issueKey); } }); @@ -153,12 +141,9 @@ function doEditIssueComment(elt) { function refreshIssue(elt) { var issueElt = $j(elt).closest('[data-issue-key]'); var issueKey = issueElt.attr('data-issue-key'); - $j.get(baseUrl + "/issue/show/" + issueKey, function (html) { + $j.get(baseUrl + "/issue/show/" + issueKey + "?only_detail=true", function (html) { var replaced = $j(html); issueElt.replaceWith(replaced); - - // re-enable the links opening modal popups - replaced.find('.open-modal').modal(); }); return false; } @@ -191,9 +176,6 @@ function submitCreateIssueForm(elt) { ).success(function (html) { var replaced = $j(html); formElt.replaceWith(replaced); - - // enable the links opening modal popups - replaced.find('.open-modal').modal(); } ).error(function (jqXHR, textStatus, errorThrown) { var errorsElt = formElt.find('.code-issue-errors'); -- 2.39.5