Added comments to javascript code.

This commit is contained in:
K. Nobel
2017-02-03 13:19:00 +01:00
parent 1c53eab2fa
commit 7cc6450e6a
3 changed files with 40 additions and 17 deletions

View File

@@ -3,16 +3,20 @@ function placeGroupButtons() {
.done(function(data) {
var $buttonContainer = $("div.group-button-container");
// Append the right group button to the button container.
// When user is not a member
if(data == 'none') {
$buttonContainer.append(
"<button class='green group-button' value='request'>" +
"<i class='fa fa-plus'></i> Voeg toe" +
"</button>");
// when user sent a request to become a member.
} else if(data == 'request') {
$buttonContainer.append(
"<button class='red group-button' value='none'>" +
"<i class='fa fa-times'></i> Trek verzoek in" +
"</button>");
// When user is a member of the group.
} else {
$buttonContainer.append(
"<button class='red group-button' value='none'>" +
@@ -20,6 +24,7 @@ function placeGroupButtons() {
"</button>");
}
// Gets triggered when a group button is clicked.
$buttonContainer.children().click(function() {
$.post("API/editMembership.php", { grp: groupID, role: this.value })
.done(function() {