Fix some of the niceties in Post
[blerg.git] / www / jssrc / blerg / Post.js
index a43abf8..112a497 100644 (file)
@@ -3,19 +3,25 @@ enyo.kind({
     kind: "Control",
     classes: "blerg-post",
     handlers: {
-        onPostVisibility: "postVisibilityUpdate"
+        onPostVisibility: "postVisibilityUpdate",
+        onLogin: "loggedIn",
+        onLogout: "loggedOut"
     },
     resizePostContentTimeout: null,
     components: [
         {tag: "h2", content: "What's on your mind?"},
         {kind: "onyx.InputDecorator", components: [
-            {name: "postContent", classes: "content", kind: "onyx.TextArea", onkeydown: "resizePostContent"}
+            {name: "postContent", classes: "content", kind: "onyx.TextArea", onkeydown: "resizePostContent", attributes: {tabindex: 4}}
         ]},
         {classes: "buttons", components: [
-            {kind: "onyx.Button", content: "Close", onclick: "closePost", classes: "onyx-negative"},
-            {kind: "onyx.Button", content: "Post", onclick: "doPost", classes: "onyx-affirmative"}
+            {name: "loginReminder", tag: "span", classes: "blerg-error", style: "margin-right: 8px; vertical-align: 60%", content: "You must log in before posting."},
+            {kind: "onyx.Button", content: "Close", onclick: "closePost", classes: "onyx-negative", attributes: {tabindex: 6}},
+            {name: "postButton", kind: "onyx.Button", content: "Post", onclick: "doPost", classes: "onyx-affirmative", disabled: true, attributes: {tabindex: 5}}
         ]}
     ],
+    create: function() {
+        this.inherited(arguments);
+    },
     getData: function() {
         return this.$.postContent.getValue();
     },
@@ -59,5 +65,13 @@ enyo.kind({
             }
             this.resizePostContentTimeout = null;
         }.bind(this), 150);
+    },
+    loggedIn: function() {
+        this.$.postButton.setDisabled(false);
+        this.$.loginReminder.hide();
+    },
+    loggedOut: function() {
+        this.$.postButton.setDisabled(true);
+        this.$.loginReminder.show();
     }
 });