]> source.dussan.org Git - sonarqube.git/commitdiff
Improve generic breadcrumbs
authorSimon Brandhof <simon.brandhof@gmail.com>
Thu, 29 Nov 2012 08:49:17 +0000 (09:49 +0100)
committerSimon Brandhof <simon.brandhof@gmail.com>
Thu, 29 Nov 2012 08:49:17 +0000 (09:49 +0100)
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb

index 2a5ee916434333df75539b58703daeb756c4ca31..f84fe5e4911c3d9c4277ef48d3ff40ecefecc0a7 100644 (file)
@@ -1,4 +1,28 @@
-<% if @resource || @project
+<% if @breadcrumbs %>
+  <div id="crumbs">
+    <ul id="bc">
+      <%
+         @breadcrumbs.each_with_index do |breadcrumb, index|
+      %>
+        <li<%= ' class=first' if index==0 -%>>
+          <% if breadcrumb.is_a?(String) %>
+            <span><%= h breadcrumb -%></span>
+          <%
+             elsif breadcrumb.is_a?(Hash)
+               name = breadcrumb[:name]
+               url = breadcrumb[:url]
+               icon = breadcrumb[:icon]
+          %>
+            <% if icon %><img src="<%= ApplicationController.root_context -%>/images/<%= icon -%>" width="16" height="16"><% end %>
+            <%= link_to_if url, name, url -%>
+          <% elsif breadcrumb.respond_to?(:html) %>
+            <%= breadcrumb.html -%>
+          <% end %>
+        </li>
+      <% end %>
+    </ul>
+  </div>
+<% elsif @resource || @project
      displayed_resource = @resource || @project
 %>
   <div id="crumbs">
       %>
     </ul>
   </div>
-<% elsif @breadcrumbs %>
-  <div id="crumbs">
-    <ul id="bc">
-      <%
-         @breadcrumbs.each_with_index do |breadcrumb, index|
-      %>
-        <li<%= ' class=first' if index==0 -%>>
-          <% if breadcrumb.is_a?(String) %>
-            <span><%= h breadcrumb -%></span>
-          <%
-             elsif breadcrumb.is_a?(Hash)
-               name = breadcrumb[:name]
-               url = breadcrumb[:url]
-               icon = breadcrumb[:icon]
-          %>
-            <%= image_tag icon if icon %>
-            <%= link_to_if url, name, url -%>
-          <% elsif breadcrumb.respond_to?(:html) %>
-            <%= breadcrumb.html -%>
-          <% end %>
-        </li>
-      <% end %>
-    </ul>
-  </div>
 <% end %>
\ No newline at end of file