Skip to content

Commit 1c325b0

Browse files
committed
Beautify and lint along with minor fixes.
1 parent 7e5d1be commit 1c325b0

File tree

8 files changed

+2030
-1969
lines changed

8 files changed

+2030
-1969
lines changed

js/admin.js

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,57 @@
11
"use strict";
22

3+
/*global Parse */
4+
35
/**
46
* Singleton for admin page
57
*/
68
var helloAdmin = {
7-
/**
8-
* Initialize admin page
9-
*/
10-
init: function () {
9+
/**
10+
* Initialize admin page
11+
*/
12+
init: function () {
1113

14+
Parse.initialize("x8FmMInL8BbVeBqonPzgvS8WNKbPro65Li5DzTI0", "Y7PPNnhLPhCdFMAKgw7amBxGerz67gAnG3UKb53s");
1215

13-
Parse.initialize("x8FmMInL8BbVeBqonPzgvS8WNKbPro65Li5DzTI0", "Y7PPNnhLPhCdFMAKgw7amBxGerz67gAnG3UKb53s");
16+
if (Parse.User.current() === null) {
17+
$("#loginPanel").show();
18+
$("#logoutPanel").hide();
19+
} else {
20+
$("#loginPanel").hide();
21+
$("#logoutPanel").show();
1422

15-
if (Parse.User.current() == null) {
16-
$("#loginPanel").show();
17-
$("#logoutPanel").hide();
18-
} else {
19-
$("#loginPanel").hide();
20-
$("#logoutPanel").show();
23+
$("#userInfo").html(Parse.User.current().get("username"));
24+
}
2125

22-
$("#userInfo").html(Parse.User.current().get("username"));
23-
}
26+
$("#logoutButton").click(function () {
27+
Parse.User.logOut();
28+
$("#loginPanel").show();
29+
$("#logoutPanel").hide();
30+
});
2431

25-
$("#logoutButton").click(function() {
26-
Parse.User.logOut();
27-
$("#loginPanel").show();
28-
$("#logoutPanel").hide();
29-
});
32+
$("#loginForm").submit(function () {
3033

31-
$("#loginForm").submit( function() {
34+
var userEmail = $("#userEmail").val();
35+
var userPassword = $("#userPassword").val();
3236

33-
var userEmail = $("#userEmail").val();
34-
var userPassword = $("#userPassword").val();
37+
Parse.User.logIn(userEmail, userPassword, {
38+
success: function (user) {
3539

36-
Parse.User.logIn(userEmail, userPassword, {
37-
success: function(user) {
40+
$("#userInfo").html(user.get("username"));
3841

39-
$("#userInfo").html(Parse.User.current().get("username"));
42+
$("#loginPanel").hide();
43+
$("#logoutPanel").show();
4044

41-
$("#loginPanel").hide();
42-
$("#logoutPanel").show();
45+
},
46+
error: function (user, error) {
47+
console.log(user);
4348

44-
},
45-
error: function(user, error) {
46-
console.log(error);
47-
$("#loginFailed").show();
48-
$("#loginError").html(error.message);
49-
}
50-
});
49+
$("#loginFailed").show();
50+
$("#loginError").html(error.message);
51+
}
52+
});
5153

52-
return false;
53-
});
54-
}
55-
};
54+
return false;
55+
});
56+
}
57+
};

0 commit comments

Comments
 (0)