diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2016-11-29 10:35:53 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2016-11-30 17:06:48 +0000 |
commit | aa2d6eec9e36acdff679d3a5ef17db0780f51447 (patch) | |
tree | bc2964489195949bdc93bab2a356f8e4ae4033a7 | |
parent | 6789befbf6b0578718b0e461c60326cd97dc8640 (diff) | |
download | gitlab-ce-24814-pipeline-tabs.tar.gz |
Improvements after review24814-pipeline-tabs
-rw-r--r-- | app/assets/javascripts/dispatcher.js.es6 | 2 | ||||
-rw-r--r-- | app/assets/javascripts/extensions/element.js.es6 | 26 | ||||
-rw-r--r-- | app/assets/javascripts/lib/utils/bootstrap_linked_tabs.js.es6 | 12 | ||||
-rw-r--r-- | app/assets/javascripts/pipelines.js.es6 | 2 |
4 files changed, 21 insertions, 21 deletions
diff --git a/app/assets/javascripts/dispatcher.js.es6 b/app/assets/javascripts/dispatcher.js.es6 index de205b7905b..5fbeb57cc63 100644 --- a/app/assets/javascripts/dispatcher.js.es6 +++ b/app/assets/javascripts/dispatcher.js.es6 @@ -137,7 +137,7 @@ break; case 'projects:pipelines:builds': case 'projects:pipelines:show': - const controllerAction = document.querySelector('.js-pipeline-container').dataset.controllerAction; + const { controllerAction } = document.querySelector('.js-pipeline-container').dataset; new gl.Pipelines({ initTabs: true, diff --git a/app/assets/javascripts/extensions/element.js.es6 b/app/assets/javascripts/extensions/element.js.es6 index 328cc57dca0..3f12ad9ff9f 100644 --- a/app/assets/javascripts/extensions/element.js.es6 +++ b/app/assets/javascripts/extensions/element.js.es6 @@ -6,17 +6,15 @@ Element.prototype.closest = Element.prototype.closest || function closest(select return selectedElement.matches(selector) ? selectedElement : Element.prototype.closest(selector, selectedElement.parentElement); }; -if (!Element.prototype.matches) { - Element.prototype.matches = - Element.prototype.matchesSelector || - Element.prototype.mozMatchesSelector || - Element.prototype.msMatchesSelector || - Element.prototype.oMatchesSelector || - Element.prototype.webkitMatchesSelector || - function (s) { - const matches = (this.document || this.ownerDocument).querySelectorAll(s); - let i = matches.length; - while (--i >= 0 && matches.item(i) !== this) {} - return i > -1; - }; -} +Element.prototype.matches = Element.prototype.matches || + Element.prototype.matchesSelector || + Element.prototype.mozMatchesSelector || + Element.prototype.msMatchesSelector || + Element.prototype.oMatchesSelector || + Element.prototype.webkitMatchesSelector || + function (s) { + const matches = (this.document || this.ownerDocument).querySelectorAll(s); + let i = matches.length; + while (--i >= 0 && matches.item(i) !== this) {} + return i > -1; + }; diff --git a/app/assets/javascripts/lib/utils/bootstrap_linked_tabs.js.es6 b/app/assets/javascripts/lib/utils/bootstrap_linked_tabs.js.es6 index 510ac77009b..e810ee85bd3 100644 --- a/app/assets/javascripts/lib/utils/bootstrap_linked_tabs.js.es6 +++ b/app/assets/javascripts/lib/utils/bootstrap_linked_tabs.js.es6 @@ -53,16 +53,18 @@ this.defaultAction = this.options.defaultAction; this.action = this.options.action || this.defaultAction; - this.currentLocation = window.location; - if (this.action === 'show') { this.action = this.defaultAction; } + this.currentLocation = window.location; + + const tabSelector = `${this.options.parentEl} a[data-toggle="tab"]`; + // since this is a custom event we need jQuery :( $(document) - .off('shown.bs.tab', `${this.options.parentEl} a[data-toggle="tab"]`) - .on('shown.bs.tab', `${this.options.parentEl} a[data-toggle="tab"]`, evt => this.tabShown(evt)); + .off('shown.bs.tab', tabSelector) + .on('shown.bs.tab', tabSelector, e => this.tabShown(e)); this.activateTab(this.action); } @@ -90,7 +92,7 @@ copySource.replace(/\/+$/, ''); - const newState = copySource + this.currentLocation.search + this.currentLocation.hash; + const newState = `${copySource}${this.currentLocation.search}${this.currentLocation.hash}`; history.replaceState({ turbolinks: true, diff --git a/app/assets/javascripts/pipelines.js.es6 b/app/assets/javascripts/pipelines.js.es6 index 97e06bc6d68..72c6c4a1fcd 100644 --- a/app/assets/javascripts/pipelines.js.es6 +++ b/app/assets/javascripts/pipelines.js.es6 @@ -7,7 +7,7 @@ constructor(options) { if (options.initTabs && options.tabsOptions) { - new window.gl.LinkedTabs(options.tabsOptions); + new global.LinkedTabs(options.tabsOptions); } this.addMarginToBuildColumns(); |