]> source.dussan.org Git - sonarqube.git/commitdiff
Empty widgets shouldn't be displayed
authorDavid Gageot <david@gageot.net>
Mon, 21 May 2012 14:21:22 +0000 (16:21 +0200)
committerDavid Gageot <david@gageot.net>
Mon, 21 May 2012 14:24:35 +0000 (16:24 +0200)
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/index.html.erb

index 8996cf2e686699feef4a82f5ec3ee1b3671d6b35..6f9e706d9222c7ff2152e6c3456d081e503ce4e1 100644 (file)
@@ -1,27 +1,31 @@
 <% widget_body=widget_body(widget) %>
 
-<%= render :partial => 'widget_title', :locals => {:widget => widget} -%>
+<% if widget_body.include?('<') %>
+  <div class="block" id="block_<%= widget.id -%>">
+    <%= render :partial => 'widget_title', :locals => {:widget => widget} -%>
 
-<div class="<%= h widget.key -%>" style="height:100%;">
-  <% if widget.configured %>
-    <% if widget_body.include?('<')
-         default_layout=(widget.java_definition.getWidgetLayout().name()=='DEFAULT')
-         if default_layout %>
-        <div class="widget">
-      <% end %>
-      <%= widget_body -%>
+    <div class="<%= h widget.key -%>" style="height:100%;">
+      <% default_layout=(widget.java_definition.getWidgetLayout().name()=='DEFAULT') %>
       <% if default_layout %>
-        <div class="clear"></div>
+        <div class="widget">
+          <%= widget_body -%>
+          <div class="clear"></div>
         </div>
+      <% else %>
+        <%= widget_body -%>
       <% end %>
-    <% end %>
-  <% else %>
-    <div class="widget">
-      <p>
-        <a href="<%= url_for(dashboard_action(:configure)) -%>"><%= message('dashboard.please_configure_the_widget_x', :params => widget.java_definition.getTitle()) -%></a>
-      </p>
+
+      <div style="clear: both;"></div>
     </div>
-  <% end %>
-  <div style="clear: both;"></div>
-</div>
+  </div>
+<% elsif !widget.configured %>
+  <div class="block" id="block_<%= widget.id -%>">
+    <div class="<%= h widget.key -%>" style="height:100%;">
+      <div class="widget">
+        <a href="<%= url_for(dashboard_action(:configure)) -%>"><%= message('dashboard.please_configure_the_widget_x', :params => widget.java_definition.getTitle()) -%></a>
+      </div>
 
+      <div style="clear: both;"></div>
+    </div>
+  </div>
+<% end %>
index 83b795b23edacc071b2895dcc7754bf1155c6feb..2c62c6650aff90b43a969d2086b3803481fe3a62 100644 (file)
                widget_definition=@authorized_widget_definitions.find { |wd| wd.getId()==widget.widget_key }
                if widget_definition
           %>
-              <div class="block" id="block_<%= widget.id -%>">
-                <%= render :partial => 'widget', :locals => {:widget => widget} %>
-              </div>
-            <%
-               end
-               end
-            %>
+              <%= render :partial => 'widget', :locals => {:widget => widget} %>
+          <%
+             end
+             end
+          %>
         </div>
       </div>
     <% end %>