Views.WallPostComment = Views.Base.extend({ classType: "Views.WallPostComment", tagName: "div", listenEvents: function() { //See Views.Base listenDefaultEvents() this.on("onrender", this.onRender); this.on("onmouseenter", this.manageDeleteIcon); }, manageDeleteIcon: function() { if (this.model.get("isdeletable") == false) { $("#remove_" + this.model.cid).remove(); } }, hide: function(callback) { //this.$el.animate({height:'0px'}, 100, callback); var that = this; this.$el.animate({height:'toggle'}, 300, function() { if (callback) { callback(); } that.trigger("onhide"); }); this.options.isShowed = false; }, show: function(callback) { //this.$el.animate({height:'0px'}, 100, callback); var that = this; this.$el.animate({height:'toggle'}, 300, function() { if (callback) { callback(); } that.trigger("onshow"); }); this.options.isShowed = true; }, onRender: function() { var that = this; this.model.on("remove", function(event) { that.removeComment(event); }); }, removeComment: function(aModel) { var url = edApplication().path + "delete_comment.fl"; var aData = {postID: aModel.id}; $.ajax({ url: url, data: aData, context: this, dataType:"json", success: function(data) { if (this.options.displayinfonotification) { Utils.openDialog(edApplication().labels.LABELINFORMATION, edApplication().labels.LABELDELETESUCCESS, {closetimeout: 5000, linkTo: this.deleteImg, position: "STACK"}); } this.options.parentview.options.parentview.model.set("nbcomment", this.options.parentview.options.parentview.model.get("nbcomment") - 1); this.options.parentview.model.remove(this.model); this.options.parentview.options.parentview.generateCommentLink(); }, error: function(jqXHR, textStatus, errorThrown) { console.log("error :"); console.log("jqXHR :"); console.log(jqXHR); console.log("textStatus :"); console.log(textStatus); console.log("errorThrown :"); console.log(errorThrown); } }); } }); Views.WallPostCommentList = Views.BaseList.extend({ classType: "Views.WallPostCommentList", listenEvents: function() { //See Views.Base listenDefaultEvents() this.on("onrender", this.onRender); this.on("oninitialize", this.onInitialize); }, onInitialize: function() { if (!this.options.actions) { this.options.actions = {}; } }, onRender: function() { if (this.options.parentview) { this.options.displayinfonotification = this.options.parentview.options.displayinfonotification; } }, getCollectionFromJSON: function(str) { var parsedValues = str; var modelValue = new this.options.descriptor["model"](); modelValue.cid=this.cid; if (!$.isArray(parsedValues["posts"])) { modelValue.add(new this.options.descriptor["viewItem"]["model"](parsedValues["posts"])); } else { for (var j=0; j