members-space-header.js 1.59 KB
Newer Older
1 2 3
/**
 * Toggle the navbar on mobile screens
 */
4 5
function toggleHeader() {
    var x = document.getElementById("topnav");
François committed
6

7
    if (x.className === "topnav") {
François committed
8
        x.className += " responsive";
9
    } else {
François committed
10
        x.className = "topnav";
11
    }
François committed
12
}
13 14 15

$(document).ready(function() {
    // Navbar redirections
Damien Moulard committed
16 17
    $('#nav_home').on('click', (e) => {
        e.preventDefault();
18 19 20
        if (current_location !== "home") {
            goto('home');
        }
21 22 23
        if (document.getElementById("topnav").className !== "topnav") {
            toggleHeader();
        }
24
    });
Damien Moulard committed
25 26
    $('#nav_my_info').on('click', (e) => {
        e.preventDefault();
27 28 29
        if (current_location !== "my_info") {
            goto('mes-infos');
        }
30
        toggleHeader();
31
    });
Damien Moulard committed
32 33
    $('#nav_my_shifts').on('click', (e) => {
        e.preventDefault();
34 35 36
        if (current_location !== "my_shifts") {
            goto('mes-services');
        }
37
        toggleHeader();
38
    });
Damien Moulard committed
39
    $('#nav_faq').on('click', (e) => {
40
        e.preventDefault();
Damien Moulard committed
41
        if (current_location !== "faq") {
Etienne Freiss committed
42
            goto('faq');
43 44 45
        }
        toggleHeader();
    });
Damien Moulard committed
46 47
    $('#nav_shifts_exchange').on('click', (e) => {
        e.preventDefault();
48 49 50
        if (current_location !== "shifts_exchange") {
            goto('echange-de-services');
        }
51
        toggleHeader();
52
    });
53 54 55 56
    $('#nav_calendar').prop("href", abcd_calendar_link);
    $('#nav_calendar').on('click', () => {
        toggleHeader();
    });
57

Félicie committed
58
    if (partner_data.is_associated_people === "True" && block_actions_for_attached_people === "True") {
59
        $(".pairs_info").show();
60
    }
61
});