{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}}
- ]}
+ ]},
+ {name: "api", kind: "blerg.API",
+ onPostSuccessful: "postSuccessful",
+ onPostFailed: "postFailed"}
],
create: function() {
this.inherited(arguments);
this.bubble('onPostVisibility', {showing: false});
},
doPost: function() {
- this.bubble('onPost', {data: this.getData()});
+ this.$.api.post(this.getData());
+ },
+ postSuccessful: function() {
+ this.setData('');
+ this.closePost();
+ this.href = '#' + blerg.API.username;
+ },
+ postFailed: function() {
+ alert('Could not post!');
},
postVisibilityUpdate: function(inSender, inEvent) {
if (inEvent.showing) {