debian-mirror-gitlab/app/assets/javascripts/behaviors/details_behavior.js

29 lines
656 B
JavaScript
Raw Normal View History

2018-05-09 12:01:36 +05:30
import $ from 'jquery';
2017-08-17 22:00:37 +05:30
$(() => {
$('body').on('click', '.js-details-target', function target() {
2018-12-13 13:39:08 +05:30
$(this)
.closest('.js-details-container')
.toggleClass('open');
2016-09-13 17:45:13 +05:30
});
2017-08-17 22:00:37 +05:30
// 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();
2018-12-13 13:39:08 +05:30
$(this)
.next('.js-details-content')
.removeClass('hide');
2017-08-17 22:00:37 +05:30
$(this).hide();
const truncatedItem = $(this).siblings('.js-details-short');
if (truncatedItem.length) {
truncatedItem.addClass('hide');
}
});
});