gitlab-org--gitlab-foss/app/assets/javascripts/pipeline.js.es6

25 lines
804 B
JavaScript
Raw Normal View History

2016-08-17 21:41:24 +00:00
(function() {
function toggleGraph() {
const $pipelineBtn = $(this).closest('.toggle-pipeline-btn');
const $pipelineGraph = $(this).closest('.row-content-block').next('.pipeline-graph');
const $btnText = $(this).find('.toggle-btn-text');
const $icon = $(this).find('.fa');
2016-08-17 21:41:24 +00:00
$($pipelineBtn).add($pipelineGraph).toggleClass('graph-collapsed');
2016-08-17 21:41:24 +00:00
const graphCollapsed = $pipelineGraph.hasClass('graph-collapsed');
const expandIcon = 'fa-caret-down';
const hideIcon = 'fa-caret-up';
if(graphCollapsed) {
$btnText.text('Expand');
$icon.removeClass(hideIcon).addClass(expandIcon);
} else {
$btnText.text('Hide');
$icon.removeClass(expandIcon).addClass(hideIcon);
}
2016-08-17 21:41:24 +00:00
}
2016-08-17 21:41:24 +00:00
$(document).on('click', '.toggle-pipeline-btn', toggleGraph);
})();