summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2016-10-25 15:15:29 +0000
committerFatih Acet <acetfatih@gmail.com>2016-10-25 15:15:29 +0000
commita3814f2a998e30e10630be2b18f4a0a8f6155ad2 (patch)
treea4358d5f51c22310185253f30b3e0c1a772df1cf
parent65d86e0d118bbbad99493a07d09c9675d3e41ec0 (diff)
parentcc8ebae527b270ea65d408fa60c2e5c78db5a155 (diff)
downloadgitlab-ce-a3814f2a998e30e10630be2b18f4a0a8f6155ad2.tar.gz
Merge branch '22743-issue-tooltip-will-not-disappear-going-back-to-previous-page' into 'master'
Close any open tooltips before page:fetch ## What does this MR do? Resolve #22743 by removing any open tooltips before `page:fetch`. ## Are there points in the code the reviewer needs to double check? ## Why was this MR needed? Open tooltips were never closed (could never be) in certain browsers after navigating with Turbolinks and going back. ## Screenshots (if relevant) ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [ ] API support added - Tests - [ ] Added for this feature/bug - [ ] All builds are passing - [ ] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [ ] Branch has no merge conflicts with `master` (if it does - rebase it please) - [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? Closes #22743 See merge request !6795
-rw-r--r--CHANGELOG.md1
-rw-r--r--app/assets/javascripts/application.js6
-rw-r--r--app/assets/javascripts/lib/utils/common_utils.js8
3 files changed, 10 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 60f932e1f76..85cdb0e1ab7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -75,6 +75,7 @@ Please view this file on the master branch, on stable branches it's out of date.
- Don't include archived projects when creating group milestones. !4940 (Jeroen Jacobs)
- Add tag shortcut from the Commit page. !6543
- Keep refs for each deployment
+ - Close open tooltips on page navigation (Linus Thiel)
- Allow browsing branches that end with '.atom'
- Log LDAP lookup errors and don't swallow unrelated exceptions. !6103 (Markus Koller)
- Replace unique keyframes mixin with keyframe mixin with specific names (ClemMakesApps)
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index 17cbfd0e66f..c6c3c82e1ee 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -124,15 +124,11 @@
return str.replace(/<(?:.|\n)*?>/gm, '');
};
- window.unbindEvents = function() {
- return $(document).off('scroll');
- };
-
window.shiftWindow = function() {
return scrollBy(0, -100);
};
- document.addEventListener("page:fetch", unbindEvents);
+ document.addEventListener("page:fetch", gl.utils.cleanupBeforeFetch);
window.addEventListener("hashchange", shiftWindow);
diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js
index b170e26eebf..698abae6228 100644
--- a/app/assets/javascripts/lib/utils/common_utils.js
+++ b/app/assets/javascripts/lib/utils/common_utils.js
@@ -43,6 +43,14 @@
parser.href = url;
return parser;
};
+
+ gl.utils.cleanupBeforeFetch = function() {
+ // Unbind scroll events
+ $(document).off('scroll');
+ // Close any open tooltips
+ $('.has-tooltip, [data-toggle="tooltip"]').tooltip('destroy');
+ };
+
return jQuery.timefor = function(time, suffix, expiredLabel) {
var suffixFromNow, timefor;
if (!time) {