Commit 9ee8b0a6 authored by bbaer's avatar bbaer
Browse files

relay comment.edited changes to CodeCorrection for save

parent 0683d55e
Pipeline #1461 failed with stage
in 1 minute and 16 seconds
......@@ -240,6 +240,9 @@ var QfqNS = QfqNS || {};
console.log("With data: " + argument.data);
that._handleNew(argument.data);
});
commentCOntroller.on('comment.edited', function() {
this._updateJSON();
});
};
n.CodeCorrection.prototype._handleNew = function(eventData) {
......
......@@ -35,8 +35,11 @@ var QfqNS = QfqNS || {};
this.options = options;
}
this.childrenController = {};
this.eventEmitter = new EventEmitter();
};
n.Comment.prototype.on = n.EventEmitter.onMixin;
n.Comment.prototype.display = function() {
var displayElement;
displayElement = this._buildComment();
......@@ -144,7 +147,8 @@ var QfqNS = QfqNS || {};
this.comment.comment = e.data.text;
this._updateText(e.data.text);
this.$comment.show();
e.data.$container.destroy();
e.data.$container.remove();
this.emitEvent('comment.edited', n.EventEmitter.makePayload(this, this.comment));
};
})(QfqNS);
\ No newline at end of file
......@@ -103,10 +103,18 @@ var QfqNS = QfqNS || {};
commentObject.display();
this.comments.push(commentObject);
this._changeHandler("new", commentObject);
this.comment.on('comment.edited')
this.updateHeight();
return this.comments.length - 1;
};
n.CommetController.prototype._setCommentListeners = function(commentObject) {
var that = this;
commentObject.on('comment.edited', function(e) {
that.updateComment(e.data);
});
};
n.CommentController.prototype.displayComments = function() {
for (var i = 0; this.comments; i++) {
this.comments[i].display();
......@@ -146,8 +154,10 @@ var QfqNS = QfqNS || {};
};
n.CommentController.prototype.updateComment = function(reference, data) {
n.CommentController.prototype.updateComment = function(data) {
console.log("[Comment Changed] User: " + data.uid +
" Text:" + data.comment.substring(0, 20) + "...");
this.emitEvent("edit");
};
n.CommentController.prototype.updateHeight = function() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment