Some changes to make things suck less on small screens
[blerg.git] / www / jssrc / blerg / Post.js
index 064db00..b4ab559 100644 (file)
@@ -5,26 +5,27 @@ enyo.kind({
     handlers: {
         onPostVisibility: "postVisibilityUpdate",
         onLogin: "loggedIn",
-        onLogout: "loggedOut"
+        onLogout: "loggedOut",
+        onkeydown: "keyHandler"
     },
     components: [
         {tag: "h2", content: "What's on your mind?"},
         {kind: "onyx.InputDecorator", alwaysLooksFocused: true, classes: "content-decorator", fit: true, components: [
             {name: "postContent", kind: "onyx.TextArea", classes: "content", onkeyup: "updatePreview", attributes: {tabindex: 4}}
         ]},
-        {name: "toolbar", kind: "FittableColumns", classes: "toolbar", components: [
+        {name: "toolbar", classes: "toolbar", components: [
+            {classes: "buttons", fit: true, components: [
+                {name: "loginReminder", tag: "span", classes: "blerg-error", style: "margin-right: 8px", 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}}
+            ]},
             {classes: "switcher", components: [
                 {kind: "onyx.RadioGroup", onActivate: "switchBottomPanel", components: [
                     {name: "replyButton", content: "Replying to", showing: false},
                     {name: "previewButton", content: "Preview"},
                     {content: "Help"}
                 ]}
-            ]},
-            {classes: "buttons", fit: true, components: [
-                {name: "loginReminder", tag: "span", classes: "blerg-error", style: "margin-right: 8px", 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}}
-            ]},
+            ]}
         ]},
         {name: "bottomPanel", kind: "Panels", classes: "bottom-panel", draggable: false, fit: true, components: [
             {kind: "Scroller", components: [
@@ -93,8 +94,14 @@ enyo.kind({
             this.$.toolbar.reflow();
             this.reflow();
         } else {
-            this.hide();
+            this.$.postContent.node.blur();
+            setTimeout(function() {
+                this.hide();
+                this.removeClass('exit');
+            }.bind(this), 500);
         }
+        this.addRemoveClass('enter', inEvent.showing);
+        this.addRemoveClass('exit', !inEvent.showing);
     },
     updatePreview: function(inSender, inEvent) {
         this.$.preview.setContent(blerg.Util.blergFormat(this.getData()));
@@ -127,4 +134,9 @@ enyo.kind({
             this.loadHelp();
         }
     },
+    keyHandler: function(inSender, inEvent) {
+        if (inEvent.which == 27) {
+            this.closePost();
+        }
+    }
 });