]> source.dussan.org Git - sonarqube.git/commitdiff
New URL widget/show?id=<widget id> to return only the widget HTML content, without...
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 23 Sep 2014 10:15:36 +0000 (12:15 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 23 Sep 2014 10:15:46 +0000 (12:15 +0200)
server/sonar-web/src/main/webapp/WEB-INF/app/controllers/widget_controller.rb

index 2a9ad5113949addafad48ccfffcbbd01db4d7365..c40d8764c50df52f63d5bafaa505b31c5a978b5f 100644 (file)
@@ -29,6 +29,20 @@ class WidgetController < ApplicationController
     render :action => 'index'
   end
 
+  def show
+    load_resource
+    load_widget
+    begin
+      render :inline => @widget_definition.getTarget().getTemplate(), :locals => {
+          :widget_properties => @widget.properties_as_hash, :widget => @widget, :dashboard_configuration => @dashboard_configuration
+      }
+    rescue => error
+      logger.error(message('dashboard.cannot_render_widget_x', :params => [@widget_definition.getId(), error]), error)
+      render :status => 500
+    end
+
+  end
+
   private
 
   def load_resource