Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fedf6fb
commit 2e90472
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
let gUpdate = { | ||
|
||
/* WHITE BOARD */ | ||
whiteboard: function() { | ||
let form = $("#form-whiteboard"); | ||
form.classList.add("loading"); | ||
form.setAttribute("disabled", "true"); | ||
let shell = {whiteboard: form.value}; | ||
gBz.updateBug(gWorld.bugid, shell, | ||
function(error, success) { | ||
form.classList.remove("loading"); | ||
form.setAttribute("disabled", "true"); | ||
if (error || !success) { | ||
console.error("Error while updating whiteboard list"); | ||
return; | ||
} | ||
}); | ||
return false; | ||
}, | ||
|
||
/* COMMENTS */ | ||
|
||
postComment: function() { | ||
let text = $(".addcomment > textarea").value; | ||
let comment = {text: text}; | ||
let id = gWorld.bugid; | ||
$(".comments").classList.add("loading"); | ||
if (comment) { | ||
gBz.addComment(id, comment, function(error, success) { | ||
if (error || !success) { | ||
$(".comments").classList.remove("loading"); | ||
console.error("Error while posting comment:" + error); | ||
return; | ||
} | ||
this.updateComments(function() { | ||
$(".comments").classList.remove("loading"); | ||
}); | ||
}.bind(this)); | ||
} | ||
}, | ||
|
||
updateComments: function(callback) { | ||
// FIXME: no need to go through all the comments… | ||
gBz.bugComments(gWorld.bugid, function(error, comments) { | ||
if (error) { | ||
console.error("Error: didn't manage to fetch the comments."); | ||
callback(); | ||
return; | ||
} | ||
gWorld.comments = this.preprocessComments(comments); | ||
this.renderTemplateOfType("oncomments"); | ||
callback(); | ||
}.bind(this)); | ||
}, | ||
} |