From 060921921d920e9f4942885507a7296424ddf08c Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Thu, 17 Nov 2016 16:46:48 -0700 Subject: Remove fixed positioning from navbar --- app/assets/stylesheets/framework/nav.scss | 4 ---- app/assets/stylesheets/framework/sidebar.scss | 2 +- app/views/layouts/header/_default.html.haml | 2 +- spec/javascripts/fixtures/header.html.haml | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/assets/stylesheets/framework/nav.scss b/app/assets/stylesheets/framework/nav.scss index fd081c2d7e1..d62f34ccb85 100644 --- a/app/assets/stylesheets/framework/nav.scss +++ b/app/assets/stylesheets/framework/nav.scss @@ -283,10 +283,7 @@ } .layout-nav { - position: fixed; - top: $header-height; width: 100%; - z-index: 11; background: $gray-light; border-bottom: 1px solid $border-color; transition: padding $sidebar-transition-duration; @@ -419,7 +416,6 @@ } .page-with-layout-nav { - margin-top: $header-height + 2; .right-sidebar { top: ($header-height * 2) + 2; diff --git a/app/assets/stylesheets/framework/sidebar.scss b/app/assets/stylesheets/framework/sidebar.scss index f0b03710c79..41e50ce7bb9 100644 --- a/app/assets/stylesheets/framework/sidebar.scss +++ b/app/assets/stylesheets/framework/sidebar.scss @@ -1,5 +1,5 @@ .page-with-sidebar { - padding: $header-height 0 25px; + padding-bottom: 25px; transition: padding $sidebar-transition-duration; &.page-sidebar-pinned { diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml index 9ecc0d11c95..59082ce5fd5 100644 --- a/app/views/layouts/header/_default.html.haml +++ b/app/views/layouts/header/_default.html.haml @@ -1,4 +1,4 @@ -%header.navbar.navbar-fixed-top.navbar-gitlab{ class: nav_header_class } +%header.navbar.navbar-gitlab{ class: nav_header_class } %a.sr-only.gl-accessibility{ href: "#content-body", tabindex: "1" } Skip to content .container-fluid .header-content diff --git a/spec/javascripts/fixtures/header.html.haml b/spec/javascripts/fixtures/header.html.haml index 4db2ef604de..f397f69e753 100644 --- a/spec/javascripts/fixtures/header.html.haml +++ b/spec/javascripts/fixtures/header.html.haml @@ -1,4 +1,4 @@ -%header.navbar.navbar-fixed-top.navbar-gitlab.nav_header_class +%header.navbar.navbar-gitlab.nav_header_class .container-fluid .header-content %button.side-nav-toggle -- cgit v1.2.1 From eefbc2bf738b9b715aad3777868d4dbeaadf612e Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Fri, 18 Nov 2016 13:45:51 -0700 Subject: Fix sidebar scrolling --- app/assets/javascripts/build.js | 6 ++++++ app/assets/stylesheets/framework/sidebar.scss | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/build.js b/app/assets/javascripts/build.js index 0152be88b48..a378e5e27b8 100644 --- a/app/assets/javascripts/build.js +++ b/app/assets/javascripts/build.js @@ -68,9 +68,15 @@ Build.prototype.initSidebar = function() { this.$sidebar = $('.js-build-sidebar'); this.sidebarTranslationLimits = { +<<<<<<< 3ee255139ab555ec49a177d3b2eed65580f36c4f min: $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight() }; this.sidebarTranslationLimits.max = this.sidebarTranslationLimits.min + $('.scrolling-tabs-container').outerHeight(); +======= + min: 0 + } + this.sidebarTranslationLimits.max = $('.scrolling-tabs-container').outerHeight() + $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight(); +>>>>>>> Fix sidebar scrolling this.$sidebar.css({ top: this.sidebarTranslationLimits.max }); diff --git a/app/assets/stylesheets/framework/sidebar.scss b/app/assets/stylesheets/framework/sidebar.scss index 41e50ce7bb9..d60661222e9 100644 --- a/app/assets/stylesheets/framework/sidebar.scss +++ b/app/assets/stylesheets/framework/sidebar.scss @@ -208,7 +208,9 @@ header.header-sidebar-pinned { padding-right: 0; @media (min-width: $screen-sm-min) { - padding-right: $sidebar_collapsed_width; + .content-wrapper { + padding-right: $sidebar_collapsed_width; + } .merge-request-tabs-holder.affix { right: $sidebar_collapsed_width; @@ -234,7 +236,9 @@ header.header-sidebar-pinned { } @media (min-width: $screen-md-min) { - padding-right: $gutter_width; + .content-wrapper { + padding-right: $gutter_width; + } &:not(.with-overlay) .merge-request-tabs-holder.affix { right: $gutter_width; -- cgit v1.2.1 From a11e798aa0fdc2f67bdc0fc5ad611a6872af0e9f Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Wed, 4 Jan 2017 12:21:28 -0600 Subject: Keep sidebars absolute until fixed at top; remove unneeded JS --- app/assets/javascripts/build.js | 12 +++--------- app/assets/javascripts/merge_request_tabs.js.es6 | 2 +- app/assets/stylesheets/framework/nav.scss | 10 ++++++++-- app/assets/stylesheets/framework/sidebar.scss | 5 +++++ app/assets/stylesheets/pages/issuable.scss | 3 ++- app/assets/stylesheets/pages/merge_requests.scss | 2 +- app/assets/stylesheets/pages/tree.scss | 2 -- app/views/projects/builds/_sidebar.html.haml | 2 +- 8 files changed, 21 insertions(+), 17 deletions(-) diff --git a/app/assets/javascripts/build.js b/app/assets/javascripts/build.js index a378e5e27b8..eed447d54a0 100644 --- a/app/assets/javascripts/build.js +++ b/app/assets/javascripts/build.js @@ -67,6 +67,7 @@ Build.prototype.initSidebar = function() { this.$sidebar = $('.js-build-sidebar'); +<<<<<<< 36beffc12461d2e479ad8b000b7ba5b6ea40cd33 this.sidebarTranslationLimits = { <<<<<<< 3ee255139ab555ec49a177d3b2eed65580f36c4f min: $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight() @@ -80,9 +81,10 @@ this.$sidebar.css({ top: this.sidebarTranslationLimits.max }); +======= +>>>>>>> Keep sidebars absolute until fixed at top; remove unneeded JS this.$sidebar.niceScroll(); this.$document.off('click', '.js-sidebar-build-toggle').on('click', '.js-sidebar-build-toggle', this.toggleSidebar); - this.$document.off('scroll.translateSidebar').on('scroll.translateSidebar', this.translateSidebar.bind(this)); }; Build.prototype.location = function() { @@ -237,14 +239,6 @@ return bootstrapBreakpoint === 'xs' || bootstrapBreakpoint === 'sm'; }; - Build.prototype.translateSidebar = function(e) { - var newPosition = this.sidebarTranslationLimits.max - (document.body.scrollTop || document.documentElement.scrollTop); - if (newPosition < this.sidebarTranslationLimits.min) newPosition = this.sidebarTranslationLimits.min; - this.$sidebar.css({ - top: newPosition - }); - }; - Build.prototype.toggleSidebar = function(shouldHide) { var shouldShow = typeof shouldHide === 'boolean' ? !shouldHide : undefined; this.$buildScroll.toggleClass('sidebar-expanded', shouldShow) diff --git a/app/assets/javascripts/merge_request_tabs.js.es6 b/app/assets/javascripts/merge_request_tabs.js.es6 index af1ba9ecaf3..e74658d59bd 100644 --- a/app/assets/javascripts/merge_request_tabs.js.es6 +++ b/app/assets/javascripts/merge_request_tabs.js.es6 @@ -337,7 +337,7 @@ require('./flash'); .affix({ offset: { top: () => ( - $diffTabs.offset().top - $tabs.height() - $fixedNav.height() - $layoutNav.height() + $diffTabs.offset().top - $tabs.height() ), }, }) diff --git a/app/assets/stylesheets/framework/nav.scss b/app/assets/stylesheets/framework/nav.scss index d62f34ccb85..674d3bb45aa 100644 --- a/app/assets/stylesheets/framework/nav.scss +++ b/app/assets/stylesheets/framework/nav.scss @@ -416,14 +416,20 @@ } .page-with-layout-nav { - .right-sidebar { top: ($header-height * 2) + 2; } + + .build-sidebar { + top: ($header-height * 3) + 3; + + &.affix { + top: 0; + } + } } .activities { - .nav-block { border-bottom: 1px solid $border-color; diff --git a/app/assets/stylesheets/framework/sidebar.scss b/app/assets/stylesheets/framework/sidebar.scss index d60661222e9..20bcb1eeb23 100644 --- a/app/assets/stylesheets/framework/sidebar.scss +++ b/app/assets/stylesheets/framework/sidebar.scss @@ -256,4 +256,9 @@ header.header-sidebar-pinned { .right-sidebar { border-left: 1px solid $border-color; + + &.affix { + position: fixed; + top: 0; + } } diff --git a/app/assets/stylesheets/pages/issuable.scss b/app/assets/stylesheets/pages/issuable.scss index 1a53730bed5..130103a2702 100644 --- a/app/assets/stylesheets/pages/issuable.scss +++ b/app/assets/stylesheets/pages/issuable.scss @@ -189,7 +189,8 @@ } .right-sidebar { - position: fixed; + position: absolute; + height: 100%; top: $header-height; bottom: 0; right: 0; diff --git a/app/assets/stylesheets/pages/merge_requests.scss b/app/assets/stylesheets/pages/merge_requests.scss index 1431673027f..c02a65b0903 100644 --- a/app/assets/stylesheets/pages/merge_requests.scss +++ b/app/assets/stylesheets/pages/merge_requests.scss @@ -479,7 +479,7 @@ background-color: $white-light; &.affix { - top: 100px; + top: 0; left: 0; z-index: 10; transition: right .15s; diff --git a/app/assets/stylesheets/pages/tree.scss b/app/assets/stylesheets/pages/tree.scss index 948921efc0b..8fafe472621 100644 --- a/app/assets/stylesheets/pages/tree.scss +++ b/app/assets/stylesheets/pages/tree.scss @@ -171,8 +171,6 @@ .tree-controls { float: right; margin-top: 11px; - position: relative; - z-index: 2; .project-action-button { margin-left: $btn-side-margin; diff --git a/app/views/projects/builds/_sidebar.html.haml b/app/views/projects/builds/_sidebar.html.haml index 56fc5f5e68b..f4a49ba71c6 100644 --- a/app/views/projects/builds/_sidebar.html.haml +++ b/app/views/projects/builds/_sidebar.html.haml @@ -1,6 +1,6 @@ - builds = @build.pipeline.builds.to_a -%aside.right-sidebar.right-sidebar-expanded.build-sidebar.js-build-sidebar +%aside.right-sidebar.right-sidebar-expanded.build-sidebar.js-build-sidebar{ data: { "offset-top" => "151", "spy" => "affix" } } .block.build-sidebar-header.visible-xs-block.visible-sm-block.append-bottom-default Job %strong ##{@build.id} -- cgit v1.2.1 From 19cb7b0a3ddbcc94f5c46a60d1494d53bd4faaee Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Wed, 4 Jan 2017 13:27:20 -0600 Subject: Remove navbar height offsets --- app/assets/javascripts/build.js | 2 +- .../components/jump_to_discussion.js.es6 | 2 +- .../javascripts/lib/utils/common_utils.js.es6 | 24 ++-------------------- app/assets/javascripts/merge_request_tabs.js.es6 | 7 +------ 4 files changed, 5 insertions(+), 30 deletions(-) diff --git a/app/assets/javascripts/build.js b/app/assets/javascripts/build.js index eed447d54a0..86fb08c00a5 100644 --- a/app/assets/javascripts/build.js +++ b/app/assets/javascripts/build.js @@ -285,7 +285,7 @@ e.preventDefault(); $currentTarget = $(e.currentTarget); $.scrollTo($currentTarget.attr('href'), { - offset: -($('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight()) + offset: 0 }); }; diff --git a/app/assets/javascripts/diff_notes/components/jump_to_discussion.js.es6 b/app/assets/javascripts/diff_notes/components/jump_to_discussion.js.es6 index 57cb0d0ae6e..283dc330cad 100644 --- a/app/assets/javascripts/diff_notes/components/jump_to_discussion.js.es6 +++ b/app/assets/javascripts/diff_notes/components/jump_to_discussion.js.es6 @@ -181,7 +181,7 @@ const Vue = require('vue'); } $.scrollTo($target, { - offset: -($('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight()) + offset: 0 }); } }, diff --git a/app/assets/javascripts/lib/utils/common_utils.js.es6 b/app/assets/javascripts/lib/utils/common_utils.js.es6 index 5becf688652..0966adcfb68 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js.es6 +++ b/app/assets/javascripts/lib/utils/common_utils.js.es6 @@ -69,30 +69,18 @@ var hash = w.gl.utils.getLocationHash(); if (!hash) return; - // This is required to handle non-unicode characters in hash - hash = decodeURIComponent(hash); - - var navbar = document.querySelector('.navbar-gitlab'); - var subnav = document.querySelector('.layout-nav'); - var fixedTabs = document.querySelector('.js-tabs-affix'); - - var adjustment = 0; - if (navbar) adjustment -= navbar.offsetHeight; - if (subnav) adjustment -= subnav.offsetHeight; - // scroll to user-generated markdown anchor if we cannot find a match if (document.getElementById(hash) === null) { var target = document.getElementById('user-content-' + hash); if (target && target.scrollIntoView) { target.scrollIntoView(true); - window.scrollBy(0, adjustment); } } else { // only adjust for fixedTabs when not targeting user-generated content + var fixedTabs = document.querySelector('.js-tabs-affix'); if (fixedTabs) { - adjustment -= fixedTabs.offsetHeight; + window.scrollBy(0, -fixedTabs.offsetHeight); } - window.scrollBy(0, adjustment); } }; @@ -137,14 +125,6 @@ return e.metaKey || e.ctrlKey || e.altKey || e.shiftKey; }; - gl.utils.isMetaClick = function(e) { - // Identify following special clicks - // 1) Cmd + Click on Mac (e.metaKey) - // 2) Ctrl + Click on PC (e.ctrlKey) - // 3) Middle-click or Mouse Wheel Click (e.which is 2) - return e.metaKey || e.ctrlKey || e.which === 2; - }; - gl.utils.scrollToElement = function($el) { var top = $el.offset().top; gl.navBarHeight = gl.navBarHeight || $('.navbar-gitlab').height(); diff --git a/app/assets/javascripts/merge_request_tabs.js.es6 b/app/assets/javascripts/merge_request_tabs.js.es6 index e74658d59bd..fad96ff2882 100644 --- a/app/assets/javascripts/merge_request_tabs.js.es6 +++ b/app/assets/javascripts/merge_request_tabs.js.es6 @@ -125,9 +125,8 @@ require('./flash'); if (this.diffViewType() === 'parallel') { this.expandViewContainer(); } - const navBarHeight = $('.navbar-gitlab').outerHeight(); $.scrollTo('.merge-request-details .merge-request-tabs', { - offset: -navBarHeight, + offset: 0, }); } else { this.expandView(); @@ -141,8 +140,6 @@ require('./flash'); scrollToElement(container) { if (location.hash) { const offset = 0 - ( - $('.navbar-gitlab').outerHeight() + - $('.layout-nav').outerHeight() + $('.js-tabs-affix').outerHeight() ); const $el = $(`${container} ${location.hash}:not(.match)`); @@ -330,8 +327,6 @@ require('./flash'); if (Breakpoints.get().getBreakpointSize() === 'xs' || !$tabs.length) return; const $diffTabs = $('#diff-notes-app'); - const $fixedNav = $('.navbar-fixed-top'); - const $layoutNav = $('.layout-nav'); $tabs.off('affix.bs.affix affix-top.bs.affix') .affix({ -- cgit v1.2.1 From 59e5748a1ff4fb63aad7d9bcf578678eac824cb0 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Wed, 4 Jan 2017 15:31:08 -0600 Subject: Fix pinned sidebar alignment --- app/assets/javascripts/sidebar.js.es6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/sidebar.js.es6 b/app/assets/javascripts/sidebar.js.es6 index cbb2ae9f1bd..24423dccf1f 100644 --- a/app/assets/javascripts/sidebar.js.es6 +++ b/app/assets/javascripts/sidebar.js.es6 @@ -6,7 +6,7 @@ const sidebarBreakpoint = 1024; const pageSelector = '.page-with-sidebar'; - const navbarSelector = '.navbar-fixed-top'; + const navbarSelector = '.navbar-gitlab'; const sidebarWrapperSelector = '.sidebar-wrapper'; const sidebarContentSelector = '.nav-sidebar'; -- cgit v1.2.1 From 8891536c47e0d1619df8527ee5c15fb2c5d020d4 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Wed, 18 Jan 2017 15:25:35 -0600 Subject: Refactor JS --- app/assets/javascripts/merge_request_tabs.js.es6 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/assets/javascripts/merge_request_tabs.js.es6 b/app/assets/javascripts/merge_request_tabs.js.es6 index fad96ff2882..7540889bce6 100644 --- a/app/assets/javascripts/merge_request_tabs.js.es6 +++ b/app/assets/javascripts/merge_request_tabs.js.es6 @@ -139,9 +139,7 @@ require('./flash'); scrollToElement(container) { if (location.hash) { - const offset = 0 - ( - $('.js-tabs-affix').outerHeight() - ); + const offset = -$('.js-tabs-affix').outerHeight(); const $el = $(`${container} ${location.hash}:not(.match)`); if ($el.length) { $.scrollTo($el[0], { offset }); -- cgit v1.2.1 From bc6ad4f0fdbfedefcb7f439da4ca5ee5f0a4a416 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Fri, 20 Jan 2017 14:44:06 -0600 Subject: Fix build sidebar scrolling --- app/assets/javascripts/build.js | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/app/assets/javascripts/build.js b/app/assets/javascripts/build.js index 86fb08c00a5..c5a962dd199 100644 --- a/app/assets/javascripts/build.js +++ b/app/assets/javascripts/build.js @@ -67,22 +67,6 @@ Build.prototype.initSidebar = function() { this.$sidebar = $('.js-build-sidebar'); -<<<<<<< 36beffc12461d2e479ad8b000b7ba5b6ea40cd33 - this.sidebarTranslationLimits = { -<<<<<<< 3ee255139ab555ec49a177d3b2eed65580f36c4f - min: $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight() - }; - this.sidebarTranslationLimits.max = this.sidebarTranslationLimits.min + $('.scrolling-tabs-container').outerHeight(); -======= - min: 0 - } - this.sidebarTranslationLimits.max = $('.scrolling-tabs-container').outerHeight() + $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight(); ->>>>>>> Fix sidebar scrolling - this.$sidebar.css({ - top: this.sidebarTranslationLimits.max - }); -======= ->>>>>>> Keep sidebars absolute until fixed at top; remove unneeded JS this.$sidebar.niceScroll(); this.$document.off('click', '.js-sidebar-build-toggle').on('click', '.js-sidebar-build-toggle', this.toggleSidebar); }; -- cgit v1.2.1 From 465316ec22ba6083b5a6bf7dab21518564604c56 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Tue, 24 Jan 2017 12:50:22 -0600 Subject: Fix failing conflicts test --- spec/features/merge_requests/conflicts_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/merge_requests/conflicts_spec.rb b/spec/features/merge_requests/conflicts_spec.rb index 5bc4ab2dfe5..d710a780111 100644 --- a/spec/features/merge_requests/conflicts_spec.rb +++ b/spec/features/merge_requests/conflicts_spec.rb @@ -141,7 +141,7 @@ feature 'Merge request conflict resolution', js: true, feature: true do click_on 'Changes' wait_for_ajax - find('.click-to-expand').click + click_link 'Expand all' wait_for_ajax expect(page).to have_content('Gregor Samsa woke from troubled dreams') -- cgit v1.2.1 From 0544c4ed7690abfd4d20d375ace09cc28cf4bf18 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Thu, 26 Jan 2017 08:57:42 -0600 Subject: Fix issue boards sidebar alignment and sidebar toggle spec --- app/assets/stylesheets/pages/boards.scss | 6 +----- spec/features/boards/sidebar_spec.rb | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/assets/stylesheets/pages/boards.scss b/app/assets/stylesheets/pages/boards.scss index b362cc758cc..9a36d76136b 100644 --- a/app/assets/stylesheets/pages/boards.scss +++ b/app/assets/stylesheets/pages/boards.scss @@ -298,12 +298,8 @@ .issue-boards-sidebar { &.right-sidebar { - top: 153px; + top: 0; bottom: 0; - - @media (min-width: $screen-sm-min) { - top: 220px; - } } .issuable-sidebar-header { diff --git a/spec/features/boards/sidebar_spec.rb b/spec/features/boards/sidebar_spec.rb index bad6b56a18a..7651364703e 100644 --- a/spec/features/boards/sidebar_spec.rb +++ b/spec/features/boards/sidebar_spec.rb @@ -54,7 +54,7 @@ describe 'Issue Boards', feature: true, js: true do expect(page).to have_selector('.issue-boards-sidebar') - find('.gutter-toggle').click + find('.gutter-toggle').trigger('click') expect(page).not_to have_selector('.issue-boards-sidebar') end -- cgit v1.2.1 From fe215dacb823d022096264e2dfa31f11d0b1e670 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Thu, 26 Jan 2017 09:23:57 -0600 Subject: Fix time tracking spec --- spec/support/time_tracking_shared_examples.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/time_tracking_shared_examples.rb b/spec/support/time_tracking_shared_examples.rb index 02657684b57..52f4fabdc47 100644 --- a/spec/support/time_tracking_shared_examples.rb +++ b/spec/support/time_tracking_shared_examples.rb @@ -77,6 +77,6 @@ end def submit_time(slash_command) fill_in 'note[note]', with: slash_command - click_button 'Comment' + find('.comment-btn').trigger('click') wait_for_ajax end -- cgit v1.2.1 From 40d4d6d69a3d811d13e9c5c2c2437eeda713ad1f Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Thu, 26 Jan 2017 11:06:17 -0600 Subject: Fix comment button test for slash commands --- spec/support/slash_commands_helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/slash_commands_helpers.rb b/spec/support/slash_commands_helpers.rb index df483afa0e3..0d91fe5fd5d 100644 --- a/spec/support/slash_commands_helpers.rb +++ b/spec/support/slash_commands_helpers.rb @@ -3,7 +3,7 @@ module SlashCommandsHelpers Sidekiq::Testing.fake! do page.within('.js-main-target-form') do fill_in 'note[note]', with: text - click_button 'Comment' + find('.comment-btn').trigger('click') end end end -- cgit v1.2.1 From 647d2b08cde74228728aeb12486c23e5f8e1b317 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Fri, 3 Feb 2017 15:22:04 -0600 Subject: Add sticky sidebar on wiki page --- app/views/projects/wikis/_sidebar.html.haml | 2 +- app/views/shared/issuable/_sidebar.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/projects/wikis/_sidebar.html.haml b/app/views/projects/wikis/_sidebar.html.haml index cad9c15a49e..456477824e5 100644 --- a/app/views/projects/wikis/_sidebar.html.haml +++ b/app/views/projects/wikis/_sidebar.html.haml @@ -1,4 +1,4 @@ -%aside.right-sidebar.right-sidebar-expanded.wiki-sidebar.js-wiki-sidebar +%aside.right-sidebar.right-sidebar-expanded.wiki-sidebar.js-wiki-sidebar{ data: { "offset-top" => "101", "spy" => "affix" } } .block.wiki-sidebar-header.append-bottom-default %a.gutter-toggle.pull-right.visible-xs-block.visible-sm-block.js-sidebar-wiki-toggle{ href: "#" } = icon('angle-double-right') diff --git a/app/views/shared/issuable/_sidebar.html.haml b/app/views/shared/issuable/_sidebar.html.haml index 77fc44fa5cc..1ccb09c36f5 100644 --- a/app/views/shared/issuable/_sidebar.html.haml +++ b/app/views/shared/issuable/_sidebar.html.haml @@ -2,7 +2,7 @@ - content_for :page_specific_javascripts do = page_specific_javascript_bundle_tag('issuable') -%aside.right-sidebar{ class: sidebar_gutter_collapsed_class, 'aria-live' => 'polite' } +%aside.right-sidebar{ data: { "offset-top" => "101", "spy" => "affix" }, class: sidebar_gutter_collapsed_class, 'aria-live' => 'polite' } .issuable-sidebar - can_edit_issuable = can?(current_user, :"admin_#{issuable.to_ability_name}", @project) .block.issuable-sidebar-header -- cgit v1.2.1 From 178be67df221d46c5053a72917860775b343bc7d Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Mon, 6 Feb 2017 12:11:34 -0600 Subject: Set height of fixed sidebars with js --- app/assets/javascripts/sidebar.js.es6 | 11 +++++++++++ app/assets/stylesheets/pages/issuable.scss | 1 - 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/sidebar.js.es6 b/app/assets/javascripts/sidebar.js.es6 index 24423dccf1f..6c3a1f3307a 100644 --- a/app/assets/javascripts/sidebar.js.es6 +++ b/app/assets/javascripts/sidebar.js.es6 @@ -35,13 +35,16 @@ window.innerWidth >= sidebarBreakpoint && $(pageSelector).hasClass(expandedPageClass) ); + $(window).on('resize', () => this.setSidebarHeight()); $(document) .on('click', sidebarToggleSelector, () => this.toggleSidebar()) .on('click', pinnedToggleSelector, () => this.togglePinnedState()) .on('click', 'html, body, a, button', (e) => this.handleClickEvent(e)) .on('DOMContentLoaded', () => this.renderState()) + .on('scroll', () => this.setSidebarHeight()) .on('todo:toggle', (e, count) => this.updateTodoCount(count)); this.renderState(); + this.setSidebarHeight(); } handleClickEvent(e) { @@ -64,6 +67,14 @@ this.renderState(); } + setSidebarHeight() { + const $navHeight = $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight(); + const diff = $navHeight - $('body').scrollTop(); + if (diff > 0) { + $('.right-sidebar').outerHeight($(window).height() - diff); + } + } + togglePinnedState() { this.isPinned = !this.isPinned; if (!this.isPinned) { diff --git a/app/assets/stylesheets/pages/issuable.scss b/app/assets/stylesheets/pages/issuable.scss index 130103a2702..da5c44b5fdc 100644 --- a/app/assets/stylesheets/pages/issuable.scss +++ b/app/assets/stylesheets/pages/issuable.scss @@ -190,7 +190,6 @@ .right-sidebar { position: absolute; - height: 100%; top: $header-height; bottom: 0; right: 0; -- cgit v1.2.1 From 4e334538478da577fabf070c493530189c7613cb Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Mon, 6 Feb 2017 16:19:08 -0600 Subject: Set sidebar height to 100% if at top of page --- app/assets/javascripts/sidebar.js.es6 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/assets/javascripts/sidebar.js.es6 b/app/assets/javascripts/sidebar.js.es6 index 6c3a1f3307a..d0ddb5be099 100644 --- a/app/assets/javascripts/sidebar.js.es6 +++ b/app/assets/javascripts/sidebar.js.es6 @@ -72,6 +72,8 @@ const diff = $navHeight - $('body').scrollTop(); if (diff > 0) { $('.right-sidebar').outerHeight($(window).height() - diff); + } else { + $('.right-sidebar').outerHeight('100%'); } } -- cgit v1.2.1 From 3a1b2c9d50f4615ce9e40a8f21ef4885d8283010 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Tue, 7 Feb 2017 17:20:28 -0600 Subject: common_utils merge conflicts --- app/assets/javascripts/lib/utils/common_utils.js.es6 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/assets/javascripts/lib/utils/common_utils.js.es6 b/app/assets/javascripts/lib/utils/common_utils.js.es6 index 0966adcfb68..a910999a440 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js.es6 +++ b/app/assets/javascripts/lib/utils/common_utils.js.es6 @@ -127,12 +127,10 @@ gl.utils.scrollToElement = function($el) { var top = $el.offset().top; - gl.navBarHeight = gl.navBarHeight || $('.navbar-gitlab').height(); - gl.navLinksHeight = gl.navLinksHeight || $('.nav-links').height(); gl.mrTabsHeight = gl.mrTabsHeight || $('.merge-request-tabs').height(); return $('body, html').animate({ - scrollTop: top - (gl.navBarHeight + gl.navLinksHeight + gl.mrTabsHeight) + scrollTop: top - (gl.mrTabsHeight) }, 200); }; -- cgit v1.2.1 From 485ef9900b7a7e7534b3d20f5f9bef02dbc9b13b Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Wed, 8 Feb 2017 09:38:27 -0600 Subject: Add changelog --- changelogs/unreleased/static-navbar.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelogs/unreleased/static-navbar.yml diff --git a/changelogs/unreleased/static-navbar.yml b/changelogs/unreleased/static-navbar.yml new file mode 100644 index 00000000000..eaf478a48d0 --- /dev/null +++ b/changelogs/unreleased/static-navbar.yml @@ -0,0 +1,4 @@ +--- +title: Remove fixed positioning from top nav +merge_request: !7547 +author: -- cgit v1.2.1 From 7cbceef0a8290078eb2feb3956aa311628552229 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Wed, 8 Feb 2017 09:50:30 -0600 Subject: Remove right padding from navbar-collapse on large screens --- app/assets/stylesheets/framework/header.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/assets/stylesheets/framework/header.scss b/app/assets/stylesheets/framework/header.scss index 731ce57c245..34e010e0e8a 100644 --- a/app/assets/stylesheets/framework/header.scss +++ b/app/assets/stylesheets/framework/header.scss @@ -222,6 +222,10 @@ header { float: right; border-top: none; + @media (min-width: $screen-md-min) { + padding: 0; + } + @media (max-width: $screen-xs-max) { float: none; } -- cgit v1.2.1 From 5430849ca55192b78f7bfb35fdabaa3356e15035 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Thu, 9 Feb 2017 11:19:26 -0600 Subject: Replace accidentally deleted metaclick --- app/assets/javascripts/lib/utils/common_utils.js.es6 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/assets/javascripts/lib/utils/common_utils.js.es6 b/app/assets/javascripts/lib/utils/common_utils.js.es6 index a910999a440..2d4f1d3dbe7 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js.es6 +++ b/app/assets/javascripts/lib/utils/common_utils.js.es6 @@ -125,6 +125,14 @@ return e.metaKey || e.ctrlKey || e.altKey || e.shiftKey; }; + gl.utils.isMetaClick = function(e) { + // Identify following special clicks + // 1) Cmd + Click on Mac (e.metaKey) + // 2) Ctrl + Click on PC (e.ctrlKey) + // 3) Middle-click or Mouse Wheel Click (e.which is 2) + return e.metaKey || e.ctrlKey || e.which === 2; + }; + gl.utils.scrollToElement = function($el) { var top = $el.offset().top; gl.mrTabsHeight = gl.mrTabsHeight || $('.merge-request-tabs').height(); -- cgit v1.2.1 From c34517ad8b5248a6c40eb59152347c45ac0d0ec8 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Thu, 9 Feb 2017 13:22:38 -0600 Subject: Add js prefix to right sidebar --- app/assets/javascripts/lib/utils/common_utils.js.es6 | 3 +++ app/assets/javascripts/sidebar.js.es6 | 4 ++-- app/views/projects/builds/_sidebar.html.haml | 2 +- app/views/projects/wikis/_sidebar.html.haml | 2 +- app/views/shared/issuable/_sidebar.html.haml | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/lib/utils/common_utils.js.es6 b/app/assets/javascripts/lib/utils/common_utils.js.es6 index 2d4f1d3dbe7..bcb3a706b51 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js.es6 +++ b/app/assets/javascripts/lib/utils/common_utils.js.es6 @@ -69,6 +69,9 @@ var hash = w.gl.utils.getLocationHash(); if (!hash) return; + // This is required to handle non-unicode characters in hash + hash = decodeURIComponent(hash); + // scroll to user-generated markdown anchor if we cannot find a match if (document.getElementById(hash) === null) { var target = document.getElementById('user-content-' + hash); diff --git a/app/assets/javascripts/sidebar.js.es6 b/app/assets/javascripts/sidebar.js.es6 index d0ddb5be099..33e4b7db681 100644 --- a/app/assets/javascripts/sidebar.js.es6 +++ b/app/assets/javascripts/sidebar.js.es6 @@ -71,9 +71,9 @@ const $navHeight = $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight(); const diff = $navHeight - $('body').scrollTop(); if (diff > 0) { - $('.right-sidebar').outerHeight($(window).height() - diff); + $('.js-right-sidebar').outerHeight($(window).height() - diff); } else { - $('.right-sidebar').outerHeight('100%'); + $('.js-right-sidebar').outerHeight('100%'); } } diff --git a/app/views/projects/builds/_sidebar.html.haml b/app/views/projects/builds/_sidebar.html.haml index f4a49ba71c6..78720d88e4e 100644 --- a/app/views/projects/builds/_sidebar.html.haml +++ b/app/views/projects/builds/_sidebar.html.haml @@ -1,6 +1,6 @@ - builds = @build.pipeline.builds.to_a -%aside.right-sidebar.right-sidebar-expanded.build-sidebar.js-build-sidebar{ data: { "offset-top" => "151", "spy" => "affix" } } +%aside.right-sidebar.right-sidebar-expanded.build-sidebar.js-build-sidebar.js-right-sidebar{ data: { "offset-top" => "151", "spy" => "affix" } } .block.build-sidebar-header.visible-xs-block.visible-sm-block.append-bottom-default Job %strong ##{@build.id} diff --git a/app/views/projects/wikis/_sidebar.html.haml b/app/views/projects/wikis/_sidebar.html.haml index 456477824e5..f115f60088c 100644 --- a/app/views/projects/wikis/_sidebar.html.haml +++ b/app/views/projects/wikis/_sidebar.html.haml @@ -1,4 +1,4 @@ -%aside.right-sidebar.right-sidebar-expanded.wiki-sidebar.js-wiki-sidebar{ data: { "offset-top" => "101", "spy" => "affix" } } +%aside.right-sidebar.right-sidebar-expanded.wiki-sidebar.js-wiki-sidebar.js-right-sidebar{ data: { "offset-top" => "101", "spy" => "affix" } } .block.wiki-sidebar-header.append-bottom-default %a.gutter-toggle.pull-right.visible-xs-block.visible-sm-block.js-sidebar-wiki-toggle{ href: "#" } = icon('angle-double-right') diff --git a/app/views/shared/issuable/_sidebar.html.haml b/app/views/shared/issuable/_sidebar.html.haml index 1ccb09c36f5..3f7f1a86b9f 100644 --- a/app/views/shared/issuable/_sidebar.html.haml +++ b/app/views/shared/issuable/_sidebar.html.haml @@ -2,7 +2,7 @@ - content_for :page_specific_javascripts do = page_specific_javascript_bundle_tag('issuable') -%aside.right-sidebar{ data: { "offset-top" => "101", "spy" => "affix" }, class: sidebar_gutter_collapsed_class, 'aria-live' => 'polite' } +%aside.right-sidebar.js-right-sidebar{ data: { "offset-top" => "101", "spy" => "affix" }, class: sidebar_gutter_collapsed_class, 'aria-live' => 'polite' } .issuable-sidebar - can_edit_issuable = can?(current_user, :"admin_#{issuable.to_ability_name}", @project) .block.issuable-sidebar-header -- cgit v1.2.1