From: Simon Brandhof Date: Wed, 15 May 2013 16:41:09 +0000 (+0200) Subject: SONAR-3755 raise a JS event for Eclipse when issue is changed X-Git-Tag: 3.6~364 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=97da16763a16769cdcc70f953924289e5e1213ec;p=sonarqube.git SONAR-3755 raise a JS event for Eclipse when issue is changed --- 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 84c8a6a9bdd..81ad0bbdf31 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 @@ -22,6 +22,15 @@ class IssueController < ApplicationController SECTION=Navigation::SECTION_RESOURCE + def show + require_parameters :id + + @issue_results = Api.issues.find(params[:id]) + params[:layout] = 'false' + + render :action => 'show' + end + def action_form verify_ajax_request require_parameters :id, :issue 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 index f277120dc6b..9c790fe6ecb 100644 --- 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 @@ -23,7 +23,7 @@ var commentElt = $j('#<%= params[:htmlId] -%>'); var issueElt = commentElt.closest('[data-issue-key]'); var replaced = $j(html); - issueElt.replaceWholeText(replaced); + issueElt.replaceWith(replaced); // re-enable the links opening modal popups replaced.find('.open-modal').modal(); diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issue/show.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issue/show.html.erb new file mode 100644 index 00000000000..f8fcee5dfe9 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issue/show.html.erb @@ -0,0 +1,3 @@ +
+ <%= render :partial => 'resource/issue', :locals => {:issue => @issue_results.issues.get(0)} -%> +
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/javascripts/issue.js b/sonar-server/src/main/webapp/javascripts/issue.js index 480a55b82de..15dff549f07 100644 --- a/sonar-server/src/main/webapp/javascripts/issue.js +++ b/sonar-server/src/main/webapp/javascripts/issue.js @@ -54,10 +54,15 @@ function postIssueForm(elt) { return false; } +/* Raise a Javascript event for Eclipse Web View */ +function notifyIssueChange(issueKey) { + $j(document).trigger('sonar.issue.updated', [issueKey]); +} + function doIssueAction(elt, action, parameters) { var issueElt = $j(elt).closest('[data-issue-key]'); var issueKey = issueElt.attr('data-issue-key'); - parameters['issue']=issueKey; + parameters['issue'] = issueKey; $j.ajax({ type: "POST", @@ -67,8 +72,11 @@ 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) { closeIssueForm(elt); @@ -85,5 +93,4 @@ function assignIssueToMe(elt) { function doIssueTransition(elt, transition) { var parameters = {'transition': transition}; return doIssueAction(elt, 'transition', parameters) -} - +} \ No newline at end of file