X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=www%2Fjssrc%2Fblerg%2FUser.js;h=992b53fccc46ed17006ea666b0bea7749c222fcb;hb=4210d2d20df6635e19c20f5b303d498f4657968b;hp=1775d0ad3010f887d7da855488156902c1a81d1c;hpb=4c3823106abb40d31797b51eeb047018698afc12;p=blerg.git diff --git a/www/jssrc/blerg/User.js b/www/jssrc/blerg/User.js index 1775d0a..992b53f 100644 --- a/www/jssrc/blerg/User.js +++ b/www/jssrc/blerg/User.js @@ -4,7 +4,8 @@ enyo.kind({ listKind: "blerg.Record", handlers: { onLogin: "getStalkStatus", - onLogout: "getStalkStatus" + onLogout: "getStalkStatus", + onReload: "usernameChanged" }, published: { username: "", @@ -17,16 +18,20 @@ enyo.kind({ {name: "stalkLink", kind: "blerg.Link", content: "[stalk]", showing: false, onNavigate: "startStalking"}, {name: "unstalkLink", kind: "blerg.Link", content: "[stop stalking]", showing: false, onNavigate: "stopStalking"}, {name: "rssLink", kind: "blerg.Link", components: [ - {noDom: true, content: "["}, + {tag: null, content: "["}, {kind: "Image", src: "/images/rss.png", attributes: {width: 16, height: 16}}, - {noDom: true, content: "RSS]"} + {tag: null, content: "RSS]"} ]} ]}, {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: { @@ -63,9 +68,11 @@ enyo.kind({ }, loadItems: function(from, to) { this.inherited(arguments); + this.$.loadMoreButton.hide(); this.$.api.loadUserRecords(this.username, from, to); }, itemsLoaded: function(inSender, inEvent) { + this.$.userNotFoundMessage.hide(); if (this.permalink) { this.$.loadMoreButton.hide(); } else { @@ -77,9 +84,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();