From 0a06380c47424d6fd7958f3b2cf6ef28b5c8116d Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Tue, 20 Jan 2015 13:28:52 +0100 Subject: [PATCH] Reverse "SONAR-6041 New webapp layout" --- server/sonar-web/.jshintrc | 2 - server/sonar-web/Gruntfile.coffee | 11 - .../issues/component-viewer/main.coffee | 1 + .../issues/facets/severity-facet.coffee | 2 +- .../coffee/issues/facets/status-facet.coffee | 2 +- .../main/coffee/issues/filters-view.coffee | 5 + .../src/main/coffee/issues/layout.coffee | 25 +- .../issues/workspace-header-view.coffee | 5 - .../main/coffee/quality-gate/layout.coffee | 14 ++ .../hbs/coding-rules/coding-rules-filters.hbs | 9 + .../hbs/coding-rules/coding-rules-layout.hbs | 14 +- .../coding-rules-workspace-header.hbs | 10 +- .../facets/issues-creation-date-facet.hbs | 2 +- .../src/main/hbs/issues/issues-filters.hbs | 2 + .../src/main/hbs/issues/issues-layout.hbs | 14 +- .../hbs/issues/issues-workspace-header.hbs | 7 +- .../sonar-web/src/main/hbs/nav/_nav-logo.hbs | 18 -- .../src/main/hbs/nav/_nav-navbar-label.hbs | 1 - .../sonar-web/src/main/hbs/nav/nav-navbar.hbs | 84 ------- .../src/main/hbs/nav/nav-search-empty.hbs | 1 - .../src/main/hbs/nav/nav-search-item.hbs | 16 -- .../sonar-web/src/main/hbs/nav/nav-search.hbs | 6 - .../quality-gates/quality-gates-layout.hbs | 18 +- server/sonar-web/src/main/js/application.js | 21 +- .../src/main/js/coding-rules/controller.js | 1 + .../js/coding-rules/facets/severity-facet.js | 2 +- .../src/main/js/coding-rules/filters-view.js | 18 +- .../src/main/js/coding-rules/layout.js | 23 ++ .../main/js/coding-rules/rule-details-view.js | 1 + .../js/coding-rules/workspace-header-view.js | 17 +- .../js/common/selectable-collection-view.js | 62 ----- server/sonar-web/src/main/js/nav/app.js | 21 -- server/sonar-web/src/main/js/nav/navbar.js | 86 ------- .../sonar-web/src/main/js/nav/search-view.js | 154 ------------ .../main/js/third-party/bootstrap/dropdown.js | 161 ------------- server/sonar-web/src/main/js/translate.js | 8 +- .../sonar-web/src/main/less/components.less | 2 - .../src/main/less/components/dropdowns.less | 119 ---------- .../src/main/less/components/facets.less | 3 + .../src/main/less/components/issues.less | 5 +- .../src/main/less/components/menu.less | 53 ----- .../less/components/search-navigator.less | 73 +++++- server/sonar-web/src/main/less/icons.less | 3 - server/sonar-web/src/main/less/issues.less | 9 + .../sonar-web/src/main/less/layout-new.less | 90 ------- server/sonar-web/src/main/less/layout.less | 158 +++++++------ server/sonar-web/src/main/less/navbar.less | 223 ------------------ .../src/main/less/quality-gates.less | 12 +- server/sonar-web/src/main/less/style.less | 69 ++++-- server/sonar-web/src/main/less/ui.less | 34 +-- server/sonar-web/src/main/less/variables.less | 12 - .../controllers/api/components_controller.rb | 2 +- .../app/controllers/comparison_controller.rb | 2 +- .../controllers/dependencies_controller.rb | 2 +- .../webapp/WEB-INF/app/models/navigation.rb | 1 - .../app/views/coding_rules/index.html.erb | 2 - .../WEB-INF/app/views/issues/search.html.erb | 2 - .../app/views/layouts/_breadcrumb.html.erb | 162 +++++++------ .../WEB-INF/app/views/layouts/_head.html.erb | 2 +- .../app/views/layouts/_layout.html.erb | 223 +++++++++++++++--- .../WEB-INF/app/views/layouts/_logo.html.erb | 18 -- .../app/views/layouts/_menu_projects.html.erb | 46 ++++ .../app/views/layouts/_navbar.html.erb | 5 - .../app/views/layouts/_navbar_conf.html.erb | 29 --- .../layouts/_navbar_conf_global.html.erb | 76 ------ .../layouts/_navbar_conf_project.html.erb | 167 ------------- .../layouts/_navbar_conf_settings.html.erb | 109 --------- .../views/layouts/_recent_history.html.erb | 9 - .../app/views/layouts/_small_logo.html.erb | 9 - .../app/views/layouts/application.html.erb | 3 +- .../resources/org/sonar/l10n/core.properties | 1 - 71 files changed, 697 insertions(+), 1882 deletions(-) delete mode 100644 server/sonar-web/src/main/hbs/nav/_nav-logo.hbs delete mode 100644 server/sonar-web/src/main/hbs/nav/_nav-navbar-label.hbs delete mode 100644 server/sonar-web/src/main/hbs/nav/nav-navbar.hbs delete mode 100644 server/sonar-web/src/main/hbs/nav/nav-search-empty.hbs delete mode 100644 server/sonar-web/src/main/hbs/nav/nav-search-item.hbs delete mode 100644 server/sonar-web/src/main/hbs/nav/nav-search.hbs delete mode 100644 server/sonar-web/src/main/js/common/selectable-collection-view.js delete mode 100644 server/sonar-web/src/main/js/nav/app.js delete mode 100644 server/sonar-web/src/main/js/nav/navbar.js delete mode 100644 server/sonar-web/src/main/js/nav/search-view.js delete mode 100644 server/sonar-web/src/main/js/third-party/bootstrap/dropdown.js delete mode 100644 server/sonar-web/src/main/less/components/dropdowns.less delete mode 100644 server/sonar-web/src/main/less/components/menu.less delete mode 100644 server/sonar-web/src/main/less/layout-new.less delete mode 100644 server/sonar-web/src/main/less/navbar.less delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_logo.html.erb create mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_menu_projects.html.erb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar.html.erb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf.html.erb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_global.html.erb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_project.html.erb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_settings.html.erb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_recent_history.html.erb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_small_logo.html.erb diff --git a/server/sonar-web/.jshintrc b/server/sonar-web/.jshintrc index 5b2eb1b387b..2d6820a4d4c 100644 --- a/server/sonar-web/.jshintrc +++ b/server/sonar-web/.jshintrc @@ -82,9 +82,7 @@ "baseUrl": true, "key": true, "Backbone": true, - "Marionette": true, "Handlebars": true, - "Templates": true, "t": true, "tp": true, "moment": true, diff --git a/server/sonar-web/Gruntfile.coffee b/server/sonar-web/Gruntfile.coffee index 809f748df89..60b9b6b3e87 100644 --- a/server/sonar-web/Gruntfile.coffee +++ b/server/sonar-web/Gruntfile.coffee @@ -14,7 +14,6 @@ module.exports = (grunt) -> '<%= pkg.sources %>less/select2.less' '<%= pkg.sources %>less/select2-sonar.less' '<%= pkg.sources %>less/layout.less' - '<%= pkg.sources %>less/layout-new.less' '<%= pkg.sources %>less/style.less' '<%= pkg.sources %>less/icons.less' '<%= pkg.sources %>less/ui.less' @@ -34,7 +33,6 @@ module.exports = (grunt) -> '<%= pkg.sources %>less/select2.less' '<%= pkg.sources %>less/select2-sonar.less' '<%= pkg.sources %>less/layout.less' - '<%= pkg.sources %>less/layout-new.less' '<%= pkg.sources %>less/style.less' '<%= pkg.sources %>less/icons.less' '<%= pkg.sources %>less/ui.less' @@ -93,7 +91,6 @@ module.exports = (grunt) -> '<%= pkg.assets %>js/third-party/numeral.js' '<%= pkg.assets %>js/third-party/numeral-languages.js' '<%= pkg.assets %>js/third-party/bootstrap/tooltip.js' - '<%= pkg.assets %>js/third-party/bootstrap/dropdown.js' '<%= pkg.assets %>js/select2-jquery-ui-fix.js' '<%= pkg.assets %>js/widgets/base.js' '<%= pkg.assets %>js/widgets/widget.js' @@ -137,7 +134,6 @@ module.exports = (grunt) -> '<%= pkg.assets %>js/third-party/numeral.js' '<%= pkg.assets %>js/third-party/numeral-languages.js' '<%= pkg.assets %>js/third-party/bootstrap/tooltip.js' - '<%= pkg.assets %>js/third-party/bootstrap/dropdown.js' '<%= pkg.assets %>js/select2-jquery-ui-fix.js' '<%= pkg.assets %>js/widgets/base.js' '<%= pkg.assets %>js/widgets/widget.js' @@ -239,10 +235,6 @@ module.exports = (grunt) -> name: 'analysis-reports/app' out: '<%= pkg.assets %>build/js/analysis-reports/app.js' - nav: options: - name: 'nav/app' - out: '<%= pkg.assets %>build/js/nav/app.js' - handlebars: options: @@ -293,9 +285,6 @@ module.exports = (grunt) -> '<%= pkg.assets %>js/templates/analysis-reports.js': [ '<%= pkg.sources %>hbs/analysis-reports/**/*.hbs' ] - '<%= pkg.assets %>js/templates/nav.js': [ - '<%= pkg.sources %>hbs/nav/**/*.hbs' - ] clean: diff --git a/server/sonar-web/src/main/coffee/issues/component-viewer/main.coffee b/server/sonar-web/src/main/coffee/issues/component-viewer/main.coffee index 5e4acec7525..9979b1ad5ba 100644 --- a/server/sonar-web/src/main/coffee/issues/component-viewer/main.coffee +++ b/server/sonar-web/src/main/coffee/issues/component-viewer/main.coffee @@ -175,6 +175,7 @@ define [ scrollToLine: (line) -> row = @$("[data-line-number=#{line}]") goal = if row.length > 0 then row.offset().top - 200 else 0 + goal = Math.max goal, 30 $(window).scrollTop goal diff --git a/server/sonar-web/src/main/coffee/issues/facets/severity-facet.coffee b/server/sonar-web/src/main/coffee/issues/facets/severity-facet.coffee index 17d1fabaa9e..b0b605c6a09 100644 --- a/server/sonar-web/src/main/coffee/issues/facets/severity-facet.coffee +++ b/server/sonar-web/src/main/coffee/issues/facets/severity-facet.coffee @@ -11,6 +11,6 @@ define [ sortValues: (values) -> - order = ['BLOCKER', 'CRITICAL', 'MAJOR', 'MINOR', 'INFO'] + order = ['BLOCKER', 'MINOR', 'CRITICAL', 'INFO', 'MAJOR'] _.sortBy values, (v) -> order.indexOf v.val diff --git a/server/sonar-web/src/main/coffee/issues/facets/status-facet.coffee b/server/sonar-web/src/main/coffee/issues/facets/status-facet.coffee index e3f4d0015b4..8b35191eabf 100644 --- a/server/sonar-web/src/main/coffee/issues/facets/status-facet.coffee +++ b/server/sonar-web/src/main/coffee/issues/facets/status-facet.coffee @@ -11,5 +11,5 @@ define [ sortValues: (values) -> - order = ['OPEN', 'REOPENED', 'CONFIRMED', 'RESOLVED', 'CLOSED'] + order = ['OPEN', 'RESOLVED', 'REOPENED', 'CLOSED', 'CONFIRMED'] _.sortBy values, (v) -> order.indexOf v.val diff --git a/server/sonar-web/src/main/coffee/issues/filters-view.coffee b/server/sonar-web/src/main/coffee/issues/filters-view.coffee index 0b79214e605..c8ce1732134 100644 --- a/server/sonar-web/src/main/coffee/issues/filters-view.coffee +++ b/server/sonar-web/src/main/coffee/issues/filters-view.coffee @@ -12,6 +12,7 @@ define [ events: 'click .js-toggle-filters': 'toggleFilters' 'click .js-filter': 'applyFilter' + 'click .js-new-search': 'newSearch' 'click .js-filter-save-as': 'saveAs' 'click .js-filter-save': 'save' 'click .js-filter-copy': 'copy' @@ -47,6 +48,10 @@ define [ filter.fetch().done => @options.app.controller.applyFilter filter + newSearch: -> + @options.app.controller.newSearch() + + saveAs: -> query = @options.app.controller.getQuery '&' url = "#{baseUrl}/issues/save_as_form?#{query}" diff --git a/server/sonar-web/src/main/coffee/issues/layout.coffee b/server/sonar-web/src/main/coffee/issues/layout.coffee index f1854358794..6d2a60fe82b 100644 --- a/server/sonar-web/src/main/coffee/issues/layout.coffee +++ b/server/sonar-web/src/main/coffee/issues/layout.coffee @@ -18,13 +18,34 @@ define [ workspaceComponentViewerRegion: '.issues-workspace-component-viewer' + initialize: -> + $(window).on 'scroll.issues-layout', (=> @onScroll()) + + + onClose: -> + $(window).off 'scroll.issues-layout' + + + onRender: -> + @$('.search-navigator-side').isolatedScroll() + + + onScroll: -> + scrollTop = $(window).scrollTop() + $('.search-navigator').toggleClass 'sticky', scrollTop >= @topOffset + @$('.search-navigator-side').css top: Math.max(0, Math.min(@topOffset - scrollTop, @topOffset)) + + + showSpinner: (region) -> + @[region].show new Marionette.ItemView + template: _.template('') + + showComponentViewer: -> @scroll = $(window).scrollTop() $('.issues').addClass 'issues-extended-view' - @$el.closest('.container').addClass 'container-full-width' hideComponentViewer: -> $('.issues').removeClass 'issues-extended-view' $(window).scrollTop @scroll if @scroll? - @$el.closest('.container').removeClass 'container-full-width' diff --git a/server/sonar-web/src/main/coffee/issues/workspace-header-view.coffee b/server/sonar-web/src/main/coffee/issues/workspace-header-view.coffee index 2d376f362b8..b60ed4da24b 100644 --- a/server/sonar-web/src/main/coffee/issues/workspace-header-view.coffee +++ b/server/sonar-web/src/main/coffee/issues/workspace-header-view.coffee @@ -14,7 +14,6 @@ define [ events: -> _.extend super, - 'click .js-new-search': 'newSearch' 'click .js-back': 'returnToList' @@ -30,10 +29,6 @@ define [ window.onBulkIssues = @_onBulkIssues - newSearch: -> - @options.app.controller.newSearch() - - returnToList: -> @options.app.controller.closeComponentViewer() diff --git a/server/sonar-web/src/main/coffee/quality-gate/layout.coffee b/server/sonar-web/src/main/coffee/quality-gate/layout.coffee index 5a362787850..9a982cf1e02 100644 --- a/server/sonar-web/src/main/coffee/quality-gate/layout.coffee +++ b/server/sonar-web/src/main/coffee/quality-gate/layout.coffee @@ -26,6 +26,20 @@ define [ onResize: -> + footerEl = jQuery('#footer') + footerHeight = footerEl.outerHeight true + + resultsEl = jQuery('.navigator-results') + resultsHeight = jQuery(window).height() - resultsEl.offset().top - + parseInt(resultsEl.css('margin-bottom'), 10) - footerHeight + resultsEl.height resultsHeight + + detailsEl = jQuery('.navigator-details') + detailsWidth = jQuery(window).width() - detailsEl.offset().left - + parseInt(detailsEl.css('margin-right'), 10) + detailsHeight = jQuery(window).height() - detailsEl.offset().top - + parseInt(detailsEl.css('margin-bottom'), 10) - footerHeight + detailsEl.width(detailsWidth).height detailsHeight onRender: -> diff --git a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-filters.hbs b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-filters.hbs index 234ff85b91e..dc97d68a6fe 100644 --- a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-filters.hbs +++ b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-filters.hbs @@ -1,3 +1,12 @@
{{t 'coding_rules.page'}}
+ +
+
+ + {{#if canWrite}} + + {{/if}} +
+
diff --git a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-layout.hbs b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-layout.hbs index 01a9f34d8b4..8f46e4f8fb1 100644 --- a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-layout.hbs +++ b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-layout.hbs @@ -1,14 +1,10 @@ -
+
-
-
-
+
-
+
-
-
-
-
+
+
diff --git a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-workspace-header.hbs b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-workspace-header.hbs index 39fbca9aeb9..bcf70f5d3ab 100644 --- a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-workspace-header.hbs +++ b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-workspace-header.hbs @@ -21,11 +21,9 @@
{{/notNull}} -
- - {{#if canWrite}} - + {{#if canWrite}} +
- {{/if}} -
+
+ {{/if}}
diff --git a/server/sonar-web/src/main/hbs/issues/facets/issues-creation-date-facet.hbs b/server/sonar-web/src/main/hbs/issues/facets/issues-creation-date-facet.hbs index b5a65ed7145..c5b3e5dd47e 100644 --- a/server/sonar-web/src/main/hbs/issues/facets/issues-creation-date-facet.hbs +++ b/server/sonar-web/src/main/hbs/issues/facets/issues-creation-date-facet.hbs @@ -6,7 +6,7 @@ {{dt createdAt}} ({{fromNow createdAt}}) {{else}} -
+
to diff --git a/server/sonar-web/src/main/hbs/issues/issues-filters.hbs b/server/sonar-web/src/main/hbs/issues/issues-filters.hbs index 234c3996579..cd51e685651 100644 --- a/server/sonar-web/src/main/hbs/issues/issues-filters.hbs +++ b/server/sonar-web/src/main/hbs/issues/issues-filters.hbs @@ -21,6 +21,8 @@
+ + {{#if state.canManageFilters}} {{#if filter.canModify}} {{#if state.changed}}{{/if}} diff --git a/server/sonar-web/src/main/hbs/issues/issues-layout.hbs b/server/sonar-web/src/main/hbs/issues/issues-layout.hbs index b9a344806cb..f60fecfb03f 100644 --- a/server/sonar-web/src/main/hbs/issues/issues-layout.hbs +++ b/server/sonar-web/src/main/hbs/issues/issues-layout.hbs @@ -1,14 +1,10 @@ -
+
-
-
-
+
-
+
-
-
-
-
+
+
diff --git a/server/sonar-web/src/main/hbs/issues/issues-workspace-header.hbs b/server/sonar-web/src/main/hbs/issues/issues-workspace-header.hbs index 09a852bd550..93175e7c99b 100644 --- a/server/sonar-web/src/main/hbs/issues/issues-workspace-header.hbs +++ b/server/sonar-web/src/main/hbs/issues/issues-workspace-header.hbs @@ -1,6 +1,12 @@
{{#if state.component}} {{t 'issues.return_to_list'}}    + + {{#with state.component}} + {{qualifierIcon 'TRK'}} {{projectName}} +    + {{qualifierIcon qualifier}} {{name}} + {{/with}} {{else}}   {{/if}} @@ -22,7 +28,6 @@
- {{#if state.canBulkChange}} diff --git a/server/sonar-web/src/main/hbs/nav/_nav-logo.hbs b/server/sonar-web/src/main/hbs/nav/_nav-logo.hbs deleted file mode 100644 index fcb273a09ae..00000000000 --- a/server/sonar-web/src/main/hbs/nav/_nav-logo.hbs +++ /dev/null @@ -1,18 +0,0 @@ - diff --git a/server/sonar-web/src/main/hbs/nav/_nav-navbar-label.hbs b/server/sonar-web/src/main/hbs/nav/_nav-navbar-label.hbs deleted file mode 100644 index df44ac06af2..00000000000 --- a/server/sonar-web/src/main/hbs/nav/_nav-navbar-label.hbs +++ /dev/null @@ -1 +0,0 @@ -{{#if labelLocalized}}{{labelLocalized}}{{else}}{{t label}}{{/if}} diff --git a/server/sonar-web/src/main/hbs/nav/nav-navbar.hbs b/server/sonar-web/src/main/hbs/nav/nav-navbar.hbs deleted file mode 100644 index 192aa010195..00000000000 --- a/server/sonar-web/src/main/hbs/nav/nav-navbar.hbs +++ /dev/null @@ -1,84 +0,0 @@ -
- - - - - - -
diff --git a/server/sonar-web/src/main/hbs/nav/nav-search-empty.hbs b/server/sonar-web/src/main/hbs/nav/nav-search-empty.hbs deleted file mode 100644 index ccac4831661..00000000000 --- a/server/sonar-web/src/main/hbs/nav/nav-search-empty.hbs +++ /dev/null @@ -1 +0,0 @@ -{{t 'no_results'}} diff --git a/server/sonar-web/src/main/hbs/nav/nav-search-item.hbs b/server/sonar-web/src/main/hbs/nav/nav-search-item.hbs deleted file mode 100644 index 1de73f23eab..00000000000 --- a/server/sonar-web/src/main/hbs/nav/nav-search-item.hbs +++ /dev/null @@ -1,16 +0,0 @@ - - {{#if extra}} - {{extra}} - {{/if}} - {{#if q}}{{qualifierIcon q}}{{/if}} - {{#if subtitle}} - {{title}} -
- {{#if extra}} -   - {{/if}} - {{subtitle}} - {{else}} - {{name}} - {{/if}} -
diff --git a/server/sonar-web/src/main/hbs/nav/nav-search.hbs b/server/sonar-web/src/main/hbs/nav/nav-search.hbs deleted file mode 100644 index a5059642f99..00000000000 --- a/server/sonar-web/src/main/hbs/nav/nav-search.hbs +++ /dev/null @@ -1,6 +0,0 @@ - - - - -
diff --git a/server/sonar-web/src/main/hbs/quality-gates/quality-gates-layout.hbs b/server/sonar-web/src/main/hbs/quality-gates/quality-gates-layout.hbs index 84e5825a118..22f6fba05e7 100644 --- a/server/sonar-web/src/main/hbs/quality-gates/quality-gates-layout.hbs +++ b/server/sonar-web/src/main/hbs/quality-gates/quality-gates-layout.hbs @@ -1,8 +1,10 @@ -
- - -
-
- - -
+ \ No newline at end of file diff --git a/server/sonar-web/src/main/js/application.js b/server/sonar-web/src/main/js/application.js index ca0bf4dab29..a1c209a82b6 100644 --- a/server/sonar-web/src/main/js/application.js +++ b/server/sonar-web/src/main/js/application.js @@ -21,13 +21,13 @@ function toggleFav(resourceId, elt) { }}); } -function dashboardParameters (urlHasSomething) { +function dashboardParameters() { var queryString = window.location.search; - var parameters = []; + var parameters = ''; var matchDashboard = queryString.match(/did=\d+/); if (matchDashboard && $j('#is-project-dashboard').length === 1) { - parameters.push(matchDashboard[0]); + parameters += (matchDashboard[0] + '&'); } var matchPeriod = queryString.match(/period=\d+/); @@ -35,15 +35,14 @@ function dashboardParameters (urlHasSomething) { // If we have a match for period, check that it is not project-specific var period = parseInt(/period=(\d+)/.exec(queryString)[1]); if (period <= 3) { - parameters.push(matchPeriod[0]); + parameters += matchPeriod[0] + '&'; } } - var query = parameters.join('&'); - if (query !== '') { - query = (urlHasSomething ? '&' : '?') + query; + if (parameters !== '') { + parameters = '?' + parameters; } - return query; + return parameters; } @@ -341,7 +340,11 @@ jQuery(function () { // Define global shortcuts key('s', function () { - jQuery('.js-search-dropdown-toggle').dropdown('toggle'); + jQuery('#searchInput').focus().on('keydown', function (e) { + if (e.keyCode === 27) { + jQuery('#searchInput').blur(); + } + }); return false; }); }); diff --git a/server/sonar-web/src/main/js/coding-rules/controller.js b/server/sonar-web/src/main/js/coding-rules/controller.js index 168fece4780..6a502e4a0e8 100644 --- a/server/sonar-web/src/main/js/coding-rules/controller.js +++ b/server/sonar-web/src/main/js/coding-rules/controller.js @@ -127,6 +127,7 @@ define([ this.app.layout.workspaceDetailsRegion.reset(); this.app.layout.hideDetails(); this.app.workspaceListView.bindScrollEvents(); + this.app.workspaceListView.scrollTo(); } }); diff --git a/server/sonar-web/src/main/js/coding-rules/facets/severity-facet.js b/server/sonar-web/src/main/js/coding-rules/facets/severity-facet.js index cf466543361..3623762bd26 100644 --- a/server/sonar-web/src/main/js/coding-rules/facets/severity-facet.js +++ b/server/sonar-web/src/main/js/coding-rules/facets/severity-facet.js @@ -5,7 +5,7 @@ define([ return BaseFacet.extend({ template: Templates['coding-rules-severity-facet'], - severities: ['BLOCKER', 'CRITICAL', 'MAJOR', 'MINOR', 'INFO'], + severities: ['BLOCKER', 'MINOR', 'CRITICAL', 'INFO', 'MAJOR'], sortValues: function (values) { var order = this.severities; diff --git a/server/sonar-web/src/main/js/coding-rules/filters-view.js b/server/sonar-web/src/main/js/coding-rules/filters-view.js index 0c0c74a9ce3..451790ea2b6 100644 --- a/server/sonar-web/src/main/js/coding-rules/filters-view.js +++ b/server/sonar-web/src/main/js/coding-rules/filters-view.js @@ -1,10 +1,26 @@ define([ + 'coding-rules/rule/manual-rule-creation-view', 'templates/coding-rules' -], function () { +], function (ManualRuleCreationView) { return Marionette.ItemView.extend({ template: Templates['coding-rules-filters'], + events: { + 'click .js-new-search': 'newSearch', + 'click .js-create-manual-rule': 'createManualRule' + }, + + newSearch: function () { + this.options.app.controller.newSearch(); + }, + + createManualRule: function() { + new ManualRuleCreationView({ + app: this.options.app + }).render(); + }, + serializeData: function () { return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { canWrite: this.options.app.canWrite diff --git a/server/sonar-web/src/main/js/coding-rules/layout.js b/server/sonar-web/src/main/js/coding-rules/layout.js index b71a89ad59a..412b832f9b9 100644 --- a/server/sonar-web/src/main/js/coding-rules/layout.js +++ b/server/sonar-web/src/main/js/coding-rules/layout.js @@ -16,6 +16,29 @@ define([ workspaceDetailsRegion: '.search-navigator-workspace-details' }, + initialize: function () { + var that = this; + $(window).on('scroll.search-navigator-layout', function () { + that.onScroll(); + }); + }, + + onClose: function () { + $(window).off('scroll.search-navigator-layout'); + }, + + onRender: function () { + this.$('.search-navigator-side').isolatedScroll(); + }, + + onScroll: function () { + var scrollTop = $(window).scrollTop(); + $('.search-navigator').toggleClass('sticky', scrollTop >= this.topOffset); + this.$('.search-navigator-side').css({ + top: Math.max(0, Math.min(this.topOffset - scrollTop, this.topOffset)) + }); + }, + showDetails: function () { this.scroll = $(window).scrollTop(); $('.search-navigator').addClass('search-navigator-extended-view'); diff --git a/server/sonar-web/src/main/js/coding-rules/rule-details-view.js b/server/sonar-web/src/main/js/coding-rules/rule-details-view.js index ef550bb876d..95475fe7b5a 100644 --- a/server/sonar-web/src/main/js/coding-rules/rule-details-view.js +++ b/server/sonar-web/src/main/js/coding-rules/rule-details-view.js @@ -73,6 +73,7 @@ define([ app: this.options.app, model: this.model })); + this.$el.scrollParent().scrollTop(30); }, onClose: function () { diff --git a/server/sonar-web/src/main/js/coding-rules/workspace-header-view.js b/server/sonar-web/src/main/js/coding-rules/workspace-header-view.js index 7d40501f109..cbcebe2db72 100644 --- a/server/sonar-web/src/main/js/coding-rules/workspace-header-view.js +++ b/server/sonar-web/src/main/js/coding-rules/workspace-header-view.js @@ -1,9 +1,8 @@ define([ 'components/navigator/workspace-header-view', 'coding-rules/bulk-change-popup-view', - 'coding-rules/rule/manual-rule-creation-view', 'templates/coding-rules' -], function (WorkspaceHeaderView, BulkChangePopup, ManualRuleCreationView) { +], function (WorkspaceHeaderView, BulkChangePopup) { var $ = jQuery; @@ -13,9 +12,7 @@ define([ events: function () { return _.extend(WorkspaceHeaderView.prototype.events.apply(this, arguments), { 'click .js-back': 'onBackClick', - 'click .js-bulk-change': 'onBulkChangeClick', - 'click .js-new-search': 'newSearch', - 'click .js-create-manual-rule': 'createManualRule' + 'click .js-bulk-change': 'onBulkChangeClick' }); }, @@ -33,16 +30,6 @@ define([ }).render(); }, - newSearch: function () { - this.options.app.controller.newSearch(); - }, - - createManualRule: function() { - new ManualRuleCreationView({ - app: this.options.app - }).render(); - }, - serializeData: function () { return _.extend(WorkspaceHeaderView.prototype.serializeData.apply(this, arguments), { canWrite: this.options.app.canWrite diff --git a/server/sonar-web/src/main/js/common/selectable-collection-view.js b/server/sonar-web/src/main/js/common/selectable-collection-view.js deleted file mode 100644 index 6ddce02f574..00000000000 --- a/server/sonar-web/src/main/js/common/selectable-collection-view.js +++ /dev/null @@ -1,62 +0,0 @@ -define(function () { - - return Marionette.CollectionView.extend({ - - initialize: function () { - this.resetSelectedIndex(); - this.listenTo(this.collection, 'reset', this.resetSelectedIndex); - }, - - resetSelectedIndex: function () { - this.selectedIndex = 0; - }, - - onRender: function () { - this.selectCurrent(); - }, - - submitCurrent: function () { - var view = this.children.findByIndex(this.selectedIndex); - if (view != null) { - view.submit(); - } - }, - - selectCurrent: function () { - this.selectItem(this.selectedIndex); - }, - - selectNext: function () { - if (this.selectedIndex < this.collection.length - 1) { - this.deselectItem(this.selectedIndex); - this.selectedIndex++; - this.selectItem(this.selectedIndex); - } - }, - - selectPrev: function () { - if (this.selectedIndex > 0) { - this.deselectItem(this.selectedIndex); - this.selectedIndex--; - this.selectItem(this.selectedIndex); - } - }, - - selectItem: function (index) { - if (index >= 0 && index < this.collection.length) { - var view = this.children.findByIndex(index); - if (view != null) { - view.select(); - } - } - }, - - deselectItem: function (index) { - var view = this.children.findByIndex(index); - if (view != null) { - view.deselect(); - } - } - }); - -}); diff --git a/server/sonar-web/src/main/js/nav/app.js b/server/sonar-web/src/main/js/nav/app.js deleted file mode 100644 index f6295eea637..00000000000 --- a/server/sonar-web/src/main/js/nav/app.js +++ /dev/null @@ -1,21 +0,0 @@ -define([ - 'nav/navbar' -], function (NavbarView) { - - var $ = jQuery, - App = new Marionette.Application(); - - App.addInitializer(function () { - this.navbarView = new NavbarView({ - app: App, - el: $('.navbar'), - collection: new Backbone.Collection(window.navbarItems) - }); - this.navbarView.render(); - }); - - window.requestMessages().done(function () { - App.start(); - }); - -}); diff --git a/server/sonar-web/src/main/js/nav/navbar.js b/server/sonar-web/src/main/js/nav/navbar.js deleted file mode 100644 index e39268e321a..00000000000 --- a/server/sonar-web/src/main/js/nav/navbar.js +++ /dev/null @@ -1,86 +0,0 @@ -define([ - 'nav/search-view', - 'templates/nav' -], function (SearchView) { - - var $ = jQuery; - - return Marionette.Layout.extend({ - tagName: 'nav', - template: Templates['nav-navbar'], - - regions: { - searchRegion: '.js-search-region' - }, - - events: { - 'click .js-login': 'onLoginClick', - 'click .js-favorite': 'onFavoriteClick', - 'show.bs.dropdown .js-search-dropdown': 'onSearchDropdownShow', - '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); - this.$el.addClass('navbar-fade'); - setTimeout(function () { - that.$el.addClass('in'); - }, 0); - }, - - onLoginClick: function () { - var returnTo = window.location.pathname + window.location.search; - window.location = baseUrl + '/sessions/new?return_to=' + encodeURIComponent(returnTo) + window.location.hash; - return false; - }, - - onFavoriteClick: function () { - var that = this, - p = window.process.addBackgroundProcess(), - url = baseUrl + '/favourites/toggle/' + window.navbarProjectId; - return $.post(url).done(function () { - that.isProjectFavorite = !that.isProjectFavorite; - that.render(); - window.process.finishBackgroundProcess(p); - }).fail(function () { - window.process.failBackgroundProcess(p); - }); - }, - - onSearchDropdownShow: function () { - var that = this; - this.searchRegion.show(new SearchView({ - hide: function () { - that.$('.js-search-dropdown-toggle').dropdown('toggle'); - } - })); - }, - - onSearchDropdownHidden: function () { - this.searchRegion.reset(); - }, - - serializeData: function () { - return _.extend(Marionette.Layout.prototype.serializeData.apply(this, arguments), { - user: window.SS.user, - userName: window.SS.userName, - isUserAdmin: window.SS.isUserAdmin, - - space: window.navbarSpace, - - projectName: this.projectName, - projectKey: this.projectKey, - projectFavorite: this.isProjectFavorite, - navbarCanFavoriteProject: window.navbarCanFavoriteProject - }); - } - }); - -}); diff --git a/server/sonar-web/src/main/js/nav/search-view.js b/server/sonar-web/src/main/js/nav/search-view.js deleted file mode 100644 index 6efd0ca8f92..00000000000 --- a/server/sonar-web/src/main/js/nav/search-view.js +++ /dev/null @@ -1,154 +0,0 @@ -define([ - 'common/selectable-collection-view', - 'templates/nav' -], function (SelectableCollectionView) { - - var $ = jQuery, - - SearchItemView = Marionette.ItemView.extend({ - tagName: 'li', - template: Templates['nav-search-item'], - - select: function () { - this.$el.addClass('active'); - }, - - deselect: function () { - this.$el.removeClass('active'); - }, - - submit: function () { - this.$('a')[0].click(); - } - }), - - SearchEmptyView = Marionette.ItemView.extend({ - tagName: 'li', - template: Templates['nav-search-empty'] - }), - - SearchResultsView = SelectableCollectionView.extend({ - className: 'menu', - tagName: 'ul', - itemView: SearchItemView, - emptyView: SearchEmptyView - }); - - return Marionette.Layout.extend({ - className: 'navbar-search', - tagName: 'form', - template: Templates['nav-search'], - - regions: { - resultsRegion: '.js-search-results' - }, - - events: { - 'submit': 'onSubmit', - 'keydown .js-search-input': 'onKeyDown', - 'keyup .js-search-input': 'debouncedOnKeyUp' - }, - - initialize: function () { - this.results = new Backbone.Collection(); - this.resetResultsToDefault(); - this.resultsView = new SearchResultsView({ collection: this.results }); - this.debouncedOnKeyUp = _.debounce(this.onKeyUp, 400); - this._bufferedValue = ''; - }, - - onRender: function () { - var that = this; - this.resultsRegion.show(this.resultsView); - setTimeout(function () { - that.$('.js-search-input').focus(); - }, 0); - }, - - onKeyDown: function (e) { - if (e.keyCode === 38) { - this.resultsView.selectPrev(); - return false; - } - if (e.keyCode === 40) { - this.resultsView.selectNext(); - return false; - } - if (e.keyCode === 13) { - this.resultsView.submitCurrent(); - return false; - } - if (e.keyCode === 27) { - this.options.hide(); - return false; - } - }, - - onKeyUp: function () { - var value = this.$('.js-search-input').val(); - if (value === this._bufferedValue) { - return; - } - this._bufferedValue = this.$('.js-search-input').val(); - this.search(value); - }, - - onSubmit: function () { - return false; - }, - - resetResultsToDefault: function () { - var recentHistory = JSON.parse(localStorage.getItem('sonar_recent_history')), - history = (recentHistory || []).map(function (historyItem) { - return { - url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(historyItem.key) + dashboardParameters(true), - name: historyItem.name, - q: historyItem.icon - }; - }), - qualifiers = window.navbarQualifiers.map(function (q) { - return { - url: baseUrl + '/all_projects?qualifier=' + encodeURIComponent(q), - name: t('qualifiers.all', q) - }; - }); - this.results.reset(history.concat(qualifiers)); - }, - - search: function (q) { - if (q.length < 2) { - this.resetResultsToDefault(); - return; - } - var that = this, - url = baseUrl + '/api/components/suggestions', - options = { s: q }, - p = window.process.addBackgroundProcess(); - return $.get(url, options).done(function (r) { - var collection = []; - r.results.forEach(function (domain) { - domain.items.forEach(function (item, index) { - var title = item.name, - subtitle = null; - if (domain.q === 'FIL' || domain.q === 'UTS') { - subtitle = title.substr(0, title.lastIndexOf('/') - 1); - title = title.substr(title.lastIndexOf('/') + 1); - } - collection.push(_.extend(item, { - q: domain.q, - title: title, - subtitle: subtitle, - extra: index === 0 ? domain.name : ' ', - url: baseUrl + '/dashboard/index?id=' + encodeURIComponent(item.key) + dashboardParameters(true) - })); - }); - }); - that.results.reset(collection); - window.process.finishBackgroundProcess(p); - }).fail(function() { - window.process.failBackgroundProcess(p); - }); - } - }); - -}); diff --git a/server/sonar-web/src/main/js/third-party/bootstrap/dropdown.js b/server/sonar-web/src/main/js/third-party/bootstrap/dropdown.js deleted file mode 100644 index 980424d635e..00000000000 --- a/server/sonar-web/src/main/js/third-party/bootstrap/dropdown.js +++ /dev/null @@ -1,161 +0,0 @@ -/* ======================================================================== - * Bootstrap: dropdown.js v3.3.1 - * http://getbootstrap.com/javascript/#dropdowns - * ======================================================================== - * Copyright 2011-2015 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // DROPDOWN CLASS DEFINITION - // ========================= - - var backdrop = '.dropdown-backdrop' - var toggle = '[data-toggle="dropdown"]' - var Dropdown = function (element) { - $(element).on('click.bs.dropdown', this.toggle) - } - - Dropdown.VERSION = '3.3.1' - - Dropdown.prototype.toggle = function (e) { - var $this = $(this) - - if ($this.is('.disabled, :disabled')) return - - var $parent = getParent($this) - var isActive = $parent.hasClass('open') - - clearMenus() - - if (!isActive) { - if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { - // if mobile we use a backdrop because click events don't delegate - $(' @@ -73,8 +225,7 @@

The embedded database will not scale, it will not support upgrading to newer versions of SonarQube, and there is no support for migrating your data out of it into a different database engine. <% end %>
- +
<% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_logo.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_logo.html.erb deleted file mode 100644 index 51f0c126f18..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_logo.html.erb +++ /dev/null @@ -1,18 +0,0 @@ - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_menu_projects.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_menu_projects.html.erb new file mode 100644 index 00000000000..4d18b7b330c --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_menu_projects.html.erb @@ -0,0 +1,46 @@ + + +
  • + + <%= message('layout.projects') -%> + + + + + +
  • + + diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar.html.erb deleted file mode 100644 index fd8d74e7348..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<%= render 'layouts/navbar_conf' -%> -<%= render 'layouts/recent_history' -%> - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf.html.erb deleted file mode 100644 index d2a4eca1461..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -<% - selected_section = controller.class::SECTION if defined?(controller.class::SECTION) - if selected_section==Navigation::SECTION_RESOURCE && !@project && !@resource - selected_section = Navigation::SECTION_HOME - end - @project=@resource unless @project || selected_section==Navigation::SECTION_HOME - period_param = "period=#{u(params[:period])}" if params[:period] - displayed_resource = @resource || @project - display_only_root = @issue - resource_id=displayed_resource ? (displayed_resource.is_a?(Fixnum) ? displayed_resource : displayed_resource.permanent_id) : nil -%> - -<% if selected_section==Navigation::SECTION_RESOURCE %> - <%= render :partial => 'layouts/navbar_conf_project' %> -<% elsif selected_section==Navigation::SECTION_CONFIGURATION %> - <%= render :partial => 'layouts/navbar_conf_settings' %> -<% else %> - <%= render :partial => 'layouts/navbar_conf_global' %> -<% end %> - - - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_global.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_global.html.erb deleted file mode 100644 index 6c196369401..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_global.html.erb +++ /dev/null @@ -1,76 +0,0 @@ -<% - selected_section = controller.class::SECTION if defined?(controller.class::SECTION) - if selected_section==Navigation::SECTION_RESOURCE && !@project && !@resource - selected_section = Navigation::SECTION_HOME - end -%> - - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_project.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_project.html.erb deleted file mode 100644 index a2841ae3a2c..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_project.html.erb +++ /dev/null @@ -1,167 +0,0 @@ -<% - @project=@resource unless @project || selected_section==Navigation::SECTION_HOME - period_param = "period=#{u(params[:period])}" if params[:period] - displayed_resource = @resource || @project - display_only_root = @issue - resource_id=displayed_resource ? (displayed_resource.is_a?(Fixnum) ? displayed_resource : displayed_resource.permanent_id) : nil -%> - - - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_settings.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_settings.html.erb deleted file mode 100644 index 910fdfcc639..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_settings.html.erb +++ /dev/null @@ -1,109 +0,0 @@ -<% - selected_section = controller.class::SECTION if defined?(controller.class::SECTION) - if selected_section==Navigation::SECTION_RESOURCE && !@project && !@resource - selected_section = Navigation::SECTION_HOME - end -%> - - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_recent_history.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_recent_history.html.erb deleted file mode 100644 index 51b81a44d3f..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_recent_history.html.erb +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_small_logo.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_small_logo.html.erb deleted file mode 100644 index a7029b5ae50..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_small_logo.html.erb +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/application.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/application.html.erb index 52e8974dc14..3c67adf30b2 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/application.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/application.html.erb @@ -10,10 +10,9 @@ end %> <%= render :partial => 'layouts/head' unless params[:hd]=='false' %> -<%= render :partial => 'layouts/navbar' %> <% if params[:layout]=='false' %> <%= render :partial => 'layouts/nolayout' %> <% else %> <%= render :partial => 'layouts/layout' %> <% end %> -<%= render :partial => 'layouts/footer' unless params[:hd]=='false' %> +<%= render :partial => 'layouts/footer' unless params[:hd]=='false' %> \ No newline at end of file diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 9b39bc3135a..8e3508a85d4 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -427,7 +427,6 @@ layout.sonar.slogan=Embrace Quality layout.dashboards=Dashboards layout.configuration=Project Configuration layout.projects=Projects -layout.tools=Tools layout.recent_projects=Recent Projects layout.user_panel.my_profile=My profile -- 2.39.5