X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;ds=sidebyside;f=www%2Fjssrc%2Fblerg%2FUser.js;h=78f5247bf5751210715ee56b150b6e083fc8bcfe;hb=4720a1f90f7d42f3611f064cc5ba3d768a92b5c6;hp=1775d0ad3010f887d7da855488156902c1a81d1c;hpb=4c3823106abb40d31797b51eeb047018698afc12;p=blerg.git diff --git a/www/jssrc/blerg/User.js b/www/jssrc/blerg/User.js index 1775d0a..78f5247 100644 --- a/www/jssrc/blerg/User.js +++ b/www/jssrc/blerg/User.js @@ -24,9 +24,13 @@ enyo.kind({ ]}, {name: "records"}, {name: "spinner", kind: "OldSchoolSpinner", showing: false}, + {name: "emptyAccountMessage", showing: false, content: "Hey, there's nothing here!"}, + {name: "userNotFoundMessage", classes: "blerg-error", showing: false, content: "User not found"}, {name: "loadMoreButton", kind: "onyx.Button", onclick: "loadMore", content: "Load More"}, {name: "api", kind: "blerg.API", onItemsLoaded: "itemsLoaded", + onUserNotFound: "userNotFound", + onAPIError: "apiError", onSubscriptionStatus: "gotStalkStatus"} ], statics: { @@ -66,6 +70,7 @@ enyo.kind({ this.$.api.loadUserRecords(this.username, from, to); }, itemsLoaded: function(inSender, inEvent) { + this.$.userNotFoundMessage.hide(); if (this.permalink) { this.$.loadMoreButton.hide(); } else { @@ -77,9 +82,22 @@ enyo.kind({ } this.addItems(inEvent.entries); - if (this.lastRecord == 0) + if (this.lastRecord == 0 || inEvent.entries.length == 0) this.$.loadMoreButton.hide(); }, + addItems: function(items) { + this.$.emptyAccountMessage.setShowing(items.length == 0); + this.inherited(arguments); + }, + userNotFound: function() { + this.addItems([]); + this.$.emptyAccountMessage.hide(); + this.$.userNotFoundMessage.show(); + }, + apiError: function() { + this.addItems([]); + alert('Unknown API Error'); + }, getStalkStatus: function() { if (!blerg.API.loggedIn) { this.$.stalkLink.hide();