|
@@ -13,6 +13,32 @@ Meteor.startup(function() {
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+/* Global Helpers */
|
|
|
|
+Handlebars.registerHelper("isAdmin", function(argument){
|
|
|
|
+ if (Meteor.user() && Meteor.user().profile) {
|
|
|
|
+ return Meteor.user().profile.rank === "admin";
|
|
|
|
+ } else {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+Handlebars.registerHelper("isModerator", function(argument){
|
|
|
|
+ if (Meteor.user() && Meteor.user().profile && (Meteor.user().profile.rank === "admin" || Meteor.user().profile.rank === "moderator")) {
|
|
|
|
+ return true;
|
|
|
|
+ } else {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+Handlebars.registerHelper("initials", function(argument){
|
|
|
|
+ var user = Meteor.user();
|
|
|
|
+ if (user !== undefined) {
|
|
|
|
+ return user.profile.username[0].toUpperCase();
|
|
|
|
+ } else {
|
|
|
|
+ return "";
|
|
|
|
+ }
|
|
|
|
+});
|
|
|
|
+
|
|
Deps.autorun(function() {
|
|
Deps.autorun(function() {
|
|
Meteor.subscribe("queues");
|
|
Meteor.subscribe("queues");
|
|
Meteor.subscribe("reports");
|
|
Meteor.subscribe("reports");
|
|
@@ -177,6 +203,28 @@ Template.profile.events({
|
|
$("#edit-username").show();
|
|
$("#edit-username").show();
|
|
$("#cancel-username").hide();
|
|
$("#cancel-username").hide();
|
|
$("#input-username").val("");
|
|
$("#input-username").val("");
|
|
|
|
+ },
|
|
|
|
+ // Admins only Edit Rank
|
|
|
|
+ "click #edit-rank": function() {
|
|
|
|
+ $("#rank").hide();
|
|
|
|
+ $("#rank-div").show();
|
|
|
|
+ $("#edit-rank").hide();
|
|
|
|
+ $("#cancel-rank").show();
|
|
|
|
+ },
|
|
|
|
+ "click #submit-rank": function() {
|
|
|
|
+ $("#rank").show();
|
|
|
|
+ $("#rank-div").hide();
|
|
|
|
+ $("#edit-rank").show();
|
|
|
|
+ $("#cancel-rank").hide();
|
|
|
|
+ var newRank = $("#select-rank option:selected").val();
|
|
|
|
+ var username = Session.get("username");
|
|
|
|
+ console.log(username, newRank);
|
|
|
|
+ },
|
|
|
|
+ "click #cancel-rank": function() {
|
|
|
|
+ $("#rank").show();
|
|
|
|
+ $("#rank-div").hide();
|
|
|
|
+ $("#edit-rank").show();
|
|
|
|
+ $("#cancel-rank").hide();
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
@@ -226,13 +274,6 @@ Template.profile.helpers({
|
|
});
|
|
});
|
|
return dislikedArr;
|
|
return dislikedArr;
|
|
},
|
|
},
|
|
- initials: function() {
|
|
|
|
- if (Session.get("username") !== undefined) {
|
|
|
|
- return Session.get("username")[0].toUpperCase();
|
|
|
|
- } else {
|
|
|
|
- return "";
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
isUser: function(){
|
|
isUser: function(){
|
|
var parts = Router.current().url.split('/');
|
|
var parts = Router.current().url.split('/');
|
|
var username = parts.pop();
|
|
var username = parts.pop();
|
|
@@ -310,28 +351,6 @@ Template.header.helpers({
|
|
},
|
|
},
|
|
userId: function() {
|
|
userId: function() {
|
|
return Meteor.userId();
|
|
return Meteor.userId();
|
|
- },
|
|
|
|
- initials: function() {
|
|
|
|
- var user = Meteor.user();
|
|
|
|
- if (user !== undefined) {
|
|
|
|
- return user.profile.username[0].toUpperCase();
|
|
|
|
- } else {
|
|
|
|
- return "";
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- isAdmin: function() {
|
|
|
|
- if (Meteor.user() && Meteor.user().profile) {
|
|
|
|
- return Meteor.user().profile.rank === "admin";
|
|
|
|
- } else {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- isModerator: function() {
|
|
|
|
- if (Meteor.user() && Meteor.user().profile && (Meteor.user().profile.rank === "admin" || Meteor.user().profile.rank === "moderator")) {
|
|
|
|
- return true;
|
|
|
|
- } else {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
@@ -448,20 +467,6 @@ Template.dashboard.helpers({
|
|
} else {
|
|
} else {
|
|
return {};
|
|
return {};
|
|
}
|
|
}
|
|
- },
|
|
|
|
- isAdmin: function() {
|
|
|
|
- if (Meteor.user() && Meteor.user().profile) {
|
|
|
|
- return Meteor.user().profile.rank === "admin";
|
|
|
|
- } else {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- isModerator: function() {
|
|
|
|
- if (Meteor.user() && Meteor.user().profile && (Meteor.user().profile.rank === "admin" || Meteor.user().profile.rank === "moderator")) {
|
|
|
|
- return true;
|
|
|
|
- } else {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
@@ -1100,20 +1105,6 @@ Template.room.helpers({
|
|
loaded: function() {
|
|
loaded: function() {
|
|
return Session.get("loaded");
|
|
return Session.get("loaded");
|
|
},
|
|
},
|
|
- isAdmin: function() {
|
|
|
|
- if (Meteor.user() && Meteor.user().profile) {
|
|
|
|
- return Meteor.user().profile.rank === "admin";
|
|
|
|
- } else {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- isModerator: function() {
|
|
|
|
- if (Meteor.user() && Meteor.user().profile && (Meteor.user().profile.rank === "admin" || Meteor.user().profile.rank === "moderator")) {
|
|
|
|
- return true;
|
|
|
|
- } else {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
paused: function() {
|
|
paused: function() {
|
|
return Session.get("state") === "paused";
|
|
return Session.get("state") === "paused";
|
|
},
|
|
},
|