commit:4143be3ff9d5da0f8cbcec88360194612fc00dda
author:Chip Black
committer:Chip Black
date:Mon Mar 17 02:14:59 2014 -0500
parents:aaf68d34233c00efc95426cdf35f6cb088f24d20
Add reply functionality to new post widget
diff --git a/www/jssrc/blerg/Post.js b/www/jssrc/blerg/Post.js
line changes: +20/-6
index 2aa7c3a..064db00
--- a/www/jssrc/blerg/Post.js
+++ b/www/jssrc/blerg/Post.js
@@ -15,8 +15,8 @@ enyo.kind({
         {name: "toolbar", kind: "FittableColumns", classes: "toolbar", components: [
             {classes: "switcher", components: [
                 {kind: "onyx.RadioGroup", onActivate: "switchBottomPanel", components: [
-                    {content: "Replying to"},
-                    {content: "Preview"},
+                    {name: "replyButton", content: "Replying to", showing: false},
+                    {name: "previewButton", content: "Preview"},
                     {content: "Help"}
                 ]}
             ]},
@@ -27,7 +27,9 @@ enyo.kind({
             ]},
         ]},
         {name: "bottomPanel", kind: "Panels", classes: "bottom-panel", draggable: false, fit: true, components: [
-            {content: "In reply to:"},
+            {kind: "Scroller", components: [
+                {name: "replyView", classes: "record", allowHtml: true},
+            ]},
             {kind: "Scroller", components: [
                 {name: "preview", classes: "record", allowHtml: true},
             ]},
@@ -70,14 +72,26 @@ enyo.kind({
     postVisibilityUpdate: function(inSender, inEvent) {
         if (inEvent.showing) {
             this.show();
-            // Need to reflow manually because this is hidden by default
-            this.$.toolbar.reflow();
-            this.reflow();
             this.$.postContent.focus();
+
             if (inEvent.data && this.getData() == "") {
                 this.setData(inEvent.data);
                 this.$.postContent.node.setSelectionRange(inEvent.data.length, inEvent.data.length);
+                this.updatePreview();
             }
+
+            if (inEvent.replyto) {
+                this.$.replyButton.show();
+                this.$.replyButton.setActive(true);
+                this.$.replyView.setContent(inEvent.replyto);
+            } else {
+                this.$.replyButton.hide();
+                this.$.previewButton.setActive(true);
+            }
+
+            // Need to reflow manually because this is hidden by default
+            this.$.toolbar.reflow();
+            this.reflow();
         } else {
             this.hide();
         }

diff --git a/www/jssrc/blerg/Record.js b/www/jssrc/blerg/Record.js
line changes: +2/-1
index 64c8070..2dc5739
--- a/www/jssrc/blerg/Record.js
+++ b/www/jssrc/blerg/Record.js
@@ -43,7 +43,8 @@ enyo.kind({
     postPopup: function() {
         this.bubble('onPostVisibility', {
             showing: true,
-            data: enyo.macroize("@{$author}/{$record}: ", this)
+            data: enyo.macroize("@{$author}/{$record}: ", this),
+            replyto: this.$.data.getContent()
         });
         return true;
     }