<div class="container">
<ul class="nav navbar-nav nav-crumbs">
- {{#each breadcrumbs}}
+ {{#each contextBreadcrumbs}}
<li>
<a href="{{link url}}">
{{qualifierIcon q}} {{name}}
{{/each}}
</ul>
- <ul class="nav navbar-nav navbar-right">
- {{#each items}}
- {{#notEmpty menu}}
- <li class="dropdown {{#if active}}active{{/if}}">
- <a class="dropdown-toggle" data-toggle="dropdown" href="#">
- {{> '_nav-navbar-label'}} <i class="icon-dropdown"></i>
- </a>
- <ul class="dropdown-menu dropdown-menu-right">
- {{#each menu}}
- <li {{#if active}}class="active"{{/if}}>
- <a href="{{link url}}">
- {{> '_nav-navbar-label'}}
- </a>
- </li>
- {{/each}}
- </ul>
+ <div class="navbar-right navbar-context-meta">
+ {{#if contextVersion}}Version {{contextVersion}}{{/if}}
+ {{#if contextDate}}{{dt contextDate}}{{/if}}
+ </div>
+
+ <ul class="nav navbar-nav nav-tabs">
+ <li {{#isActiveLink '/dashboard'}}class="active"{{/isActiveLink}}>
+ <a href="{{dashboardUrl contextKey}}">{{t 'overview.page'}}</a>
+ </li>
+ <li {{#isActiveLink '/components'}}class="active"{{/isActiveLink}}>
+ <a href="{{link '/components/index/' contextId }}">{{t 'components.page'}}</a>
+ </li>
+ <li>
+ <a href="{{link '/drilldown/issues/' contextId }}">{{t 'issues.page'}}</a>
+ </li>
+ <li class="dropdown {{#isActiveLink '/dashboard'}}{{else}}{{#isActiveLink '/components'}}{{else}}active{{/isActiveLink}}{{/isActiveLink}}">
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#">{{t 'more'}} <i class="icon-dropdown"></i></a>
+ <ul class="dropdown-menu">
+ <li class="dropdown-header">{{t 'layout.dashboards'}}</li>
+ {{#each contextDashboards}}
+ <li>
+ <a href="{{link url}}">{{name}}</a>
+ </li>
+ {{/each}}
+ <li class="divider"></li>
+ <li class="dropdown-header">Tools</li>
+ <li>
+ <a href="{{link '/design/index/' contextId }}">{{t 'design.page'}}</a>
</li>
- {{else}}
- <li {{#if active}}class="active"{{/if}}>
- <a href="{{link url}}">
- {{> '_nav-navbar-label'}}
- </a>
+ <li>
+ <a href="{{link '/libraries/index/' contextId }}">{{t 'libraries.page'}}</a>
</li>
- {{/notEmpty}}
- {{/each}}
+ {{#if contextComparable}}
+ <li>
+ <a href="{{link '/comparison/index?resource=' contextKey}}">{{t 'comparison.page'}}</a>
+ </li>
+ {{/if}}
+ {{#if contextConfiguration}}
+ <li class="divider"></li>
+ <li class="dropdown-header">Configuration</li>
+ {{#each contextConfiguration}}
+ <li>
+ <a href="{{link url}}">{{name}}</a>
+ </li>
+ {{/each}}
+ {{/if}}
+ </ul>
+ </li>
</ul>
</div>
<div class="container">
+ <div class="navbar-header">
+ <a class="navbar-brand" href="{{link '/'}}">{{> '_nav-logo'}}</a>
+ </div>
+
<ul class="nav navbar-nav">
- {{#each items}}
- {{#notEmpty menu}}
- <li class="dropdown {{#if active}}active{{/if}}">
- <a class="dropdown-toggle" data-toggle="dropdown" href="#">
- {{> '_nav-navbar-label'}} <i class="icon-dropdown"></i>
- </a>
- <ul class="dropdown-menu">
- {{#each menu}}
- <li {{#if active}}class="active"{{/if}}>
- <a href="{{link url}}">
- {{> '_nav-navbar-label'}}
- </a>
- </li>
- {{/each}}
- </ul>
+ <li class="dropdown">
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#">
+ {{t 'layout.dashboards'}} <span class="icon-dropdown"></span>
+ </a>
+ <ul class="dropdown-menu">
+ {{#each globalDashboards}}
+ <li>
+ <a href="{{link url}}">{{name}}</a>
+ </li>
+ {{/each}}
+ {{#if canManageGlobalDashboards}}
+ <li class="divider"></li>
+ <li>
+ <a href="{{link '/dashboards'}}">{{t 'manage'}}</a>
+ </li>
+ {{/if}}
+ </ul>
+ </li>
+ <li class="dropdown immediate-dropdown">
+ <a href="{{link '/issues/search'}}">{{t 'issues.page'}}</a>
+ </li>
+ <li>
+ <a href="{{link '/measures/search?qualifiers[]=TRK'}}">{{t 'layout.measures'}}</a>
+ </li>
+ <li>
+ <a href="{{link '/coding_rules'}}">{{t 'coding_rules.page'}}</a>
+ </li>
+ <li>
+ <a href="{{link '/profiles'}}">{{t 'quality_profiles.page'}}</a>
+ </li>
+ <li>
+ <a href="{{link '/quality_gates'}}">{{t 'quality_gates.page'}}</a>
+ </li>
+ <li class="dropdown">
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#">{{t 'more'}} <i class="icon-dropdown"></i></a>
+ <ul class="dropdown-menu">
+ <li>
+ <a href="{{link '/comparison'}}">{{t 'comparison.page'}}</a>
</li>
- {{else}}
- <li {{#if active}}class="active"{{/if}}>
- <a href="{{link url}}">
- {{> '_nav-navbar-label'}}
- </a>
+ <li>
+ <a href="{{link '/dependencies'}}">{{t 'dependencies.page'}}</a>
</li>
- {{/notEmpty}}
- {{/each}}
+ {{#each globalPages}}
+ <li>
+ <a href="{{link url}}">{{name}}</a>
+ </li>
+ {{/each}}
+ {{#if isUserAdmin}}
+ <li class="divider"></li>
+ <li>
+ <a href="{{link '/settings'}}">{{t 'layout.settings'}}</a>
+ </li>
+ {{/if}}
+ </ul>
+ </li>
</ul>
<ul class="nav navbar-nav navbar-right">
</li>
{{/if}}
<li class="dropdown js-search-dropdown">
- <a class="dropdown-toggle js-search-dropdown-toggle" data-toggle="dropdown" href="#">
+ <a class="dropdown-toggle navbar-search-dropdown js-search-dropdown-toggle" data-toggle="dropdown" href="#">
<i class="icon-search navbar-icon"></i> <span class="icon-dropdown"></span>
</a>
+
<div class="js-search-region dropdown-menu dropdown-menu-right"></div>
</li>
- {{#if isUserAdmin}}
- <li>
- <a href="{{link '/settings/index'}}"><i class="icon-settings navbar-icon"></i></a>
- </li>
- {{/if}}
</ul>
</div>
+{{#if extra}}
+ {{#gt index 0}}
+ <div class="divider"></div>
+ {{/gt}}
+ <div class="dropdown-header">{{extra}}</div>
+{{/if}}
+
<a href="{{url}}" title="{{name}}">
- {{#if extra}}
- <span class="navbar-search-extra subtitle">{{extra}}</span>
- {{/if}}
{{#if q}}{{qualifierIcon q}}{{/if}}
{{#if subtitle}}
{{title}}
- <br>
- {{#if extra}}
- <span class="navbar-search-extra subtitle"> </span>
- {{/if}}
<span class="subtitle">{{subtitle}}</span>
{{else}}
{{name}}
--- /dev/null
+<div class="container">
+ <ul class="nav navbar-nav">
+ <li class="dropdown">
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#">
+ {{t 'sidebar.project_settings'}} <i class="icon-dropdown"></i>
+ </a>
+ <ul class="dropdown-menu">
+ <li>
+ <a href="{{link '/settings/index'}}">{{t 'settings.page'}}</a>
+ </li>
+ <li>
+ <a href="{{link '/metrics/index'}}">{{t 'manual_metrics.page'}}</a>
+ </li>
+ <li>
+ <a href="{{link '/admin_dashboards/index'}}">{{t 'default_dashboards.page'}}</a>
+ </li>
+ {{#each settingsPages}}
+ <li>
+ <a href="{{link url}}">{{name}}</a>
+ </li>
+ {{/each}}
+ </ul>
+ </li>
+
+ <li class="dropdown">
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#">
+ {{t 'sidebar.security'}} <i class="icon-dropdown"></i>
+ </a>
+ <ul class="dropdown-menu">
+ <li>
+ <a href="{{link '/users'}}">{{t 'users.page'}}</a>
+ </li>
+ <li>
+ <a href="{{link '/groups/index'}}">{{t 'user_groups.page'}}</a>
+ </li>
+ <li>
+ <a href="{{link '/roles/global'}}">{{t 'global_permissions.page'}}</a>
+ </li>
+ <li>
+ <a href="{{link '/roles/projects'}}">{{t 'roles.page'}}</a>
+ </li>
+ <li>
+ <a href="{{link '/admin_dashboards/index'}}">{{t 'default_dashboards.page'}}</a>
+ </li>
+ </ul>
+ </li>
+
+ <li class="dropdown">
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#">
+ {{t 'sidebar.system'}} <i class="icon-dropdown"></i>
+ </a>
+ <ul class="dropdown-menu">
+ {{#if settingsProvisioning}}
+ <li>
+ <a href="{{link '/provisioning'}}">{{t 'provisioning.page'}}</a>
+ </li>
+ {{/if}}
+ <li>
+ <a href="{{link '/bulk_deletion'}}">{{t 'bulk_deletion.page'}}</a>
+ </li>
+ {{#if settingsUpdateCenter}}
+ <li>
+ <a href="{{link '/updatecenter'}}">{{t 'update_center.page'}}</a>
+ </li>
+ {{/if}}
+ <li>
+ <a href="{{link '/system'}}">{{t 'system_info.page'}}</a>
+ </li>
+ <li>
+ <a href="{{link '/analysis_reports'}}">{{t 'analysis_reports.page'}}</a>
+ </li>
+ </ul>
+ </li>
+ </ul>
+</div>
return baseUrl + url;
});
+ Handlebars.registerHelper('isActiveLink', function() {
+ var args = Array.prototype.slice.call(arguments, 0, -1),
+ options = arguments[arguments.length - 1],
+ prefix = args.join(''),
+ path = window.location.pathname,
+ match = path.indexOf(baseUrl + prefix) === 0;
+ return match ? options.fn(this) : options.inverse(this);
+ });
+
Handlebars.registerHelper('capitalize', function(string) {
return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
});
this.listenTo(this.collection, 'reset', this.resetSelectedIndex);
},
+ itemViewOptions: function (model, index) {
+ return { index: index };
+ },
+
resetSelectedIndex: function () {
this.selectedIndex = 0;
},
define([
'nav/global-navbar-view',
- 'nav/context-navbar-view'
-], function (GlobalNavbarView, ContextNavbarView) {
+ 'nav/context-navbar-view',
+ 'nav/settings-navbar-view'
+], function (GlobalNavbarView, ContextNavbarView, SettingsNavbarView) {
var $ = jQuery,
- App = new Marionette.Application();
+ App = new Marionette.Application(),
+ model = window.navbarOptions;
App.addInitializer(function () {
this.navbarView = new GlobalNavbarView({
app: App,
el: $('.navbar-global'),
- collection: new Backbone.Collection(window.navbarGlobalMenu)
+ model: model
});
this.navbarView.render();
});
- if (window.navbarBreadcrumbs != null) {
+ if (model.has('contextBreadcrumbs')) {
App.addInitializer(function () {
this.contextNavbarView = new ContextNavbarView({
app: App,
el: $('.navbar-context'),
- collection: new Backbone.Collection(window.navbarContextMenu),
- breadcrumbs: new Backbone.Collection(window.navbarBreadcrumbs)
+ model: model
});
this.contextNavbarView.render();
});
}
+ if (model.get('space') === 'settings') {
+ App.addInitializer(function () {
+ this.settingsNavbarView = new SettingsNavbarView({
+ app: App,
+ el: $('.navbar-context'),
+ model: model
+ });
+ this.settingsNavbarView.render();
+ });
+ }
+
window.requestMessages().done(function () {
App.start();
});
return Marionette.ItemView.extend({
template: Templates['nav-context-navbar'],
- serializeData: function () {
- return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
- breadcrumbs: this.options.breadcrumbs.toJSON()
+ onRender: function () {
+ this.$('[data-toggle="tooltip"]').tooltip({
+ container: 'body'
});
}
});
'hidden.bs.dropdown .js-search-dropdown': 'onSearchDropdownHidden'
},
- initialize: function () {
- this.projectName = window.navbarProject;
- this.projectKey = window.navbarProjectKey;
- this.isProjectFavorite = window.navbarProjectFavorite;
- },
-
onRender: function () {
var that = this;
this.$el.addClass('navbar-' + window.navbarSpace);
onSearchDropdownShow: function () {
var that = this;
this.searchRegion.show(new SearchView({
+ model: this.model,
hide: function () {
that.$('.js-search-dropdown-toggle').dropdown('toggle');
}
userName: window.SS.userName,
isUserAdmin: window.SS.isUserAdmin,
- projectName: this.projectName,
- projectKey: this.projectKey,
- projectFavorite: this.isProjectFavorite,
- navbarCanFavoriteProject: window.navbarCanFavoriteProject
+ canManageGlobalDashboards: window.SS.user != null,
+ canManageIssueFilters: window.SS.user != null,
+ canManageMeasureFilters: window.SS.user != null
});
}
});
submit: function () {
this.$('a')[0].click();
+ },
+
+ serializeData: function () {
+ return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
+ index: this.options.index
+ });
}
}),
q: historyItem.icon
};
}),
- qualifiers = window.navbarQualifiers.map(function (q) {
+ qualifiers = this.model.get('qualifiers').map(function (q) {
return {
url: baseUrl + '/all_projects?qualifier=' + encodeURIComponent(q),
name: t('qualifiers.all', q)
var title = item.name,
subtitle = null;
if (domain.q === 'FIL' || domain.q === 'UTS') {
- subtitle = title.substr(0, title.lastIndexOf('/') - 1);
+ subtitle = title.substr(0, title.lastIndexOf('/'));
title = title.substr(title.lastIndexOf('/') + 1);
}
collection.push(_.extend(item, {
q: domain.q,
title: title,
subtitle: subtitle,
- extra: index === 0 ? domain.name : ' ',
+ extra: index === 0 ? domain.name : null,
url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(item.key) + dashboardParameters(true)
}));
});
--- /dev/null
+define([
+ 'templates/nav'
+], function () {
+
+ return Marionette.ItemView.extend({
+ template: Templates['nav-settings-navbar']
+ });
+
+});
// Dropdown section headers
.dropdown-header {
display: block;
- padding: 3px 20px;
+ padding: 3px 8px 5px;
font-size: @smallFontSize;
- color: @baseFontColor;
+ color: @secondFontColor;
white-space: nowrap; // as with > li > a
}
+.dropdown-menu .divider {
+ height: 1px;
+ margin: 9px 0;
+ overflow: hidden;
+ background-color: #e5e5e5;
+}
+
// Backdrop to catch body clicks on mobile, etc.
.dropdown-backdrop {
position: fixed;
.page-title {
float: left;
- font-size: @bigFontSize;
+ font-size: @mediumFontSize !important;
line-height: @formControlHeight;
}
@import (reference) "ui";
@navbarGlobalBackground: #262626;
-@navbarContextBackground: @lightBlue;
+@navbarContextBackground: @barBackgroundColor;
@navbarHeight: 30px;
@navbarLineHeight: 20px;
.navbar a {
.link-no-underline;
+ .trans(none);
}
.navbar-header {
float: left;
}
+.navbar-brand {
+ display: block;
+ padding: 2px 10px 0;
+}
+
.navbar-nav {
float: left;
}
line-height: @navbarLineHeight;
}
+.navbar-nav > li.navbar-more > a {
+ padding-right: 17px;
+}
+
+.navbar-nav > li.navbar-more + li {
+ margin-left: -17px;
+}
+
+.navbar-nav > li.navbar-more + li > a {
+ padding-left: 5px;
+ padding-right: 5px;
+}
+
.navbar-icon:before {
font-size: @iconFontSize;
}
.navbar-search {
position: relative;
- width: 400px;
+ width: 480px;
.box-sizing(border-box);
.trans(width);
}
color: #fff;
}
+ .navbar-brand:hover,
+ .navbar-brand:focus {
+ background-color: darken(@navbarGlobalBackground, 20%);
+ }
+
.navbar-nav > li > a:hover,
.navbar-nav > li > a:focus,
.navbar-nav > .active > a,
.navbar-nav > .dropdown.open > a {
- background-color: darken(@navbarGlobalBackground, 10%);
+ background-color: @darkBlue;
+ }
+
+ .navbar-search-dropdown {
+ background-color: @blue !important;
}
}
.navbar-context {
+ height: auto;
background-color: @navbarContextBackground;
- border-bottom: 1px solid @blue;
- .navbar-nav > li > a {
- padding-bottom: 1px !important;
- border-bottom: 3px solid transparent;
- color: @baseFontColor;
+ .nav-tabs {
+ width: 100%;
}
+}
- .navbar-nav > li > a:hover,
- .navbar-nav > li > a:focus,
- .navbar-nav > .active > a,
- .navbar-nav > .dropdown.open > a {
- border-bottom-color: @blue;
- }
+.navbar-context-meta {
+ line-height: @navbarHeight;
+ padding: 0 10px;
+ color: @secondFontColor;
+ font-size: @smallFontSize;
}
}
}
+
+.sq-logo .sq-logo-letter {
+ fill: #fff;
+}
+
+.sq-logo .sq-logo-arc {
+ fill: @blue;
+}
.nav-crumbs {
+ padding: 5px 0;
+ a {
+ color: @baseFontColor;
+ }
+
+ > li + li:before {
+ content: "/";
+ float: left;
+ padding: 7px 0;
+ color: fade(@baseFontColor, 30%);
+ }
+
+ > li:first-child {
+ font-size: 21px;
+ font-weight: 300;
+ }
}
-.nav-crumbs > li + li:before {
- content: " /";
- display: inline-block;
- vertical-align: middle;
- color: fade(@baseFontColor, 30%);
+.nav-tabs {
+ border-bottom: 1px solid @barBorderColor;
+
+ > li {
+ float: left;
+ margin-bottom: -1px;
+ }
+
+ > li > a {
+ margin-right: 2px;
+ border-bottom: 3px solid transparent;
+
+ &:hover {
+ border-color: @lightBlue;
+ }
+ }
+
+ > li.active > a {
+ border-color: @lightBlue;
+ }
}
@smallFontSize: 12px;
@baseFontSize: 13px;
+@mediumFontSize: 14px;
@bigFontSize: 16px;
@baseFontColor: #444;
@secondFontColor: #777;
<div class="page">
<header class="page-header">
- <h1 class="page-title"><%= h message('components.page') -%></h1>
-
<% if is_admin? %>
<div class="page-actions">
<%= message('customize') -%>
<header class="page-header">
<h1 class="page-title"><%= h @dashboard.name -%></h1>
- <% if logged_in? %>
- <div class="page-actions operations noprint">
- <div class="button-group">
- <% if back %>
- <%= link_to message('dashboard.back_to_dashboard'), dashboard_action(:index), :class => 'button' -%>
- <% else %>
- <% if @dashboard.editable_by?(current_user) %>
- <%= link_to message('dashboard.configure_widgets'), dashboard_action(:configure), :class => 'button' -%>
- <% end %>
- <% end %>
- <%= link_to message('dashboard.manage_dashboards'), {:controller => :dashboards, :action => :index, :resource => (@resource.id if @resource)}, :class => 'button' -%>
- </div>
- </div>
- <% end %>
- <% if @snapshot %>
- <div class="page-description" id="snapshot_title">
- <%= "Version #{@snapshot.version} - " if @snapshot.version.present? -%><%= l @snapshot.created_at -%>
+ <div class="page-actions operations noprint">
+ <% if @snapshot %>
<% if @snapshot.project_snapshot.periods? %>
<% period_options = period_select_option_tags(@snapshot, 'small') %>
<% if period_options %>
</form>
<% end %>
<% end %>
- </div>
- <% end %>
+ <% end %>
+
+ <% if logged_in? %>
+ <div class="button-group">
+ <% if back %>
+ <%= link_to message('dashboard.back_to_dashboard'), dashboard_action(:index), :class => 'button' -%>
+ <% else %>
+ <% if @dashboard.editable_by?(current_user) %>
+ <%= link_to message('dashboard.configure_widgets'), dashboard_action(:configure), :class => 'button' -%>
+ <% end %>
+ <% end %>
+ <%= link_to message('dashboard.manage_dashboards'), {:controller => :dashboards, :action => :index, :resource => (@resource.id if @resource)}, :class => 'button' -%>
+ </div>
+ <% end %>
+ </div>
</header>
uuid: '<%= @resource.uuid -%>',
key: '<%= @resource.key -%>'
};
- document.getElementById('crumbs').remove();
+ document.querySelector('.navbar-context').remove();
</script>
<div id="container">
<nav class="navbar navbar-global"></nav>
- <% if selected_section==Navigation::SECTION_RESOURCE %>
+ <% if selected_section==Navigation::SECTION_RESOURCE || selected_section==Navigation::SECTION_CONFIGURATION %>
<nav class="navbar navbar-context"></nav>
<% end %>
+<script>
+ window.navbarOptions = new Backbone.Model();
+
+ window.navbarOptions.set({
+ qualifiers: [
+ <% qualifiers = Project.root_qualifiers.sort
+ qualifiers.each_with_index do |qualifier, index| %>
+ '<%= qualifier -%>'<% if index < qualifiers.size - 1 %>,<% end %>
+ <% end %>
+ ]
+ });
+ window.SS.isUserAdmin = <%= current_user && is_admin? ? 'true' : 'false' -%>;
+</script>
+
+
+
<%
selected_section = controller.class::SECTION if defined?(controller.class::SECTION)
if selected_section==Navigation::SECTION_RESOURCE && !@project && !@resource
<% elsif selected_section==Navigation::SECTION_CONFIGURATION %>
<%= render :partial => 'layouts/navbar_conf_settings' %>
<% end %>
-
-
-<script>
- var navbarQualifiers = [
- <% Project.root_qualifiers.sort.each do |qualifier| %>
- '<%= qualifier -%>',
- <% end %>
- ];
- window.SS.isUserAdmin = <%= current_user && is_admin? ? 'true' : 'false' -%>;
-</script>
<script>
- var navbarProject = '<%= @project.root_project().name -%>',
- navbarProjectId = '<%= @project.root_project().id -%>',
- navbarProjectKey = '<%= @project.root_project().key -%>',
- navbarCanFavoriteProject = <%= logged_in? && displayed_resource && !display_only_root ? 'true' : 'false' -%>,
- navbarProjectFavorite = <%= logged_in? && current_user.favourite?(resource_id) ? 'true' : 'false' -%>,
- navbarContextMenu = [
- {
- label: 'layout.dashboards',
- active: <%= @dashboard && controller.controller_path=='dashboard' ? "true" : "false" -%>,
- menu: [
- <% ActiveDashboard.user_dashboards(current_user, false).each do |active_dashboard| %>
- {
- url: '/dashboard/index?id=<%= @project.key -%>&did=<%= active_dashboard.dashboard_id -%><%= "&"+period_param if period_param -%>',
- labelLocalized: '<%= escape_javascript active_dashboard.dashboard.name(true) -%>',
- active: <%= @dashboard && controller.controller_path=='dashboard' && active_dashboard.dashboard_id==@dashboard.id ? "true" : "false" -%>
- },
- <% end %>
- ]
- },
- <% if @snapshot %>
- {
- url: '/components/index/<%= @project.id -%>',
- label: 'components.page',
- active: <%= request.request_uri.include?('/components/index') ? "true" : "false" -%>
- },
- {
- url: '/drilldown/issues/<%= @project.id -%><%= "?"+period_param if period_param -%>',
- label: 'issues.page',
- active: <%= request.request_uri.include?('/drilldown/issues') ? "true" : "false" -%>
- },
- <% if (has_role?(:admin, displayed_resource) || profiles_administrator?) && !displayed_resource.entity? %>
- <% is_admin = has_role?(:admin, @project) %>
- {
- labelLocalized: '<%= message('qualifier.configuration.' + @project.qualifier) -%>',
- active: false,
- menu: [
- <% if (is_admin && controller.java_facade.getResourceTypeBooleanProperty(@project.qualifier, 'configurable')) %>
- {
- url: '/project/settings/<%= @project.id -%>',
- label: 'project_settings.page',
- active: false
- },
- <% end %>
- <% if (@project.project?) %>
- {
- url: '/project/profile/<%= @project.id -%>',
- label: 'project_quality_profiles.page',
- active: false
- },
- <% end %>
- <% if (@project.project?) %>
- {
- url: '/project/qualitygate/<%= @project.id -%>',
- label: 'project_quality_gate.page',
- active: false
- },
- <% end %>
- <% if is_admin %>
- {
- url: '/manual_measures/index/<%= @project.id -%>',
- label: 'manual_measures.page',
- active: false
- },
- <% end %>
- <% if (is_admin && @project.project?) %>
- {
- url: '/action_plans/index/<%= @project.id -%>',
- label: 'action_plans.page',
- active: false
- },
- <% end %>
- <% if (is_admin && @project.project?) %>
- {
- url: '/project/links/<%= @project.id -%>',
- label: 'project_links.page',
- active: false
- },
- <% end %>
- <% if is_admin && controller.java_facade.getResourceTypeBooleanProperty(@project.qualifier, 'hasRolePolicy') %>
- {
- url: '/project_roles/index/<%= @project.id -%>',
- label: 'permissions.page',
- active: false
- },
- <% end %>
- <% if is_admin && controller.java_facade.getResourceTypeBooleanProperty(@project.qualifier, 'modifiable_history') %>
- {
- url: '/project/history/<%= @project.id -%>',
- label: 'project_history.page',
- active: false
- },
- <% end %>
- <% if is_admin && controller.java_facade.getResourceTypeBooleanProperty(@project.qualifier, 'updatable_key') %>
- {
- url: '/project/key/<%= @project.id -%>',
- label: 'update_key.page',
- active: false
- },
- <% end %>
- <% if is_admin && controller.java_facade.getResourceTypeBooleanProperty(@project.qualifier, 'deletable') %>
- {
- url: '/project/deletion/<%= @project.id -%>',
- label: 'deletion.page',
- active: false
- },
- <% end %>
- <% if is_admin
- controller.java_facade.getPages(Navigation::SECTION_RESOURCE_CONFIGURATION.key, @project.scope, @project.qualifier, @project.language, nil).each do |page|
- page_url = "#{page.getId()}?resource=#{@project.id}"
- %>
- {
- url: '<%= page_url -%>',
- labelLocalized: '<%= escape_javascript message(page.getId() + '.page', :default => page.getTitle()) -%>',
- active: false
- },
- <% end
- end %>
- ]
- },
- <% end %>
- <% end %>
- {
- label: 'more',
- active: false,
- menu: [
- <% project_metrics = @project.last_snapshot.metric_keys.to_java(:string) if @project.last_snapshot
- controller.java_facade.getPages(Navigation::SECTION_RESOURCE.key, @project.scope, @project.qualifier, @project.language, project_metrics).each do |page|
- page_url = (page.isController() ? "#{page.getId()}?id=#{@project.id}" : "/plugins/resource/#{@project.id}?page=#{page.getId()}")
- %>
- {
- url: '<%= page_url -%>',
- labelLocalized: '<%= escape_javascript message(page.getId() + '.page', :default => page.getTitle()) -%>',
- active: <%= request.request_uri.include?(page_url) ? "true" : "false" -%>
- },
- <% end %>
- {
- url: '/design/index/<%= @project.key -%>',
- label: 'design.page',
- active: <%= request.request_uri.include?('/design/index') ? "true" : "false" -%>
- },
- {
- url: '/libraries/index/<%= @project.key -%>',
- label: 'libraries.page',
- active: <%= request.request_uri.include?('/libraries/index') ? "true" : "false" -%>
- },
- <% if controller.java_facade.getResourceTypeBooleanProperty(@project.qualifier, 'comparable') %>
- {
- url: '/comparison/index?resource=<%= @project.key -%>',
- label: 'comparison.page',
- active: <%= request.request_uri.include?('/comparison/index') ? "true" : "false" -%>
- }
- <% end %>
- ]
- }
- ],
- navbarBreadcrumbs = [
- <%
- resource_link = {:controller => params[:controller], :action => params[:action]}
- if display_only_root
- resource_link = {:controller => 'dashboard', :action => 'index'}
- end
+ window.navbarOptions.set({
+ contextId: '<%= @project.id -%>',
+ contextKey: '<%= @project.key -%>',
+ contextUuid: '<%= @project.uuid -%>',
+ contextComparable: <%= controller.java_facade.getResourceTypeBooleanProperty(@project.qualifier, 'comparable') -%>,
+ <% if @snapshot && @snapshot.version.present? %>
+ contextVersion: '<%= @snapshot.version -%>',
+ <% end %>
+ <% if @snapshot %>
+ contextDate: '<%= @snapshot.created_at -%>',
+ <% end %>
+ contextDashboards: [
+ <% dashboards = ActiveDashboard.user_dashboards(current_user, false)
+ dashboards.each_with_index do |active_dashboard, index| %>
+ {
+ url: '/dashboard/index?id=<%= @project.key -%>&did=<%= active_dashboard.dashboard_id -%><%= "&"+period_param if period_param -%>',
+ name: '<%= escape_javascript active_dashboard.dashboard.name(true) -%>'
+ }<% if index < dashboards.size - 1 -%>, <% end %>
+ <% end %>
+ ]
+ });
+
+ <% if (has_role?(:admin, displayed_resource) || profiles_administrator?) && !displayed_resource.entity? %>
+ <% is_admin = has_role?(:admin, @project) %>
+ window.navbarOptions.set({
+ contextConfiguration: [
+ <% if (is_admin && controller.java_facade.getResourceTypeBooleanProperty(@project.qualifier, 'configurable')) %>
+ {
+ url: '/project/settings/<%= @project.id -%>',
+ name: '<%= escape_javascript message('project_settings.page') -%>'
+ },
+ <% end %>
+ <% if (@project.project?) %>
+ {
+ url: '/project/profile/<%= @project.id -%>',
+ name: '<%= escape_javascript message('project_quality_profiles.page') -%>'
+ },
+ <% end %>
+ <% if (@project.project?) %>
+ {
+ url: '/project/qualitygate/<%= @project.id -%>',
+ name: '<%= escape_javascript message('project_quality_gate.page') -%>'
+ },
+ <% end %>
+ <% if is_admin %>
+ {
+ url: '/manual_measures/index/<%= @project.id -%>',
+ name: '<%= escape_javascript message('manual_measures.page') -%>'
+ },
+ <% end %>
+ <% if (is_admin && @project.project?) %>
+ {
+ url: '/action_plans/index/<%= @project.id -%>',
+ name: '<%= escape_javascript message('action_plans.page') -%>'
+ },
+ <% end %>
+ <% if (is_admin && @project.project?) %>
+ {
+ url: '/project/links/<%= @project.id -%>',
+ name: '<%= escape_javascript message('project_links.page') -%>'
+ },
+ <% end %>
+ <% if is_admin && controller.java_facade.getResourceTypeBooleanProperty(@project.qualifier, 'hasRolePolicy') %>
+ {
+ url: '/project_roles/index/<%= @project.id -%>',
+ name: '<%= escape_javascript message('permissions.page') -%>'
+ },
+ <% end %>
+ <% if is_admin && controller.java_facade.getResourceTypeBooleanProperty(@project.qualifier, 'modifiable_history') %>
+ {
+ url: '/project/history/<%= @project.id -%>',
+ name: '<%= escape_javascript message('project_history.page') -%>'
+ },
+ <% end %>
+ <% if is_admin && controller.java_facade.getResourceTypeBooleanProperty(@project.qualifier, 'updatable_key') %>
+ {
+ url: '/project/key/<%= @project.id -%>',
+ name: '<%= escape_javascript message('update_key.page') -%>'
+ },
+ <% end %>
+ <% if is_admin && controller.java_facade.getResourceTypeBooleanProperty(@project.qualifier, 'deletable') %>
+ {
+ url: '/project/deletion/<%= @project.id -%>',
+ name: '<%= escape_javascript message('deletion.page') -%>'
+ },
+ <% end %>
+ <% if is_admin
+ controller.java_facade.getPages(Navigation::SECTION_RESOURCE_CONFIGURATION.key, @project.scope, @project.qualifier, @project.language, nil).each do |page|
+ page_url = "#{page.getId()}?resource=#{@project.id}"
+ %>
+ {
+ url: '<%= page_url -%>',
+ name: '<%= escape_javascript message(page.getId() + '.page', :default => page.getTitle()) -%>'
+ },
+ <% end end %>
+ ]
+ });
+ <% end %>
- # ======== Path for resources ========
+ window.navbarOptions.set({
+ contextBreadcrumbs: [
+ <%
+ resource_link = {:controller => params[:controller], :action => params[:action]}
+ if display_only_root
+ resource_link = {:controller => 'dashboard', :action => 'index'}
+ end
- if displayed_resource
- if displayed_resource.last_snapshot
- resources=[]
- s=displayed_resource.last_snapshot
- while (s!=nil) do
- resources.insert(0, s.project)
- s=s.parent
- end
- else
- resources = [displayed_resource]
+ # ======== Path for resources ========
+
+ if displayed_resource
+ if displayed_resource.last_snapshot
+ resources=[]
+ s=displayed_resource.last_snapshot
+ while (s!=nil) do
+ resources.insert(0, s.project)
+ s=s.parent
end
+ else
+ resources = [displayed_resource]
+ end
+ %>
+ <%
+ resources.each do |resource|
+ root = "/#{u resource_link[:controller]}/#{u resource_link[:action]}?"
+ path = ''
+ query = request.query_parameters
+ query[:id] = resource.key
+ query.each do |key, value|
+ path += '&' unless path.empty?
+ path += "#{u key}=#{u value}"
+ end
%>
- <%
- resources.each do |resource|
- root = "/#{u resource_link[:controller]}/#{u resource_link[:action]}?"
- path = ''
- query = request.query_parameters
- query[:id] = resource.key
- query.each do |key, value|
- path += '&' unless path.empty?
- path += "#{u key}=#{u value}"
- end
- %>
- {
- q: '<%= resource.qualifier -%>',
- url: '<%= root + path -%>',
- name: '<%= escape_javascript resource.name -%>'
- },
- <%
- end
- end
- %>
- ];
+ {
+ q: '<%= resource.qualifier -%>',
+ url: '<%= root + path -%>',
+ name: '<%= escape_javascript resource.name -%>'
+ },
+ <%
+ end
+ end
+ %>
+ ]
+ });
</script>
%>
<script>
- window.navbarGlobalMenu = [
- {
- label: 'layout.dashboards',
- active: <%= selected_section==Navigation::SECTION_HOME ? 'true' : 'false' -%>,
- menu: [
- <% ActiveDashboard.user_dashboards(current_user, true).each do |active_dashboard| %>
- {
- url: '/dashboard/?did=<%= active_dashboard.dashboard_id -%>',
- labelLocalized: '<%= escape_javascript active_dashboard.dashboard.name(true) -%>',
- active: <%= @dashboard && controller.controller_path=='dashboard' && active_dashboard.dashboard_id==@dashboard.id ? 'true' : 'false' -%>
- },
- <% end %>
- ]
- },
- {
- url: '/measures/search?qualifiers[]=TRK',
- label: 'layout.measures',
- active: <%= selected_section==Navigation::SECTION_MEASURES ? 'true' : 'false' -%>
- },
- {
- url: '/issues/index',
- label: 'issues.page',
- active: <%= selected_section==Navigation::SECTION_ISSUES ? 'true' : 'false' -%>
- },
- {
- url: '/coding_rules',
- label: 'coding_rules.page',
- active: <%= selected_section==Navigation::SECTION_CODING_RULES ? 'true' : 'false' -%>
- },
- {
- url: '/profiles',
- label: 'quality_profiles.page',
- active: <%= selected_section==Navigation::SECTION_QUALITY_PROFILES ? 'true' : 'false' -%>
- },
- {
- url: '/quality_gates',
- label: 'quality_gates.page',
- active: <%= selected_section==Navigation::SECTION_QUALITY_GATES ? 'true' : 'false' -%>
- },
- {
- label: 'more',
- active: false,
- menu: [
- {
- url: '/comparison/index',
- label: 'comparison.page',
- active: <%= request.request_uri.include?('/comparison') ? 'true' : 'false' -%>
- },
- {
- url: '/dependencies/index',
- label: 'dependencies.page',
- active: <%= request.request_uri.include?('/dependencies') ? 'true' : 'false' -%>
- },
- <% controller.java_facade.getPages(Navigation::SECTION_HOME.key, nil, nil, nil, nil).each do |page|
- page_url = (page.isController() ? page.getId() : "/plugins/home/#{page.getId()}")
- selected=request.request_uri.include?("/plugins/home/#{page_url}")
- %>
- {
- url: '<%= page_url -%>',
- labelLocalized: '<%= escape_javascript message(page.getId() + '.page', :default => page.getTitle()) -%>',
- active: <%= selected ? 'true' : 'false' -%>
- },
- <% end %>
- ]
- }
- ];
+ window.navbarOptions.set({
+ globalDashboards: [
+ <% dashboards = ActiveDashboard.user_dashboards(current_user, true)
+ dashboards.each_with_index do |dashboard, index| %>
+ {
+ url: '/dashboard/?did=<%= dashboard.dashboard_id -%>',
+ name: '<%= escape_javascript dashboard.dashboard.name(true) -%>'
+ }<% if index < dashboards.size - 1 -%>, <% end %>
+ <% end %>
+ ],
+ globalPages: [
+ <% pages = controller.java_facade.getPages(Navigation::SECTION_HOME.key, nil, nil, nil, nil)
+ pages.each_with_index do |page, index|
+ %>
+ {
+ url: '<%= page.isController() ? page.getId() : "/plugins/home/#{page.getId()}" -%>',
+ name: '<%= escape_javascript message(page.getId() + '.page', :default => page.getTitle()) -%>'
+ }<% if index < pages.size - 1 -%>, <% end %>
+ <% end %>
+ ]
+ });
</script>
%>
<script>
- var navbarSpace = 'settings',
- navbarGlobalMenu = [
- {
- url: '/',
- labelLocalized: 'Home',
- active: false
- },
- {
- label: 'sidebar.project_settings',
- active: false,
- menu: [
- {
- url: '/settings/index',
- label: 'settings.page',
- active: <%= request.request_uri.include?('/settings') ? 'true' : 'false' -%>
- },
- {
- url: '/metrics/index',
- label: 'manual_metrics.page',
- active: <%= request.request_uri.include?('/metrics') ? 'true' : 'false' -%>
- },
- {
- url: '/admin_dashboards/index',
- label: 'default_dashboards.page',
- active: <%= request.request_uri.include?('/admin_dashboards') ? 'true' : 'false' -%>
- },
- <% controller.java_facade.getPages(Navigation::SECTION_CONFIGURATION.key, nil, nil, nil, nil).each do |page|
- page_url = (page.isController() ? page.getId() : "/plugins/configuration/#{page.getId()}")
- %>
- {
- url: '<%= page_url -%>',
- labelLocalized: '<%= escape_javascript message(page.getId() + '.page', :default => page.getTitle()) %>',
- active: <%= request.request_uri.include?(page_url) ? 'true' : 'false' -%>
- },
- <% end %>
- ]
- },
- {
- label: 'sidebar.security',
- active: false,
- menu: [
- {
- url: '/users',
- label: 'users.page',
- active: <%= request.request_uri.include?('/users') ? 'true' : 'false' -%>
- },
- {
- url: '/groups/index',
- label: 'user_groups.page',
- active: <%= request.request_uri.include?('/groups') ? 'true' : 'false' -%>
- },
- {
- url: '/roles/global',
- label: 'global_permissions.page',
- active: <%= request.request_uri.include?('/roles/global') ? 'true' : 'false' -%>
- },
- {
- url: '/roles/projects',
- label: 'roles.page',
- active: <%= request.request_uri.include?('/roles/projects') ? 'true' : 'false' -%>
- },
- {
- url: '/admin_dashboards/index',
- label: 'default_dashboards.page',
- active: <%= request.request_uri.include?('/admin_dashboards') ? 'true' : 'false' -%>
- }
- ]
- },
- {
- label: 'sidebar.system',
- active: false,
- menu: [
- <% if has_role?("provisioning") %>
- {
- url: '/provisioning/index',
- label: 'provisioning.page',
- active: <%= request.request_uri.include?('/provisioning') ? 'true' : 'false' -%>
- },
- <% end %>
- {
- url: '/bulk_deletion/index',
- label: 'bulk_deletion.page',
- active: <%= request.request_uri.include?('/bulk_deletion') ? 'true' : 'false' -%>
- },
- <% update_center_activated = controller.java_facade.getSettings().getBoolean('sonar.updatecenter.activate')
- if update_center_activated %>
- {
- url: '/updatecenter/index',
- label: 'update_center.page',
- active: <%= request.request_uri.include?('/updatecenter') ? 'true' : 'false' -%>
- },
- <% end %>
- {
- url: '/system/index',
- label: 'system_info.page',
- active: <%= request.request_uri.include?('/system') ? 'true' : 'false' -%>
- },
- {
- url: '/analysis_reports/index',
- label: 'analysis_reports.page',
- active: <%= request.request_uri.include?('/analysis_reports') ? 'true' : 'false' -%>
- }
- ]
- }
- ];
+ window.navbarOptions.set({
+ space: 'settings',
+ settingsPages: [
+ <% pages = controller.java_facade.getPages(Navigation::SECTION_CONFIGURATION.key, nil, nil, nil, nil)
+ pages.each_with_index do |page, index|
+ page_url = (page.isController() ? page.getId() : "/plugins/configuration/#{page.getId()}")
+ %>
+ {
+ url: '<%= page_url -%>',
+ name: '<%= escape_javascript message(page.getId() + '.page', :default => page.getTitle()) %>'
+ }<% if index < pages.size - 1 -%>, <% end %>
+ <% end %>
+ ],
+ settingsProvisioning: <%= has_role?("provisioning") -%>,
+ settingsUpdateCenter: <%= controller.java_facade.getSettings().getBoolean('sonar.updatecenter.activate') -%>
+ });
</script>
#------------------------------------------------------------------------------
clouds.page=Clouds
+overview.page=Overview
components.page=Components
coverage.page=Coverage
default_dashboards.page=Default Dashboards