summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/pipeline.js.es6
blob: bf33eb1010053e8d09aee6120d8629b9b13add11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
(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');

    $($pipelineBtn).add($pipelineGraph).toggleClass('graph-collapsed');

    const graphCollapsed = $pipelineGraph.hasClass('graph-collapsed');

    graphCollapsed ? $btnText.text('Expand') : $btnText.text('Hide')
  }

  $(document).on('click', '.toggle-pipeline-btn', toggleGraph);
})();