summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-03-09 18:51:52 +0000
committerFilipa Lacerda <filipa@gitlab.com>2017-03-09 18:53:09 +0000
commita7a1a60421f49c1459d46a4092008af12127994c (patch)
tree296b71d124cc395d24ed7135d7c3237e243ccf2f
parent12a0d5a2bca66dc332f160f09a993fef42d356d5 (diff)
downloadgitlab-ce-a7a1a60421f49c1459d46a4092008af12127994c.tar.gz
Target all build links inside a dropdown. Use jQuery to handle event delegation.
-rw-r--r--app/assets/javascripts/merge_request_widget.js2
-rw-r--r--app/assets/javascripts/mini_pipeline_graph_dropdown.js10
2 files changed, 8 insertions, 4 deletions
diff --git a/app/assets/javascripts/merge_request_widget.js b/app/assets/javascripts/merge_request_widget.js
index 27d78ec776c..66cc270ab4d 100644
--- a/app/assets/javascripts/merge_request_widget.js
+++ b/app/assets/javascripts/merge_request_widget.js
@@ -287,7 +287,7 @@ import MiniPipelineGraph from './mini_pipeline_graph_dropdown';
MergeRequestWidget.prototype.initMiniPipelineGraph = function() {
new MiniPipelineGraph({
- container: '.js-pipeline-inline-mr-widget-graph',
+ container: '.js-pipeline-inline-mr-widget-graph:visible',
}).bindEvents();
};
diff --git a/app/assets/javascripts/mini_pipeline_graph_dropdown.js b/app/assets/javascripts/mini_pipeline_graph_dropdown.js
index 3029ec17a37..9c58c465001 100644
--- a/app/assets/javascripts/mini_pipeline_graph_dropdown.js
+++ b/app/assets/javascripts/mini_pipeline_graph_dropdown.js
@@ -40,9 +40,13 @@ export default class MiniPipelineGraph {
* target the click event of this component.
*/
stopDropdownClickPropagation() {
- document.querySelector(`${this.container} .js-builds-dropdown-list a.mini-pipeline-graph-dropdown-item`).addEventListener('click', (e) => {
- e.stopPropagation();
- });
+ $(document).on(
+ 'click',
+ `${this.container} .js-builds-dropdown-list a.mini-pipeline-graph-dropdown-item`,
+ (e) => {
+ e.stopPropagation();
+ },
+ );
}
/**