aboutsummaryrefslogtreecommitdiff
path: root/src/js/BotleaguesFrontend.js
blob: b36574316af27ae48fc18ff5c9f8916f726d1ecd (plain) (blame)
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
function BotleaguesFrontend(){}

$.cookie.json = true;
BotleaguesFrontend.cookie_login_email = 'botleagues_login_email';
BotleaguesFrontend.cookie_login_user_id = 'botleagues_login_user_id';
BotleaguesFrontend.cookie_login_token = 'botleagues_login_token';
BotleaguesFrontend.cookie_login_valid_till = 'botleagues_login_valid_till';

BotleaguesFrontend.error = function(user_options) {
    options = {
        dismissable: true,
        prepend_to: $('#messages'),
        type: 'danger'
    };
    for (var key in user_options) {
        options[key] = user_options[key];
    }

    var html = '<div class="alert alert-' + options.type + '">';
    if (options.dismissable === true)
        html += '<a href="#" class="close" data-dismiss="alert">&times;</a>';
    html += options.message;
    html += '</div>';

    html = $(html);

    html.hide().prependTo(options.prepend_to).slideDown().delay(3000).fadeOut().queue(html.remove);
};