Changeset - ecbb597c336c
[Not reviewed]
default
0 2 0
Andrew Shadura - 11 years ago 2015-03-21 16:08:16
andrew@shadura.me
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
2 files changed with 6 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/summary.py
Show inline comments
 
@@ -169,13 +169,13 @@ class SummaryController(BaseRepoControll
 

	
 
            c.trending_languages = json.dumps(
 
                sorted(lang_stats, reverse=True, key=lambda k: k[1])[:10]
 
            )
 
        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 = \
 
            self.__get_readme_data(c.db_repo)
 
        return render('summary/summary.html')
 

	
 
@@ -193,13 +193,13 @@ class SummaryController(BaseRepoControll
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    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')
 

	
 
        td = date.today() + timedelta(days=1)
 
        td_1m = td - timedelta(days=calendar.mdays[td.month])
kallithea/templates/summary/summary.html
Show inline comments
 
@@ -380,14 +380,17 @@ $(document).ready(function(){
 
            show_more.appendChild(td);
 
            show_more.appendChild(document.createElement('td'));
 
            tbl.appendChild(show_more);
 
        }
 

	
 
    }
 
    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();
 
    });
 
});
 
</script>
0 comments (0 inline, 0 general)