Add post formatting help
[blerg.git] / www / jssrc / blerg / Post.js
index 0c72a99..79ab126 100644 (file)
@@ -9,7 +9,12 @@ enyo.kind({
     },
     resizePostContentTimeout: null,
     components: [
-        {tag: "h2", content: "What's on your mind?"},
+        {name: "helpContent", allowHtml: true, showing: false},
+        {style: "position: relative", components: [
+            {tag: "h2", content: "What's on your mind?", style: "width: 75%",},
+            {name: "showHelpLink", kind: "blerg.Link", onNavigate: "showHelp", content: "Help!", style: "position: absolute; right: 1pt; bottom: 1pt; font-weight: bold; font-size: large"},
+            {name: "hideHelpLink", kind: "blerg.Link", onNavigate: "hideHelp", content: "Hide Help", style: "position: absolute; right: 1pt; bottom: 1pt; font-weight: bold; font-size: large", showing: false}
+        ]},
         {kind: "onyx.InputDecorator", components: [
             {name: "postContent", classes: "content", kind: "onyx.TextArea", onkeydown: "resizePostContent", attributes: {tabindex: 4}}
         ]},
@@ -88,5 +93,25 @@ enyo.kind({
     loggedOut: function() {
         this.$.postButton.setDisabled(true);
         this.$.loginReminder.show();
+    },
+    showHelp: function() {
+        this.$.helpContent.show();
+        this.$.showHelpLink.hide();
+        this.$.hideHelpLink.show();
+        if (this.$.helpContent.getContent() == '') {
+            var req = new enyo.Ajax({
+                url: baseURL + '/doc/post_help.html',
+                handleAs: 'text'
+            });
+            req.response(function(inSender, inResponse) {
+                this.$.helpContent.setContent(inResponse);
+            }.bind(this));
+            req.go();
+        }
+    },
+    hideHelp: function() {
+        this.$.helpContent.hide();
+        this.$.showHelpLink.show();
+        this.$.hideHelpLink.hide();
     }
 });