aboutsummaryrefslogtreecommitdiff
path: root/resources/assets/javascripts/bootstrap/news.js
blob: 6329f168ba19a42919fd16bac48edfca0ee47bfc (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
25
26
27
28
29
30
31
32
33
34
STUDIP.domReady(() => {
    STUDIP.News.dialog_width = window.innerWidth * (1 / 2);
    STUDIP.News.dialog_height = window.innerHeight - 60;
    if (STUDIP.News.dialog_width < 550) {
        STUDIP.News.dialog_width = 550;
    }
    if (STUDIP.News.dialog_height < 400) {
        STUDIP.News.dialog_height = 400;
    }
    STUDIP.News.pending_ajax_request = false;

    $(document).on('click', 'a[rel~="get_dialog"]', function(event) {
        event.preventDefault();
        STUDIP.News.get_dialog('news_dialog', $(this).attr('href'));
    });

    $(document).on('click', 'a[rel~="close_dialog"]', function(event) {
        event.preventDefault();
        $('#news_dialog').dialog('close');
    });

    // open/close categories without ajax-request
    $(document).on('click', '.news_category_header', function(event) {
        event.preventDefault();
        STUDIP.News.toggle_category_view(
            $(this)
                .parent('div')
                .attr('id')
        );
    });
    $(document).on('click', '.news_category_header input[type=image]', function(event) {
        event.preventDefault();
    });
});