Skip to content

Commit

Permalink
handle case when there are no categories
Browse files Browse the repository at this point in the history
  • Loading branch information
mboinet committed May 20, 2013
1 parent 5e7d484 commit cb66566
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/scripts/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ define(['jquery', 'models', 'templates','conf','utils'],

this.LVrefreshNeeded = true;

// if nothing yet, cleanup listview
if (this.$('li.ui-li-static').html() == "Loading..."){
// if nothing yet (only a static message), cleanup listview
if (this.$('li.ui-li-static').length != 0){
this.$lv.empty();
}

Expand Down Expand Up @@ -119,6 +119,20 @@ define(['jquery', 'models', 'templates','conf','utils'],
// this is called each time the collection is
// synced
onSync: function(){
// in case there are no feeds after a refresh
if (this.collection.length == 0){

var msg = "No categories";

if (models.settingsModel.get("hideEmptyCategories")){
msg = "No unread categories";
}

// add the list element
this.$lv.html(tpl.roListElement({text: msg}));
this.LVrefreshNeeded = true;
}

if (this.LVrefreshNeeded){
this.$lv.listview("refresh");
this.LVrefreshNeeded = false;
Expand Down

0 comments on commit cb66566

Please sign in to comment.