From 3164e2f28bbdf72947152ff4704d459ad64aed20 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 29 May 2012 11:06:18 +0530 Subject: [PATCH] refresh stats in doclist --- js/wn/views/doclistview.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/js/wn/views/doclistview.js b/js/wn/views/doclistview.js index 638554ceeb..891a8f1fff 100644 --- a/js/wn/views/doclistview.js +++ b/js/wn/views/doclistview.js @@ -210,12 +210,16 @@ wn.views.DocListView = wn.ui.Listing.extend({ $.each(me.listview.stats, function(i, v) { me.render_stat(v, r.message[v]); }); - - // This doesn't give a predictable stats order - /* - $.each(r.message, function(field, stat) { - me.render_stat(field, stat); - });*/ + + // reload button at the end + if(me.listview.stats.length) { + $('') + .click(function() { + me.reload_stats(); + }).appendTo($('
') + .appendTo(me.$page.find('.layout-side-section'))) + } + } }); }, @@ -275,6 +279,10 @@ wn.views.DocListView = wn.ui.Listing.extend({ this.setup_stat_item_click($item); return $item; }, + reload_stats: function() { + this.$page.find('.layout-side-section .stat-wrapper').remove(); + this.init_stats(); + }, setup_stat_item_click: function($item) { var me = this; $item.find('a').click(function() {