layout.evaluation=Embedded database should be used for evaluation purpose only
layout.ie6_warn=Your web browser is outdated. This website may not display correctly.
layout.dashboards=Dashboards
-layout.recent_history.link=Recent history
-layout.recent_history.clear=Clear
-layout.recent_history.no_history_yet=No history yet
+layout.user_panel.my_profile=My profile
+layout.user_panel.recent_history.title=Recent history
+layout.user_panel.recent_history.clear=Clear
+layout.user_panel.me=Me
+layout.user_panel.anonymous_user=Anonymous
+layout.user_panel.non_authenticated_user=Unauthenticated user
sidebar.project_settings=Configuration
sidebar.security=Security
<li>
<a href="javascript:window.print()"><img src="<%= ApplicationController.root_context -%>/images/print.gif" alt="<%= message('layout.print') -%>" title="<%= message('layout.print') -%>"/></a>
</li>
- <% if logged_in? %>
- <li>
- <img src="<%= ApplicationController.root_context -%>/images/user.gif"/><a href="<%= ApplicationController.root_context -%>/account/index"><%= current_user.name(true) -%></a>
- » <a href="<%= ApplicationController.root_context -%>/sessions/logout"><%= message('layout.logout') -%></a>
- </li>
- <% else %>
+ <% unless logged_in? %>
<li><a href="<%= ApplicationController.root_context -%>/sessions/new?return_to=<%= u (request.request_uri) -%>"><%= message('layout.login') -%></a></li>
<% end %>
+ <%= render 'layouts/user_panel' -%>
<li><a href="<%= ApplicationController.root_context -%>/profiles"><%= message('layout.configuration') -%></a></li>
- <%= render 'layouts/resource_history' -%>
</ul>
</div>
<div id="searchResourcesResults" class="autocomplete" style="display:none"></div>
+++ /dev/null
-<script>
- if (supports_html5_storage()) {
- var sonarRecentHistory = new Sonar.RecentHistory('<%= ApplicationController.root_context -%>')
- .addTranslation('clear', '<%= message('layout.recent_history.clear') -%>')
- .addTranslation('no_history_yet', '<%= message('layout.recent_history.no_history_yet') -%>');
- }
-</script>
-
-<div class="dropdown" id="sonar_recent_history_div">
- <a href="#" class="link-more" onclick="sonarRecentHistory.populateRecentHistoryDropDown(); $('sonar_recent_history_dropdown').toggle();return false;"><%= message('layout.recent_history.link') -%></a>
-
- <ul style="display: none" class="dropdown-menu" id="sonar_recent_history_dropdown" onmouseout="this.hide();" onmouseover="this.show();">
- </ul>
-</div>
-
-<script>
- if (sonarRecentHistory == null) {
- $j('#sonar_recent_history_div').detach();
- } else {
- sonarRecentHistory.add('<%= @resource ? @resource.key : "" -%>',
- '<%= @resource ? @resource.name(true) : "" -%>',
- '<%= @resource ? @resource.qualifier : "" -%>');
- }
-</script>
\ No newline at end of file
--- /dev/null
+<script>
+ if (supports_html5_storage()) {
+ var sonarRecentHistory = new Sonar.RecentHistory('<%= ApplicationController.root_context -%>')
+ .addTranslation('clear', '<%= message('layout.user_panel.recent_history.clear') -%>');
+ }
+</script>
+
+<li>
+ <a href="#" class="link-more" onclick="if (sonarRecentHistory) { sonarRecentHistory.populateRecentHistoryPanel(); }; $j('#user-panel').toggle(); return false;"><%= current_user ? current_user.name(true) : message('layout.user_panel.me') -%></a>
+
+ <div id="user-panel" style="display: none" onmouseout="$j(this).hide();" onmouseover="$j(this).show();">
+ <div id="user-details">
+ <% if current_user %>
+ <b><%= current_user.name(true) -%></b>
+ <% if current_user.email %>
+ <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>
+ –
+ <a href="<%= ApplicationController.root_context -%>/sessions/logout" class="link-action" onclick="if (sonarRecentHistory) { sonarRecentHistory.clear(); };"><%= message('layout.logout') -%></a>
+ <% else %>
+ <b><%= message('layout.user_panel.anonymous_user') -%></b>
+ <br/>
+ <span class="note"><%= message('layout.user_panel.non_authenticated_user') -%></span>
+ <% end %>
+ </div>
+
+ <div id="sonar-recent-history" style="display: none">
+ <b><%= message('layout.user_panel.recent_history.title') -%></b>
+ <ul id="sonar-recent-history-list">
+ </ul>
+ </div>
+ </div>
+
+</li>
+
+<script>
+ if (sonarRecentHistory == null) {
+ $j('#sonar-recent-history').detach();
+ } else {
+ sonarRecentHistory.add('<%= @resource ? @resource.key : "" -%>',
+ '<%= @resource ? @resource.name(true) : "" -%>',
+ '<%= @resource ? @resource.qualifier : "" -%>');
+ }
+</script>
\ No newline at end of file
Sonar.RecentHistory.prototype.clear = function () {
localStorage.clear();
- $("sonar_recent_history_dropdown").hide();
- this.populateRecentHistoryDropDown();
};
Sonar.RecentHistory.prototype.add = function (resourceKey, resourceName, resourceQualifier) {
}
};
-Sonar.RecentHistory.prototype.populateRecentHistoryDropDown = function () {
- var dropdown = $j('#sonar_recent_history_dropdown');
- dropdown.empty();
-
- var recentHistory = this.getRecentHistory();
-
- recentHistory.forEach(function (resource) {
- dropdown.append('<li><img width="16" height="16" src="'
- + sonarRecentHistory.appContext
- + '/images/q/'
- + resource['qualifier']
- + '.png"><a href="'
- + sonarRecentHistory.appContext
- + '/dashboard/index/'
- + resource['key']
- + '">'
- + resource['name']
- + '</a></li>');
- });
+Sonar.RecentHistory.prototype.populateRecentHistoryPanel = function () {
+ var historyLinksList = $j('#sonar-recent-history-list');
+ historyLinksList.empty();
+ var recentHistory = this.getRecentHistory();
if (recentHistory.length == 0) {
- dropdown.append('<li style="color: #000 !important">' + this.translations['no_history_yet'] + '</li>');
- } else {
- dropdown.append('<li class="clear_list"><a href="#" onclick="sonarRecentHistory.clear(); return false;">' + this.translations['clear'] + '</a></li>');
+ $j("#sonar-recent-history").hide();
+ } else {
+ recentHistory.forEach(function (resource) {
+ historyLinksList.append('<li><img width="16" height="16" src="'
+ + sonarRecentHistory.appContext
+ + '/images/q/'
+ + resource['qualifier']
+ + '.png"><a href="'
+ + sonarRecentHistory.appContext
+ + '/dashboard/index/'
+ + resource['key']
+ + '"> '
+ + resource['name']
+ + '</a></li>');
+ });
+ historyLinksList.append('<li><a href="#" onclick="sonarRecentHistory.clear(); sonarRecentHistory.populateRecentHistoryPanel(); return false;" style="color: #777777 !important;">' + this.translations['clear'] + '</a></li>');
+ $j("#sonar-recent-history").show();
}
};
padding: 0 5px 0 0;
}
-#sonar_recent_history_dropdown {
- max-width: none !important;
+#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: #000;
}
-#sonar_recent_history_dropdown a {
- color: #000 !important;
- display: inline !important;
- padding-left: 5px !important;
+#user-panel > div {
+ padding: 10px;
}
-#sonar_recent_history_dropdown li:hover a {
- color: #fff !important;
+#user-panel a {
+ color: #000;
}
-#sonar_recent_history_dropdown li.clear_list {
- background-color: #EFEFEF !important;
- border-top: 1px solid #CCCCCC !important;
- color: #EFEFEF !important;
+#sonar-recent-history {
+ border-top: 1px solid #ccc;
}
-#sonar_recent_history_dropdown li.clear_list:hover a {
- color: #000 !important;
+#sonar-recent-history li {
+ padding-left: 10px;
}
#nonav {