Add reply functionality to new post widget
{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"}
]}
]},
]},
]},
{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},
]},
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();
}
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;
}