1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-30 10:42:41 +01:00
phorge-phorge/webroot/rsrc/js/application/conpherence/behavior-pontificate.js
Bob Trahan 8fc94b02a9 Fix Conpherence
Summary: D5426 removed mobile menu for messages but missed a few spots

Test Plan: successfully submitted pontifications without JS errors and the form freezing

Reviewers: chad, epriestley

Reviewed By: chad

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5453
2013-03-26 14:06:19 -07:00

56 lines
1.3 KiB
JavaScript

/**
* @provides javelin-behavior-conpherence-pontificate
* @requires javelin-behavior
* javelin-dom
* javelin-util
* javelin-workflow
*/
JX.behavior('conpherence-pontificate', function(config) {
var root = JX.$(config.form_pane);
var onsubmit = function(e) {
e.kill();
var form = JX.DOM.find(root, 'form');
JX.Workflow.newFromForm(form)
.setHandler(JX.bind(this, function(r) {
// add the new transactions, probably just our post but who knows
var messages = JX.$(config.messages);
JX.DOM.appendContent(messages, JX.$H(r.transactions));
messages.scrollTop = messages.scrollHeight;
// update the menu entry as well
JX.DOM.replace(
JX.$(r.conpherence_phid + '-nav-item'),
JX.$H(r.nav_item)
);
// update the header
JX.DOM.setContent(
JX.$(config.header),
JX.$H(r.header)
);
// update the file widget
JX.DOM.setContent(
JX.$(config.file_widget),
JX.$H(r.file_widget)
);
// clear the textarea
var textarea = JX.DOM.find(form, 'textarea');
textarea.value = '';
}))
.start();
};
JX.DOM.listen(
root,
['click'],
'conpherence-pontificate',
onsubmit
);
});