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