mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 14:30:56 +01:00
d0b9b6c908
Summary: this diff tries to polish the poo out of the JS layer while achieving fixes T3157 accolades. Test Plan: introduced sleeps in the various controllers and clicked about. verified good "loading" UI in the menu / message / widget section as appropros. Loaded up in device size and resize and desktop sized and resized and all was good. Reviewers: epriestley Reviewed By: epriestley CC: chad, aran, Korvin Maniphest Tasks: T3164, T3157 Differential Revision: https://secure.phabricator.com/D6069
72 lines
2.1 KiB
JavaScript
72 lines
2.1 KiB
JavaScript
/**
|
|
* @provides javelin-behavior-conpherence-pontificate
|
|
* @requires javelin-behavior
|
|
* javelin-dom
|
|
* javelin-util
|
|
* javelin-workflow
|
|
* javelin-stratcom
|
|
*/
|
|
|
|
JX.behavior('conpherence-pontificate', function(config) {
|
|
var onsubmit = function(e) {
|
|
e.kill();
|
|
|
|
var form = e.getNode('tag:form');
|
|
|
|
var root = e.getNode('conpherence-layout');
|
|
var messages_root = JX.DOM.find(root, 'div', 'conpherence-message-pane');
|
|
var header_root = JX.DOM.find(root, 'div', 'conpherence-header-pane');
|
|
var form_root = JX.DOM.find(root, 'div', 'conpherence-form');
|
|
var messages = JX.DOM.find(messages_root, 'div', 'conpherence-messages');
|
|
var fileWidget = null;
|
|
try {
|
|
fileWidget = JX.DOM.find(root, 'div', 'widgets-files');
|
|
} catch (ex) {
|
|
// Ignore; maybe no files widget
|
|
}
|
|
JX.DOM.alterClass(header_root, 'loading', true);
|
|
JX.DOM.alterClass(messages_root, 'loading', true);
|
|
JX.DOM.alterClass(form_root, 'loading', true);
|
|
|
|
JX.Workflow.newFromForm(form)
|
|
.setHandler(JX.bind(this, function(r) {
|
|
JX.DOM.appendContent(messages, JX.$H(r.transactions));
|
|
messages.scrollTop = messages.scrollHeight;
|
|
|
|
if (fileWidget) {
|
|
JX.DOM.setContent(
|
|
fileWidget,
|
|
JX.$H(r.file_widget)
|
|
);
|
|
}
|
|
|
|
var inputs = JX.DOM.scry(form, 'input');
|
|
for (var ii = 0; ii < inputs.length; ii++) {
|
|
if (inputs[ii].name == 'latest_transaction_id') {
|
|
inputs[ii].value = r.latest_transaction_id;
|
|
break;
|
|
}
|
|
}
|
|
|
|
var textarea = JX.DOM.find(form, 'textarea');
|
|
textarea.value = '';
|
|
|
|
JX.Stratcom.invoke(
|
|
'conpherence-selectthread',
|
|
null,
|
|
{ id : r.conpherence_phid + '-nav-item' }
|
|
);
|
|
|
|
JX.DOM.alterClass(header_root, 'loading', false);
|
|
JX.DOM.alterClass(messages_root, 'loading', false);
|
|
JX.DOM.alterClass(form_root, 'loading', false);
|
|
}))
|
|
.start();
|
|
};
|
|
|
|
JX.Stratcom.listen(
|
|
['submit', 'didSyntheticSubmit'],
|
|
'conpherence-pontificate',
|
|
onsubmit);
|
|
|
|
});
|