Commit 74f80465 authored by Annabel Dunstone's avatar Annabel Dunstone

Remove index from pipeline toggles

parent ab44aa7b
function toggleGraph() { (function() {
const indexOfBtn = $('.toggle-pipeline-btn').index($(this)); 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');
$($('.pipeline-graph')[indexOfBtn]).toggleClass('graph-collapsed'); $($pipelineBtn).add($pipelineGraph).toggleClass('graph-collapsed');
$($('.toggle-pipeline-btn')[indexOfBtn]).toggleClass('graph-collapsed');
const $btnText = $($('.toggle-pipeline-btn .btn-text')[indexOfBtn]); const graphCollapsed = $pipelineGraph.hasClass('graph-collapsed');
const graphCollapsed = $($('.pipeline-graph')[indexOfBtn]).hasClass('graph-collapsed');
graphCollapsed ? $btnText.text('Expand') : $btnText.text('Hide') graphCollapsed ? $btnText.text('Expand') : $btnText.text('Hide')
} }
$(document).on('click', '.toggle-pipeline-btn', toggleGraph); $(document).on('click', '.toggle-pipeline-btn', toggleGraph);
})();
.row-content-block.build-content.middle-block.pipeline-actions .row-content-block.build-content.middle-block.pipeline-actions
.pull-right .pull-right
.btn.btn-grouped.btn-white.toggle-pipeline-btn .btn.btn-grouped.btn-white.toggle-pipeline-btn
%span.btn-text Hide %span.toggle-btn-text Hide
%span pipeline graph %span pipeline graph
%span.caret %span.caret
- if can?(current_user, :update_pipeline, pipeline.project) - if can?(current_user, :update_pipeline, pipeline.project)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment