]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3755 raise a JS event for Eclipse when issue is changed
authorSimon Brandhof <simon.brandhof@gmail.com>
Wed, 15 May 2013 16:41:09 +0000 (18:41 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Wed, 15 May 2013 16:41:09 +0000 (18:41 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/issue/_delete_comment_form.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/issue/show.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/javascripts/issue.js

index 84c8a6a9bdd3597ca852ec86e894fd756f15b7e0..81ad0bbdf31fd85d841179a28eb1b5f4818a4db4 100644 (file)
@@ -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
index f277120dc6b50ac299d38f206498ff4ec4dede20..9c790fe6ecb26678e485c2bf2600f55846dd511c 100644 (file)
@@ -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 (file)
index 0000000..f8fcee5
--- /dev/null
@@ -0,0 +1,3 @@
+<div>
+  <%= render :partial => 'resource/issue', :locals => {:issue => @issue_results.issues.get(0)} -%>
+</div>
\ No newline at end of file
index 480a55b82de345dab69fe2918853918868394ddc..15dff549f07a6e6a707fa1098dc4c877d54805a5 100644 (file)
@@ -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