X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=www%2Fjssrc%2Fblerg%2FControls.js;h=529df1e1f64326462621e0d7aeff230de0c90829;hb=6eee0074c07ce85359975621ff832943d320493a;hp=e5939762d5656754bed6a1aa1bda20fe862c9b59;hpb=f847ba1d5f8cdbb2e5a94d8ad779f14d223c0a68;p=blerg.git diff --git a/www/jssrc/blerg/Controls.js b/www/jssrc/blerg/Controls.js index e593976..529df1e 100644 --- a/www/jssrc/blerg/Controls.js +++ b/www/jssrc/blerg/Controls.js @@ -10,42 +10,42 @@ enyo.kind({ handlers: { onLogin: "login", onLogout: "logout", - onPostVisibility: "postVisibilityUpdate" + onPostVisibility: "postVisibilityUpdate", + onClearFeedStatus: "clearFeedStatus" }, components: [ {name: "loggedOutControls", components: [ {tag: "form", onsubmit: "loginClicked", classes: "login", components: [ {kind: "onyx.Groupbox", components: [ {kind: "onyx.InputDecorator", components: [ - {name: "username", kind: "onyx.Input", placeholder: "Username"} + {name: "username", kind: "onyx.Input", placeholder: "Username", attributes: {tabindex: 1}} ]}, {kind: "onyx.InputDecorator", components: [ - {name: "password", kind: "onyx.Input", placeholder: "Password", type: "password"} + {name: "password", kind: "onyx.Input", placeholder: "Password", type: "password", attributes: {tabindex: 2}} ]}, ]}, - {kind: "onyx.Button", content: "Login", onclick: "loginClicked"} + {kind: "onyx.Button", content: "Login", onclick: "loginClicked", attributes: {tabindex: 3}} ]} ]}, {name: "loggedInControls", showing: false, components: [ {name: "greeting", components: [ - {noDom: true, content: "Hello, "}, + {tag: null, content: "Hello, "}, {name: "userlink", tag: "a"}, - {noDom: true, content: ". "}, + {tag: null, content: ". "}, {kind: "blerg.Link", content: "Logout", onNavigate: "logoutClicked"}, - {noDom: true, content: "."} - ]}, - {components: [ - {name: "rssButton", kind: "blerg.Link", showing: false, components: [ - {kind: "Image", src: "/images/rss.png", width: 16, height: 16}, - {noDom: true, content: " RSS"} - ]} + {tag: null, content: "."}, + {tag: "br"}, + {kind: "blerg.Link", content: "Change Password", onNavigate: "changePasswordClicked"}, + {tag: null, content: "."} ]}, {classes: "blerg-controls-toolbar", components: [ {kind: "onyx.Button", content: "Feed Your Vanity", onclick: "chatterClicked"}, - {kind: "onyx.Button", content: "Stalk Your Victims", onclick: "feedClicked"}, + {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"} ], showRSS: function(url) { this.$.rssButton.show(); @@ -82,9 +82,18 @@ enyo.kind({ this.$.userlink.setAttribute('href', '/#' + inEvent.username); this.$.userlink.setContent('@' + inEvent.username); this.username = inEvent.username; + + this.updateFeedInfo(); + this.feedStatusUpdateInterval = setInterval(function() { + this.updateFeedInfo(); + }.bind(this), 900000); }, logout: function(inSender, inEvent) { this.setLoggedIn(false); + clearInterval(this.feedStatusUpdateInterval); + }, + changePasswordClicked: function() { + this.bubble('onShowChangePassword'); }, spewToggle: function(inSender, inEvent) { this.postShowing = !this.postShowing; @@ -94,6 +103,17 @@ enyo.kind({ this.postShowing = inEvent.showing; this.$.spewButton.addRemoveClass('active', inEvent.showing); }, + updateFeedInfo: function() { + this.$.api.getFeedInfo(); + }, + 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'); + } + }, chatterClicked: function() { window.location.href = '/#/ref/' + this.username; this.bubble('onNavigate'); @@ -101,5 +121,8 @@ enyo.kind({ feedClicked: function() { window.location.href = '/#/feed'; this.bubble('onNavigate'); + }, + clearFeedStatus: function() { + this.gotFeedInfo(this, {new: 0}); } });