-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslack.js
More file actions
55 lines (44 loc) · 1.49 KB
/
slack.js
File metadata and controls
55 lines (44 loc) · 1.49 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
$(function () {
// set user info in top right
if (userInfo) {
$('.user-display-name').html(userInfo.display_name ? userInfo.display_name : userInfo.real_name);
$('#userInfoDiv .house-display-name').html(userInfo.type + (userInfo.house ? ' @ ' + userInfo.house : ''));
$('#avatar > img').attr('src', userInfo.avatar);
$('#loggedInDisplay').show();
let alertClass = '';
switch(userInfo.house) { //todo generalize
case 'Anomy':
alertClass = 'alert-danger';
break;
case 'Bloom':
alertClass = 'alert-warning';
break;
case 'Summit':
alertClass = 'alert-success';
break;
case null:
alertClass = 'alert-info';
}
$('#loggedInDisplay > .alert').addClass(alertClass);
}
$('.portal-back').click(function() {
window.location = "/members-only/";
});
$('#logout').click(function() {
window.location = "/members-only/logout.php";
});
});
function updateFormState($form, disabled, submit = false) {
let data = false;
if (submit) {
data = $form.serialize();
$form.find(".submit-label").hide();
$form.find(".submitted-label").show();
}
else {
$form.find(".submit-label").show();
$form.find(".submitted-label").hide();
}
$form.find('input, select, button').prop('disabled', disabled);
return data;
}