]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3972 Change user panel into "classic" dropdown menu
authorFabrice Bellingard <fabrice.bellingard@sonarsource.com>
Tue, 4 Dec 2012 13:40:07 +0000 (14:40 +0100)
committerFabrice Bellingard <fabrice.bellingard@sonarsource.com>
Tue, 4 Dec 2012 14:35:03 +0000 (15:35 +0100)
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_menu_resource_settings.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_menu_user.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_user_panel.html.erb [deleted file]
sonar-server/src/main/webapp/stylesheets/layout.css

index 7e96c4edb51cfd732230c6f4fc9b5fb0ff3952a9..0095751ed3586469aea4cb72eb1d011b2e77db99 100644 (file)
           <input type="text" size="15" name="search" id="searchInput" onFocus="autocompleteResources()" value="<%= message('search_verb') -%>"/>
           <img src="<%= ApplicationController.root_context -%>/images/loading-small.gif" id="searchingResources" style="display:none">
         </li>
-        <li>
-          <a href="<%= ApplicationController.root_context -%>/settings/index"><img src="<%= ApplicationController.root_context -%>/images/actions.png" alt="<%= message('layout.administration') -%>" title="<%= message('layout.administration') -%>"/></a>
-        </li>
+        <% if is_admin? %>
+          <li>
+            <a href="<%= ApplicationController.root_context -%>/settings/index"><%= message('layout.administration') -%></a>
+          </li>
+        <% end %>
         <% if logged_in? %>
-          <%= render 'layouts/user_panel' -%>
+          <%= render 'layouts/menu_user' -%>
         <% else %>
           <li><a href="<%= ApplicationController.root_context -%>/sessions/new?return_to=<%= u (request.request_uri) -%>"><%= message('layout.login') -%></a></li>
         <% end %>
@@ -77,6 +79,8 @@
                 <a href="<%= ApplicationController.root_context -%>/dashboard/index/<%= @project.id -%>?did=<%= active_dashboard.dashboard_id -%><%= "&"+period_param if period_param -%>"><%= active_dashboard.dashboard.name(true) -%></a>
               </li>
             <% end %>
+            <li class="<%= 'active' if request.request_uri.include?('/cloud/index') -%>">
+              <a href="<%= ApplicationController.root_context -%>/cloud/index/<%= @project.id -%>"><%= message('clouds.page') -%></a></li>
             <li class="spacer"></li>
             <li class="sidebar-title"><%= message('sidebar.tools') -%></li>
             <li class="<%= 'active' if request.request_uri.include?('/components/index') -%>">
             <li class="<%= 'active' if request.request_uri.include?('/drilldown/violations') -%>">
               <a href="<%= ApplicationController.root_context -%>/drilldown/violations/<%= @project.id -%><%= "?"+period_param if period_param -%>"><%= message('violations_drilldown.page') -%></a>
               <% if controller.java_facade.getResourceTypeBooleanProperty(@project.qualifier, 'comparable') %>
-              <li class="<%= 'active' if request.request_uri.include?('/comparison/index') -%>">
+            <li class="<%= 'active' if request.request_uri.include?('/comparison/index') -%>">
                 <a href="<%= ApplicationController.root_context -%>/comparison/index?resource=<%= @project.key -%>"><%= message('comparison.page') -%></a></li>
             <% end %>
-            <li class="<%= 'active' if request.request_uri.include?('/cloud/index') -%>">
-              <a href="<%= ApplicationController.root_context -%>/cloud/index/<%= @project.id -%>"><%= message('clouds.page') -%></a></li>
             <% controller.java_facade.getPages(Navigation::SECTION_RESOURCE, @project.scope, @project.qualifier, @project.language, @project.last_snapshot.metric_keys.to_java(:string)).each do |page|
               page_url = (page.isController() ? "#{page.getId()}?id=#{@project.id}" : "/plugins/resource/#{@project.id}?page=#{page.getId()}")
             %>
index f2b145f85d76d92bc74fb5b3a013770c2f6af851..a87e486b779fc4208c0d88063dd3f202814ccdd3 100644 (file)
@@ -34,7 +34,6 @@
       <% if controller.java_facade.getResourceTypeBooleanProperty(@project.qualifier, 'deletable') %>
         <li><a href="<%= ApplicationController.root_context -%>/project/deletion/<%= @project.id -%>"><%= message('resource_deletion.page', :params => message('qualifier.' + @project.qualifier)) -%></a></li>
       <% end %>
-
     </ul>
   </div>
   
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_menu_user.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_menu_user.html.erb
new file mode 100644 (file)
index 0000000..90a8fd3
--- /dev/null
@@ -0,0 +1,11 @@
+<li>
+  <a href="#" onclick="$j('#user-panel').toggle(); return false;" class="link-more"><%= current_user.name(true) -%></a>
+  
+  <div id="user-panel" class="dropdown-menu" style="display: none" onmouseout="$j(this).hide();" onmouseover="$j(this).show();">
+    <ul>
+      <li><a href="<%= ApplicationController.root_context -%>/account/index"><%= message('layout.user_panel.my_profile') -%></a></li>
+      <li><a href="<%= ApplicationController.root_context -%>/sessions/logout" onclick="if (sonarRecentHistory) { sonarRecentHistory.clear(); }"><%= message('layout.logout') -%></a></li>
+    </ul>
+  </div>
+  
+</li>
\ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_user_panel.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_user_panel.html.erb
deleted file mode 100644 (file)
index 8973f49..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<li>
-  <a href="#" onclick="$j('#user-panel').toggle(); return false;" class="link-more"><%= current_user.name(true) -%></a>
-  
-  <div id="user-panel" style="display: none" onmouseout="$j(this).hide();" onmouseover="$j(this).show();">
-    <div id="user-details">
-        <b><%= current_user.name(true) -%></b>
-        <% if current_user.email && !current_user.email.blank? %>
-          <br/>
-          <span class="note"><%= current_user.email -%></span>
-        <% end %>
-        <br/>
-        <a href="<%= ApplicationController.root_context -%>/account/index" class="link-action"><%= message('layout.user_panel.my_profile') -%></a>
-        &nbsp;–&nbsp;
-        <a href="<%= ApplicationController.root_context -%>/sessions/logout" class="link-action" onclick="if (sonarRecentHistory) { sonarRecentHistory.clear(); }"><%= message('layout.logout') -%></a>
-    </div>
-  
-</li>
index 4cd1411b51f08ac1ab6f7ee80f7cd6f260eaeabc..3a40e0977b164c311943c4642e04934a241bfbcc 100644 (file)
@@ -169,28 +169,6 @@ body, a {
   right: 20px;
 }
 
-#user-panel {
-  position: absolute;
-  float: right;
-  min-width: 200px;
-  top: 30px;
-  right: 180px;
-  background-color: #fff;
-  border: 1px solid #ccc;
-  box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.5);
-  z-index: 999999;
-  line-height: 18px;
-  color: #111;
-}
-
-#user-panel > div {
-  padding: 10px;
-}
-
-#user-panel a {
-  color: #000;
-}
-
 #recent-history {
   border-bottom: 1px solid #ccc;
   padding-bottom: 10px;