Remove index from pipeline toggles
This commit is contained in:
parent
ab44aa7b34
commit
74f80465f6
|
@ -1,13 +1,15 @@
|
|||
(function() {
|
||||
function toggleGraph() {
|
||||
const indexOfBtn = $('.toggle-pipeline-btn').index($(this));
|
||||
const $pipelineBtn = $(this).closest('.toggle-pipeline-btn');
|
||||
const $pipelineGraph = $(this).closest('.row-content-block').next('.pipeline-graph');
|
||||
const $btnText = $(this).find('.toggle-btn-text');
|
||||
|
||||
$($('.pipeline-graph')[indexOfBtn]).toggleClass('graph-collapsed');
|
||||
$($('.toggle-pipeline-btn')[indexOfBtn]).toggleClass('graph-collapsed');
|
||||
$($pipelineBtn).add($pipelineGraph).toggleClass('graph-collapsed');
|
||||
|
||||
const $btnText = $($('.toggle-pipeline-btn .btn-text')[indexOfBtn]);
|
||||
const graphCollapsed = $($('.pipeline-graph')[indexOfBtn]).hasClass('graph-collapsed');
|
||||
const graphCollapsed = $pipelineGraph.hasClass('graph-collapsed');
|
||||
|
||||
graphCollapsed ? $btnText.text('Expand') : $btnText.text('Hide')
|
||||
}
|
||||
|
||||
$(document).on('click', '.toggle-pipeline-btn', toggleGraph);
|
||||
})();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.row-content-block.build-content.middle-block.pipeline-actions
|
||||
.pull-right
|
||||
.btn.btn-grouped.btn-white.toggle-pipeline-btn
|
||||
%span.btn-text Hide
|
||||
%span.toggle-btn-text Hide
|
||||
%span pipeline graph
|
||||
%span.caret
|
||||
- if can?(current_user, :update_pipeline, pipeline.project)
|
||||
|
|
Loading…
Reference in New Issue