Welcome to mirror list, hosted at ThFree Co, Russian Federation.

details_behavior.js « behaviors « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1d63f5baeee14af6ce3a04731a718518a0ecdc51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import $ from 'jquery';

$(() => {
  $('body').on('click', '.js-details-target', function target() {
    $(this).closest('.js-details-container').toggleClass('open');
  });

  // Show details content. Hides link after click.
  //
  // %div
  //   %a.js-details-expand
  //   %div.js-details-content
  //
  $('body').on('click', '.js-details-expand', function expand(e) {
    e.preventDefault();
    $(this).next('.js-details-content').removeClass('hide');
    $(this).hide();

    const truncatedItem = $(this).siblings('.js-details-short');
    if (truncatedItem.length) {
      truncatedItem.addClass('hide');
    }
  });
});