Redesign user tasks
[blerg.git] / www / jssrc / blerg / Controls.js
index 508cd60..f23f63f 100644 (file)
@@ -1,15 +1,16 @@
 enyo.kind({
        name: "blerg.Controls",
        kind: "Control",
-       style: "float: right",
        classes: "blerg-controls",
        username: null,
+       postShowing: false,
        published: {
                loggedIn: false
        },
        handlers: {
                onLogin: "login",
-               onLogout: "logout"
+               onLogout: "logout",
+               onPostVisibility: "postVisibilityUpdate"
        },
        components: [
                {name: "loggedOutControls", components: [
@@ -29,20 +30,21 @@ enyo.kind({
                        {name: "greeting", components: [
                                {noDom: true, content: "Hello, "},
                                {name: "userlink", tag: "a"},
+                               {noDom: true, content: ". "},
+                               {kind: "blerg.Link", content: "Logout", onNavigate: "logoutClicked"},
                                {noDom: true, content: "."}
                        ]},
-                       {classes: "onyx-toolbar-inline", components: [
-                               {kind: "onyx.Button", content: "Write", onclick: "writeClicked"},
-                               {kind: "onyx.Button", content: "Hearsay", onclick: "chatterClicked"},
-                               {kind: "onyx.Button", content: "Stalking", onclick: "feedClicked"},
-                               {kind: "onyx.Button", content: "Logout", onclick: "logoutClicked"}
-                       ]},
                        {components: [
-                               {name: "rssButton", showing: false, kind: "blerg.Link", components: [
+                               {name: "rssButton", kind: "blerg.Link", showing: false, components: [
                                        {kind: "Image", src: "/images/rss.png", width: 16, height: 16},
                                        {noDom: true, content: " RSS"}
                                ]}
-                       ]}
+                       ]},
+                       {classes: "blerg-controls-toolbar", components: [
+                               {kind: "onyx.Button", content: "Feed Your Vanity", onclick: "chatterClicked"},
+                               {kind: "onyx.Button", content: "Stalk Your Victims", onclick: "feedClicked"},
+                               {name: "spewButton", kind: "onyx.Button", classes: "spew-button", content: "Spew It!", onclick: "spewToggle"}
+                       ]},
                ]}
        ],
        showRSS: function(url) {
@@ -72,6 +74,7 @@ enyo.kind({
        },
        logoutClicked: function() {
                this.bubble('onTryLogout');
+               return true;
        },
        login: function(inSender, inEvent) {
                this.$.password.setValue('');
@@ -82,5 +85,13 @@ enyo.kind({
        },
        logout: function(inSender, inEvent) {
                this.setLoggedIn(false);
+       },
+       spewToggle: function(inSender, inEvent) {
+               this.postShowing = !this.postShowing;
+               this.bubble('onPostVisibility', {showing: this.postShowing});
+       },
+       postVisibilityUpdate: function(inSender, inEvent) {
+               this.postShowing = inEvent.showing;
+               this.$.spewButton.addRemoveClass('active', inEvent.showing);
        }
 });