diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-04-16 12:16:20 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-04-16 12:16:29 +0200 |
commit | 8e95c83dd117559e9d0f87c6133e04bbf801d982 (patch) | |
tree | 51502f07294107385aba7a83e7a63f9619d56d2d /server | |
parent | 598bce548a3420f88ab89e1dc6bc4b2ca24a808c (diff) | |
download | sonarqube-8e95c83dd117559e9d0f87c6133e04bbf801d982.tar.gz sonarqube-8e95c83dd117559e9d0f87c6133e04bbf801d982.zip |
SONAR-6425 Links to project page extensions do not exist in the navigation
Diffstat (limited to 'server')
3 files changed, 20 insertions, 4 deletions
diff --git a/server/sonar-web/src/main/hbs/nav/nav-context-navbar.hbs b/server/sonar-web/src/main/hbs/nav/nav-context-navbar.hbs index b86d833e3d9..4d639ec0351 100644 --- a/server/sonar-web/src/main/hbs/nav/nav-context-navbar.hbs +++ b/server/sonar-web/src/main/hbs/nav/nav-context-navbar.hbs @@ -70,6 +70,11 @@ <a href="{{link '/comparison/index?resource=' contextKey}}">{{t 'comparison.page'}}</a> </li> {{/if}} + {{#each contextExtensions}} + <li> + <a href="{{link url}}">{{label}}</a> + </li> + {{/each}} </ul> </li> </ul> diff --git a/server/sonar-web/src/main/js/nav/context-navbar-view.js b/server/sonar-web/src/main/js/nav/context-navbar-view.js index 6107a4276a2..dd31145c4ce 100644 --- a/server/sonar-web/src/main/js/nav/context-navbar-view.js +++ b/server/sonar-web/src/main/js/nav/context-navbar-view.js @@ -22,8 +22,8 @@ define([ ], function () { var $ = jQuery, - OVERVIEW_URLS = [ - '/design', '/libraries', '/dashboards' + MORE_URLS = [ + '/design', '/libraries', '/dashboards', '/plugins/resource' ], SETTINGS_URLS = [ '/project/settings', '/project/profile', '/project/qualitygate', '/manual_measures/index', @@ -61,14 +61,13 @@ define([ serializeData: function () { var href = window.location.href, search = window.location.search, - isMoreActive = _.some(OVERVIEW_URLS, function (url) { + isMoreActive = _.some(MORE_URLS, function (url) { return href.indexOf(url) !== -1; }) || (href.indexOf('/dashboard') !== -1 && search.indexOf('did=') !== -1), isSettingsActive = _.some(SETTINGS_URLS, function (url) { return href.indexOf(url) !== -1; }), isOverviewActive = !isMoreActive && href.indexOf('/dashboard') !== -1 && search.indexOf('did=') === -1; - return _.extend(Marionette.Layout.prototype.serializeData.apply(this, arguments), { canManageContextDashboards: !!window.SS.user, contextKeyEncoded: encodeURIComponent(this.model.get('contextKey')), diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_context.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_context.html.erb index e1e92313c2b..cbd190fe575 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_context.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_context.html.erb @@ -29,6 +29,18 @@ name: '<%= escape_javascript active_dashboard.dashboard.name(true) -%>' }<% if index < dashboards.size - 1 -%>, <% end %> <% end %> + ], + contextExtensions: [ + <% project_metrics = @project.last_snapshot.metric_keys.to_java(:string) if @project.last_snapshot + pages = controller.java_facade.getPages(Navigation::SECTION_RESOURCE.key, @project.scope, @project.qualifier, @project.language, project_metrics) + pages.each_with_index do |page, index| + page_url = (page.isController() ? "#{page.getId()}?id=#{@project.id}" : "/plugins/resource/#{@project.id}?page=#{page.getId()}") + %> + { + url: '<%= page_url -%>', + label: '<%= escape_javascript message(page.getId() + '.page', :default => page.getTitle()) -%>' + }<% if index < pages.size - 1 -%>, <% end %> + <% end %> ] }); |