Loading template/app/view/comments/List.js +18 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,11 @@ Ext.define('Docs.view.comments.List', { initComponent: function() { this.store = Ext.create('Ext.data.Store', { model: "Docs.model.Comment" model: "Docs.model.Comment", listeners: { update: this.fireChangeEvent, scope: this } }); this.tpl = Docs.view.comments.Template.create({showTarget: this.showTarget}); Loading Loading @@ -183,6 +187,19 @@ Ext.define('Docs.view.comments.List', { var processedComments = this.store.getProxy().getReader().readRecords(comments).records; this.store.loadData(processedComments, append); this.fireChangeEvent(); }, fireChangeEvent: function() { /** * @event countChange * Fired when nr of comments in list changes. * @param {Number} count */ var isNotDeleted = function(c) { return !c.get("deleted"); }; this.fireEvent("countChange", this.getStore().queryBy(isNotDeleted).getCount()); } }); template/app/view/comments/ListWithForm.js +6 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,12 @@ Ext.define('Docs.view.comments.ListWithForm', { }) ]; /** * @event countChange * @inheritdoc Docs.view.comments.List#countChange */ this.relayEvents(this.list, ["countChange"]); this.callParent(arguments); }, Loading template/app/view/comments/RepliesExpander.js +8 −2 Original line number Diff line number Diff line Loading @@ -108,7 +108,11 @@ Ext.define('Docs.view.comments.RepliesExpander', { target: this.target, parentId: this.parentId, newCommentTitle: "<b>Reply to comment</b>", renderTo: this.getEl() renderTo: this.getEl(), listeners: { countChange: this.setCount, scope: this } }); Docs.Comments.loadReplies(this.parentId, function(comments) { Loading @@ -122,7 +126,9 @@ Ext.define('Docs.view.comments.RepliesExpander', { */ setCount: function(count) { this.count = count; if (!this.expanded) { this.refreshRepliesButton(); } } }); Loading
template/app/view/comments/List.js +18 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,11 @@ Ext.define('Docs.view.comments.List', { initComponent: function() { this.store = Ext.create('Ext.data.Store', { model: "Docs.model.Comment" model: "Docs.model.Comment", listeners: { update: this.fireChangeEvent, scope: this } }); this.tpl = Docs.view.comments.Template.create({showTarget: this.showTarget}); Loading Loading @@ -183,6 +187,19 @@ Ext.define('Docs.view.comments.List', { var processedComments = this.store.getProxy().getReader().readRecords(comments).records; this.store.loadData(processedComments, append); this.fireChangeEvent(); }, fireChangeEvent: function() { /** * @event countChange * Fired when nr of comments in list changes. * @param {Number} count */ var isNotDeleted = function(c) { return !c.get("deleted"); }; this.fireEvent("countChange", this.getStore().queryBy(isNotDeleted).getCount()); } });
template/app/view/comments/ListWithForm.js +6 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,12 @@ Ext.define('Docs.view.comments.ListWithForm', { }) ]; /** * @event countChange * @inheritdoc Docs.view.comments.List#countChange */ this.relayEvents(this.list, ["countChange"]); this.callParent(arguments); }, Loading
template/app/view/comments/RepliesExpander.js +8 −2 Original line number Diff line number Diff line Loading @@ -108,7 +108,11 @@ Ext.define('Docs.view.comments.RepliesExpander', { target: this.target, parentId: this.parentId, newCommentTitle: "<b>Reply to comment</b>", renderTo: this.getEl() renderTo: this.getEl(), listeners: { countChange: this.setCount, scope: this } }); Docs.Comments.loadReplies(this.parentId, function(comments) { Loading @@ -122,7 +126,9 @@ Ext.define('Docs.view.comments.RepliesExpander', { */ setCount: function(count) { this.count = count; if (!this.expanded) { this.refreshRepliesButton(); } } });