aboutsummaryrefslogtreecommitdiff
path: root/resources/assets/javascripts/bootstrap/contentbox.js
blob: 42c5df18ca30863687a94d6c7401d62f99b5143e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$(document).on('click', 'section.contentbox article header h1 a', function(e) {
    if (!$(this).hasClass('no-contentbox-link')) {
        e.preventDefault();
        var article = $(this).closest('article');

        // If the contentbox article is new send an ajax request
        if (article.hasClass('new')) {
            $.ajax({
                type: 'POST',
                url: STUDIP.URLHelper.getURL(decodeURIComponent(article.data('visiturl') + $(this).attr('href')))
            });
        }

        // Open the contentbox
        article.toggleClass('open').removeClass('new');
    }
});