X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=www%2Fjssrc%2Fblerg%2FControls.js;h=abd43ea424d2be7a80a494f5845c77352609660a;hb=848df2d1d186a30c4f1dc0401e6911d2230b3c63;hp=0827ff76973d3ce2d892b810e8c3c5066000fe5b;hpb=8f635fec79961b4aaabaab184e9576c5b97122af;p=blerg.git diff --git a/www/jssrc/blerg/Controls.js b/www/jssrc/blerg/Controls.js index 0827ff7..abd43ea 100644 --- a/www/jssrc/blerg/Controls.js +++ b/www/jssrc/blerg/Controls.js @@ -10,8 +10,7 @@ enyo.kind({ handlers: { onLogin: "login", onLogout: "logout", - onPostVisibility: "postVisibilityUpdate", - onClearFeedStatus: "clearFeedStatus" + onPostVisibility: "postVisibilityUpdate" }, components: [ {name: "loggedOutControls", components: [ @@ -35,17 +34,19 @@ enyo.kind({ {kind: "blerg.Link", content: "Logout", onNavigate: "logoutClicked"}, {tag: null, content: "."}, {tag: "br"}, - {kind: "blerg.Link", content: "Change Password", onNavigate: "changePasswordClicked"}, + {kind: "blerg.Link", content: "Account Center", href: '/#/account'}, {tag: null, content: "."} ]}, {classes: "blerg-controls-toolbar", components: [ - {kind: "onyx.Button", content: "Feed Your Vanity", onclick: "chatterClicked"}, + {name: "mentionButton", kind: "onyx.Button", content: "Feed Your Vanity", onclick: "chatterClicked"}, {name: "feedButton", kind: "onyx.Button", classes: "feed-button", content: "Stalk Your Victims", onclick: "feedClicked"}, {name: "spewButton", kind: "onyx.Button", classes: "spew-button", content: "Spew It!", onclick: "spewToggle"} ]}, ]}, {name: "api", kind: "blerg.API", - onFeedInfo: "gotFeedInfo"} + onStatus: "gotStatus"}, + {kind: "Signals", + onClearNotification: "clearNotification"} ], showRSS: function(url) { this.$.rssButton.show(); @@ -95,9 +96,9 @@ enyo.kind({ this.$.userlink.setContent('@' + inEvent.username); this.username = inEvent.username; - this.updateFeedInfo(); + this.updateStatus(); this.feedStatusUpdateInterval = setInterval(function() { - this.updateFeedInfo(); + this.updateStatus(); }.bind(this), 900000); }, logout: function(inSender, inEvent) { @@ -115,15 +116,20 @@ enyo.kind({ this.postShowing = inEvent.showing; this.$.spewButton.addRemoveClass('active', inEvent.showing); }, - updateFeedInfo: function() { - this.$.api.getFeedInfo(); + updateStatus: function() { + this.$.api.getStatus(); }, - gotFeedInfo: function(inSender, inEvent) { - this.$.feedButton.addRemoveClass('new', inEvent.new > 0); - if (inEvent.new > 0) { - this.$.feedButton.setContent('Stalk Your Victims (' + inEvent.new + ')'); - } else { - this.$.feedButton.setContent('Stalk Your Victims'); + gotStatus: function(inSender, inEvent) { + if ('mentioned' in inEvent) { + this.$.mentionButton.addRemoveClass('new', inEvent.mentioned); + } + if ('feed_new' in inEvent) { + this.$.feedButton.addRemoveClass('new', inEvent.feed_new > 0); + if (inEvent.feed_new > 0) { + this.$.feedButton.setContent('Stalk Your Victims (' + inEvent.feed_new + ')'); + } else { + this.$.feedButton.setContent('Stalk Your Victims'); + } } }, chatterClicked: function() { @@ -134,7 +140,11 @@ enyo.kind({ window.location.href = '/#/feed'; this.bubble('onNavigate'); }, - clearFeedStatus: function() { - this.gotFeedInfo(this, {new: 0}); + clearNotification: function(inSender, inEvent) { + if (inEvent.type == 'feed') { + this.gotStatus(this, {feed_new: 0}); + } else if (inEvent.type == 'mentioned') { + this.gotStatus(this, {mentioned: false}); + } } });