changeset 4932:ecbb597c336c

stats: fix display when no data ready yet * jQ uses .append(), not .appendChild() * when no data ready, display a nice message * rephrase the message, the data isn't ready, not hasn't loaded yet
author Andrew Shadura <andrew@shadura.me>
date Sat, 21 Mar 2015 16:08:16 +0100
parents 2f1072c9084a
children 9c252005e5fd
files kallithea/controllers/summary.py kallithea/templates/summary/summary.html
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/summary.py	Sat Mar 21 18:47:18 2015 +0100
+++ b/kallithea/controllers/summary.py	Sat Mar 21 16:08:16 2015 +0100
@@ -172,7 +172,7 @@
             )
         else:
             c.no_data = True
-            c.trending_languages = json.dumps({})
+            c.trending_languages = json.dumps([])
 
         c.enable_downloads = c.db_repo.enable_downloads
         c.readme_data, c.readme_file = \
@@ -196,7 +196,7 @@
     def statistics(self, repo_name):
         if c.db_repo.enable_statistics:
             c.show_stats = True
-            c.no_data_msg = _('No data loaded yet')
+            c.no_data_msg = _('No data ready yet')
         else:
             c.show_stats = False
             c.no_data_msg = _('Statistics are disabled for this repository')
--- a/kallithea/templates/summary/summary.html	Sat Mar 21 18:47:18 2015 +0100
+++ b/kallithea/templates/summary/summary.html	Sat Mar 21 16:08:16 2015 +0100
@@ -383,8 +383,11 @@
         }
 
     }
+    if (data.length == 0) {
+        tbl.innerHTML = "<tr><td>${_('No data ready yet')}</td></tr>";
+    }
 
-    $('#lang_stats').appendChild(tbl);
+    $('#lang_stats').append(tbl);
     $('#code_status_show_more').click(function(){
         $('.stats_hidden').show();
         $('#code_status_show_more').hide();