summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/breadcrumb.js
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-08-17 14:00:50 +0100
committerPhil Hughes <me@iamphill.com>2017-08-18 11:07:05 +0100
commitbec6ea20f6933f07cb616c29ce72efc076a97dc0 (patch)
treecd6e24ed383c136b460d1761586366ccb9067a94 /app/assets/javascripts/breadcrumb.js
parentdae629e5e9a75ef0594399b46191306dcbaab90b (diff)
downloadgitlab-ce-bec6ea20f6933f07cb616c29ce72efc076a97dc0.tar.gz
fixed breadcrumbs being undefined
Diffstat (limited to 'app/assets/javascripts/breadcrumb.js')
-rw-r--r--app/assets/javascripts/breadcrumb.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/app/assets/javascripts/breadcrumb.js b/app/assets/javascripts/breadcrumb.js
index 97340953c77..7433fcbbad1 100644
--- a/app/assets/javascripts/breadcrumb.js
+++ b/app/assets/javascripts/breadcrumb.js
@@ -8,14 +8,17 @@ export const addTooltipToEl = (el) => {
export default () => {
const breadcrumbs = document.querySelector('.breadcrumbs-list');
- const topLevelLinks = breadcrumbs.querySelectorAll('.breadcrumbs-list > li > a');
- const $expander = $('.js-breadcrumbs-collapsed-expander');
- topLevelLinks.forEach(el => addTooltipToEl(el));
+ if (breadcrumbs) {
+ const topLevelLinks = breadcrumbs.querySelectorAll('.breadcrumbs-list > li > a');
+ const $expander = $('.js-breadcrumbs-collapsed-expander');
- $expander.closest('.dropdown')
- .on('show.bs.dropdown hide.bs.dropdown', (e) => {
- $('.js-breadcrumbs-collapsed-expander', e.currentTarget).toggleClass('open')
- .tooltip('hide');
- });
+ topLevelLinks.forEach(el => addTooltipToEl(el));
+
+ $expander.closest('.dropdown')
+ .on('show.bs.dropdown hide.bs.dropdown', (e) => {
+ $('.js-breadcrumbs-collapsed-expander', e.currentTarget).toggleClass('open')
+ .tooltip('hide');
+ });
+ }
};