X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=www%2Fjssrc%2Fblerg%2FUser.js;h=78f5247bf5751210715ee56b150b6e083fc8bcfe;hb=f5eba55960cba26d820f88144776f7177db92c0b;hp=ac4c24c6cb0fa4ccb6be4fc7edd69bc3cbce7986;hpb=80ad774f55998cc11e08694245dfd6cb1b49a86f;p=blerg.git diff --git a/www/jssrc/blerg/User.js b/www/jssrc/blerg/User.js index ac4c24c..78f5247 100644 --- a/www/jssrc/blerg/User.js +++ b/www/jssrc/blerg/User.js @@ -23,9 +23,14 @@ 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: { @@ -65,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 { @@ -76,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();