From 4377f9e224f34c05e7a5de04f390bb2a0cabf6eb Mon Sep 17 00:00:00 2001 From: Chip Black Date: Sat, 26 May 2012 15:06:31 -0700 Subject: [PATCH] Reload user when posting --- www/jssrc/blerg/Blerg.js | 6 +++++- www/jssrc/blerg/Post.js | 6 +++++- www/jssrc/blerg/User.js | 3 ++- www/{js => jssrc/lib}/blergmedia.js | 0 4 files changed, 12 insertions(+), 3 deletions(-) rename www/{js => jssrc/lib}/blergmedia.js (100%) diff --git a/www/jssrc/blerg/Blerg.js b/www/jssrc/blerg/Blerg.js index 45b7d5f..6eac0d8 100644 --- a/www/jssrc/blerg/Blerg.js +++ b/www/jssrc/blerg/Blerg.js @@ -8,7 +8,8 @@ enyo.kind({ onTryLogin: "tryLogin", onTryLogout: "tryLogout", onSetTitle: "setTitle", - onPostVisibility: "postVisibilityUpdate" + onPostVisibility: "postVisibilityUpdate", + onReload: "sendReload" }, components: [ {classes: "blerg-header", components: [ @@ -88,5 +89,8 @@ enyo.kind({ postVisibilityUpdate: function(inSender, inEvent) { this.$.post.waterfall('onPostVisibility', inEvent); this.$.controls.waterfall('onPostVisibility', inEvent); + }, + sendReload: function() { + this.$.main.waterfall('onReload'); } }); diff --git a/www/jssrc/blerg/Post.js b/www/jssrc/blerg/Post.js index ee537f2..0c72a99 100644 --- a/www/jssrc/blerg/Post.js +++ b/www/jssrc/blerg/Post.js @@ -40,7 +40,11 @@ enyo.kind({ postSuccessful: function() { this.setData(''); this.closePost(); - this.href = '#' + blerg.API.username; + if (location.hash != '#' + blerg.API.username) { + qlink(blerg.API.username); + } else { + this.bubble('onReload'); + } }, postFailed: function() { alert('Could not post!'); diff --git a/www/jssrc/blerg/User.js b/www/jssrc/blerg/User.js index 78f5247..7871051 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: "", diff --git a/www/js/blergmedia.js b/www/jssrc/lib/blergmedia.js similarity index 100% rename from www/js/blergmedia.js rename to www/jssrc/lib/blergmedia.js -- 2.34.1