commit:4720a1f90f7d42f3611f064cc5ba3d768a92b5c6
author:Chip Black
committer:Chip Black
date:Thu Apr 26 01:51:15 2012 -0700
parents:f5eba55960cba26d820f88144776f7177db92c0b
Fix some of the niceties in Post
diff --git a/www/js/blerg.js b/www/js/blerg.js
line changes: +0/-10
index 6857bdb..0d114cb
--- a/www/js/blerg.js
+++ b/www/js/blerg.js
@@ -62,13 +62,3 @@ function passwd_cancel() {
     $('navigation').show();
     urlSwitch();
 }
-
-function ExternalURLPost(m) {
-    this.title = decodeURIComponent(m[1]).replace(']','').replace('[','');
-    this.url = decodeURIComponent(m[2]);
-}
-
-ExternalURLPost.prototype.show = function() {
-    $('post.content').value = '[' + this.title + '](' + this.url + ')';
-    $('post').show();
-}

diff --git a/www/jssrc/blerg/Blerg.js b/www/jssrc/blerg/Blerg.js
line changes: +2/-2
index af0f688..45b7d5f
--- a/www/jssrc/blerg/Blerg.js
+++ b/www/jssrc/blerg/Blerg.js
@@ -36,10 +36,10 @@ enyo.kind({
 
         document.body.addEventListener('keyup', function(event) {
             if (event.shiftKey && event.keyCode == 32) {
-                this.$.post.show();
+                this.waterfall('onPostVisibility', {showing: true});
                 event.stopPropagation();
             }
-        }, false);
+        }.bind(this), false);
     },
     hashCheck: function() {
         if (location.hash != this.lastHash) {

diff --git a/www/jssrc/blerg/Controls.js b/www/jssrc/blerg/Controls.js
line changes: +3/-3
index daf06bd..8c91c29
--- a/www/jssrc/blerg/Controls.js
+++ b/www/jssrc/blerg/Controls.js
@@ -17,13 +17,13 @@ enyo.kind({
             {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: [

diff --git a/www/jssrc/blerg/Post.js b/www/jssrc/blerg/Post.js
line changes: +18/-4
index a43abf8..112a497
--- a/www/jssrc/blerg/Post.js
+++ b/www/jssrc/blerg/Post.js
@@ -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();
     }
 });

diff --git a/www/jssrc/blerg/Title.js b/www/jssrc/blerg/Title.js
line changes: +1/-1
index 53c87f2..c701999
--- a/www/jssrc/blerg/Title.js
+++ b/www/jssrc/blerg/Title.js
@@ -11,7 +11,7 @@ enyo.kind({
     components: [
         {kind: "Image", classes: "logo", src: "images/blerglogo.png", attributes: {width: 125, height: 122}},
         {tag: "h1", components: [
-            {kind: "blerg.Link", href: "#/", content: "Blërg!"}
+            {kind: "blerg.Link", href: "/#/", content: "Blërg!"}
         ]},
         {tag: "h2", components: [
             {name: "section", tag: "span"}