mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-25 15:00:58 +01:00
b873f3f991
Summary: it's ugly. but it works. basically. See T2399 for a roughly prioritized list of what still needs to happen. Test Plan: - created a conpherence with myself from my profile - created a conpherence with myself from "new conpherence" - created a conphernece with another from "new conpherence" - created a conpherence with several others - created a conpherence with files in the initial post - verified files via comment text ("{F232} is awesome!") and via traditional attach - edited a conpherence image - verified it showed up in the header and in the conpherence menu on the left - edited a conpherence title - verified it showed up in the header and in the conpherence menu on the right - verified each widget showed up when clicked and displayed the proper data - calendar being an exception since it sucks so hard right now. Reviewers: epriestley, chad Reviewed By: epriestley CC: aran, epriestley, chad, codeblock, Korvin Maniphest Tasks: T2301 Differential Revision: https://secure.phabricator.com/D4620
96 lines
2.5 KiB
JavaScript
96 lines
2.5 KiB
JavaScript
/**
|
|
* @provides javelin-behavior-conpherence-menu
|
|
* @requires javelin-behavior
|
|
* javelin-dom
|
|
* javelin-workflow
|
|
* javelin-util
|
|
* javelin-stratcom
|
|
* javelin-uri
|
|
*/
|
|
|
|
JX.behavior('conpherence-menu', function(config) {
|
|
|
|
function onresponse(context, response) {
|
|
var header = JX.$H(response.header);
|
|
var messages = JX.$H(response.messages);
|
|
var form = JX.$H(response.form);
|
|
var widgets = JX.$H(response.widgets);
|
|
var headerRoot = JX.$(config.header);
|
|
var messagesRoot = JX.$(config.messages);
|
|
var formRoot = JX.$(config.form_pane);
|
|
var widgetsRoot = JX.$(config.widgets_pane);
|
|
JX.DOM.setContent(headerRoot, header);
|
|
JX.DOM.setContent(messagesRoot, messages);
|
|
messagesRoot.scrollTop = messagesRoot.scrollHeight;
|
|
JX.DOM.setContent(formRoot, form);
|
|
JX.DOM.setContent(widgetsRoot, widgets);
|
|
|
|
for (var i = 0; i < context.parentNode.childNodes.length; i++) {
|
|
var current = context.parentNode.childNodes[i];
|
|
if (current.id == context.id) {
|
|
JX.DOM.alterClass(current, 'conpherence-selected', true);
|
|
JX.DOM.alterClass(current, 'hide-unread-count', true);
|
|
} else {
|
|
JX.DOM.alterClass(current, 'conpherence-selected', false);
|
|
}
|
|
}
|
|
|
|
// TODO - update the browser URI T2086
|
|
|
|
JX.Stratcom.invoke(
|
|
'conpherence-selected-loaded',
|
|
null,
|
|
{}
|
|
);
|
|
}
|
|
|
|
JX.Stratcom.listen(
|
|
'click',
|
|
'conpherence-menu-click',
|
|
function(e) {
|
|
e.kill();
|
|
var selected = e.getNode(['conpherence-menu-click']);
|
|
if (config.fancy_ajax) {
|
|
JX.Stratcom.invoke(
|
|
'conpherence-selected',
|
|
null,
|
|
{ selected : selected }
|
|
);
|
|
} else {
|
|
var data = JX.Stratcom.getData(selected);
|
|
var uri = new JX.URI(config.base_uri + data.id + '/');
|
|
uri.go();
|
|
}
|
|
}
|
|
);
|
|
|
|
JX.Stratcom.listen(
|
|
'conpherence-initial-selected',
|
|
null,
|
|
function(e) {
|
|
var selected = e.getData().selected;
|
|
e.kill();
|
|
JX.Stratcom.invoke(
|
|
'conpherence-selected',
|
|
null,
|
|
{ selected : selected }
|
|
);
|
|
}
|
|
);
|
|
|
|
JX.Stratcom.listen(
|
|
'conpherence-selected',
|
|
null,
|
|
function(e) {
|
|
|
|
var selected = e.getData().selected;
|
|
var data = JX.Stratcom.getData(selected);
|
|
|
|
var uri = config.base_uri + 'view/' + data.id + '/';
|
|
new JX.Workflow(uri, {})
|
|
.setHandler(JX.bind(null, onresponse, selected))
|
|
.start();
|
|
}
|
|
);
|
|
|
|
});
|