Loading template/app/controller/Comments.js +8 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,12 @@ Ext.define('Docs.controller.Comments', { } }, 'commentsPager': { loadMore: function(offset) { this.fetchRecentComments(offset); } }, 'commentsUsers': { select: function(username) { this.recentCommentsSettings.username = username; Loading Loading @@ -87,7 +93,8 @@ Ext.define('Docs.controller.Comments', { params: params, success: function(comments) { this.getCommentsFullList().setMasked(false); this.getCommentsFullList().load(comments); var append = offset > 0; this.getCommentsFullList().load(comments, append); }, scope: this }); Loading template/app/view/comments/FullList.js +7 −2 Original line number Diff line number Diff line Loading @@ -81,8 +81,13 @@ Ext.define('Docs.view.comments.FullList', { this.setMasked(true); }, load: function(comments) { this.down("commentsList").load(comments); /** * Loads array of comments into the view. * @param {Object[]} comments * @param {Boolean} append True to append the comments to existing ones. */ load: function(comments, append) { this.down("commentsList").load(comments, append); this.down("commentsPager").configure(comments[comments.length-1]); }, Loading template/app/view/comments/List.js +3 −2 Original line number Diff line number Diff line Loading @@ -76,14 +76,15 @@ Ext.define('Docs.view.comments.List', { /** * Loads array of comments into the view. * @param {Object[]} comments * @param {Boolean} append True to append the comments to existing ones. */ load: function(comments) { load: function(comments, append) { // hide the spinning loader when no comments. if (comments.length === 0) { this.emptyText = ""; } this.store.loadData(comments); this.store.loadData(comments, append); }, syntaxHighlight: function() { Loading template/app/view/comments/Pager.js +10 −7 Original line number Diff line number Diff line Loading @@ -10,10 +10,12 @@ Ext.define('Docs.view.comments.Pager', { this.callParent(arguments); this.getEl().on("click", function() { /** * @event click * @event loadMore * Fired when the link clicked to load more comments. * @param {Number} offset Index offset to the next page of * comments to load. */ this.fireEvent("click"); this.fireEvent("loadMore", this.offset + this.limit); }, this, {preventDefault: true, delegate: "a.fetchMoreComments"}); }, Loading @@ -26,13 +28,14 @@ Ext.define('Docs.view.comments.Pager', { * @param {Object} cfg.total_rows */ configure: function(cfg) { this.update(this.getPagerHtml(cfg)); Ext.apply(this, cfg); this.update(this.getPagerHtml()); }, getPagerHtml: function(cfg) { var total = cfg.total_rows || 0; var loaded = cfg.offset + cfg.limit; var next_load = Math.min(cfg.limit, total - loaded); getPagerHtml: function() { var total = this.total_rows || 0; var loaded = this.offset + this.limit; var next_load = Math.min(this.limit, total - loaded); if (total > loaded) { return [ Loading Loading
template/app/controller/Comments.js +8 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,12 @@ Ext.define('Docs.controller.Comments', { } }, 'commentsPager': { loadMore: function(offset) { this.fetchRecentComments(offset); } }, 'commentsUsers': { select: function(username) { this.recentCommentsSettings.username = username; Loading Loading @@ -87,7 +93,8 @@ Ext.define('Docs.controller.Comments', { params: params, success: function(comments) { this.getCommentsFullList().setMasked(false); this.getCommentsFullList().load(comments); var append = offset > 0; this.getCommentsFullList().load(comments, append); }, scope: this }); Loading
template/app/view/comments/FullList.js +7 −2 Original line number Diff line number Diff line Loading @@ -81,8 +81,13 @@ Ext.define('Docs.view.comments.FullList', { this.setMasked(true); }, load: function(comments) { this.down("commentsList").load(comments); /** * Loads array of comments into the view. * @param {Object[]} comments * @param {Boolean} append True to append the comments to existing ones. */ load: function(comments, append) { this.down("commentsList").load(comments, append); this.down("commentsPager").configure(comments[comments.length-1]); }, Loading
template/app/view/comments/List.js +3 −2 Original line number Diff line number Diff line Loading @@ -76,14 +76,15 @@ Ext.define('Docs.view.comments.List', { /** * Loads array of comments into the view. * @param {Object[]} comments * @param {Boolean} append True to append the comments to existing ones. */ load: function(comments) { load: function(comments, append) { // hide the spinning loader when no comments. if (comments.length === 0) { this.emptyText = ""; } this.store.loadData(comments); this.store.loadData(comments, append); }, syntaxHighlight: function() { Loading
template/app/view/comments/Pager.js +10 −7 Original line number Diff line number Diff line Loading @@ -10,10 +10,12 @@ Ext.define('Docs.view.comments.Pager', { this.callParent(arguments); this.getEl().on("click", function() { /** * @event click * @event loadMore * Fired when the link clicked to load more comments. * @param {Number} offset Index offset to the next page of * comments to load. */ this.fireEvent("click"); this.fireEvent("loadMore", this.offset + this.limit); }, this, {preventDefault: true, delegate: "a.fetchMoreComments"}); }, Loading @@ -26,13 +28,14 @@ Ext.define('Docs.view.comments.Pager', { * @param {Object} cfg.total_rows */ configure: function(cfg) { this.update(this.getPagerHtml(cfg)); Ext.apply(this, cfg); this.update(this.getPagerHtml()); }, getPagerHtml: function(cfg) { var total = cfg.total_rows || 0; var loaded = cfg.offset + cfg.limit; var next_load = Math.min(cfg.limit, total - loaded); getPagerHtml: function() { var total = this.total_rows || 0; var loaded = this.offset + this.limit; var next_load = Math.min(this.limit, total - loaded); if (total > loaded) { return [ Loading