summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2016-11-24 16:43:54 +0000
committerFilipa Lacerda <filipa@gitlab.com>2016-11-30 17:06:47 +0000
commitcc4434a483e75dd83055fe21ef4dedadbfcdc4c7 (patch)
tree177d0ea1005fca9957cd6a2f8ec9f509edb50fd1
parentda8c2e69876808d991e8c44b0ea86bb1f4c4e5ee (diff)
downloadgitlab-ce-cc4434a483e75dd83055fe21ef4dedadbfcdc4c7.tar.gz
Fix after review
Adds require statement
-rw-r--r--app/assets/javascripts/dispatcher.js.es612
-rw-r--r--app/assets/javascripts/pipelines.js.es69
-rw-r--r--app/views/projects/pipelines/_with_tabs.html.haml10
-rw-r--r--app/views/projects/pipelines/show.html.haml2
4 files changed, 20 insertions, 13 deletions
diff --git a/app/assets/javascripts/dispatcher.js.es6 b/app/assets/javascripts/dispatcher.js.es6
index 16df4b0b005..de205b7905b 100644
--- a/app/assets/javascripts/dispatcher.js.es6
+++ b/app/assets/javascripts/dispatcher.js.es6
@@ -135,8 +135,18 @@
new TreeView();
}
break;
+ case 'projects:pipelines:builds':
case 'projects:pipelines:show':
- new gl.Pipelines();
+ const controllerAction = document.querySelector('.js-pipeline-container').dataset.controllerAction;
+
+ new gl.Pipelines({
+ initTabs: true,
+ tabsOptions: {
+ action: controllerAction,
+ defaultAction: 'pipelines',
+ parentEl: '.pipelines-tabs',
+ },
+ });
break;
case 'groups:activity':
new gl.Activities();
diff --git a/app/assets/javascripts/pipelines.js.es6 b/app/assets/javascripts/pipelines.js.es6
index a84db9c0233..97e06bc6d68 100644
--- a/app/assets/javascripts/pipelines.js.es6
+++ b/app/assets/javascripts/pipelines.js.es6
@@ -1,8 +1,15 @@
+//= require lib/utils/bootstrap_linked_tabs
+
/* eslint-disable */
((global) => {
class Pipelines {
- constructor() {
+ constructor(options) {
+
+ if (options.initTabs && options.tabsOptions) {
+ new window.gl.LinkedTabs(options.tabsOptions);
+ }
+
this.addMarginToBuildColumns();
}
diff --git a/app/views/projects/pipelines/_with_tabs.html.haml b/app/views/projects/pipelines/_with_tabs.html.haml
index 4cc0e116122..d4d2e360f39 100644
--- a/app/views/projects/pipelines/_with_tabs.html.haml
+++ b/app/views/projects/pipelines/_with_tabs.html.haml
@@ -52,13 +52,3 @@
%th
- pipeline.statuses.relevant.stages.each do |stage|
= render 'projects/commit/ci_stage', stage: stage, statuses: pipeline.statuses.relevant.where(stage: stage)
-
-
-:javascript
- var pipelines_tab;
-
- pipelines_tab = new window.gl.LinkedTabs({
- action: "#{controller.action_name}",
- defaultAction: 'pipelines',
- parentEl: '.pipelines-tabs'
- });
diff --git a/app/views/projects/pipelines/show.html.haml b/app/views/projects/pipelines/show.html.haml
index 8c6652a5f90..371ce3ae599 100644
--- a/app/views/projects/pipelines/show.html.haml
+++ b/app/views/projects/pipelines/show.html.haml
@@ -2,7 +2,7 @@
- page_title "Pipeline"
= render "projects/pipelines/head"
-%div{ class: container_class }
+%div.js-pipeline-container{ class: container_class, data: {controller_action: "#{controller.action_name}"} }
- if @commit
= render "projects/pipelines/info"