1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Conpherence - get the durable column header actions working correctly

Summary:
Ref T7014. This diff addresses

 - getting it to be the right set of options
   - add participant
   - view in conpherence
   - close window
 - making those options work
 - make it so if you are on /conpherence/ you can't toggle the durable column

Test Plan: inspected dom via chrome tools and found last transaction. added a participant and inspected the single new transactin added for accuracy. used view in conpherence action to view in conpherence. used close window action to close window

Reviewers: chad, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7014

Differential Revision: https://secure.phabricator.com/D11991
This commit is contained in:
Bob Trahan 2015-03-05 15:32:42 -08:00
parent 9564b0a40e
commit c97040de47
5 changed files with 120 additions and 70 deletions

View file

@ -8,7 +8,7 @@
return array(
'names' => array(
'core.pkg.css' => 'a9770fbb',
'core.pkg.js' => 'a77025a1',
'core.pkg.js' => '5a1c336d',
'darkconsole.pkg.js' => '8ab24e01',
'differential.pkg.css' => '6641cdd5',
'differential.pkg.js' => '3fab5259',
@ -346,12 +346,12 @@ return array(
'rsrc/image/texture/table_header_hover.png' => '038ec3b9',
'rsrc/image/texture/table_header_tall.png' => 'd56b434f',
'rsrc/js/application/aphlict/Aphlict.js' => '2be71d56',
'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => 'cc2d9c80',
'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => '830b3278',
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => '851f167c',
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761',
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
'rsrc/js/application/conpherence/behavior-durable-column.js' => 'a88a26cc',
'rsrc/js/application/conpherence/behavior-durable-column.js' => 'd32db212',
'rsrc/js/application/conpherence/behavior-menu.js' => '869e3445',
'rsrc/js/application/conpherence/behavior-pontificate.js' => '86df5915',
'rsrc/js/application/conpherence/behavior-widget-pane.js' => '40b1ff90',
@ -541,7 +541,7 @@ return array(
'inline-comment-summary-css' => 'eb5f8e8c',
'javelin-aphlict' => '2be71d56',
'javelin-behavior' => '61cbc29a',
'javelin-behavior-aphlict-dropdown' => 'cc2d9c80',
'javelin-behavior-aphlict-dropdown' => '830b3278',
'javelin-behavior-aphlict-listen' => '851f167c',
'javelin-behavior-aphlict-status' => 'ea681761',
'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884',
@ -582,7 +582,7 @@ return array(
'javelin-behavior-diffusion-locate-file' => '6d3e1947',
'javelin-behavior-diffusion-pull-lastmodified' => '2b228192',
'javelin-behavior-doorkeeper-tag' => 'e5822781',
'javelin-behavior-durable-column' => 'a88a26cc',
'javelin-behavior-durable-column' => 'd32db212',
'javelin-behavior-error-log' => '6882e80a',
'javelin-behavior-fancy-datepicker' => 'c51ae228',
'javelin-behavior-global-drag-and-drop' => '07f199d8',
@ -1400,6 +1400,16 @@ return array(
'82ce2142' => array(
'aphront-typeahead-control-css',
),
'830b3278' => array(
'javelin-behavior',
'javelin-request',
'javelin-stratcom',
'javelin-vector',
'javelin-dom',
'javelin-uri',
'javelin-behavior-device',
'phabricator-title',
),
'834a1173' => array(
'javelin-behavior',
'javelin-scrollbar',
@ -1609,15 +1619,6 @@ return array(
'javelin-stratcom',
'javelin-dom',
),
'a88a26cc' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'javelin-scrollbar',
'javelin-quicksand',
'phabricator-keyboard-shortcut',
'javelin-behavior-conpherence-widget-pane',
),
'a8d8459d' => array(
'javelin-behavior',
'javelin-dom',
@ -1743,16 +1744,6 @@ return array(
'javelin-stratcom',
'phabricator-phtize',
),
'cc2d9c80' => array(
'javelin-behavior',
'javelin-request',
'javelin-stratcom',
'javelin-vector',
'javelin-dom',
'javelin-uri',
'javelin-behavior-device',
'phabricator-title',
),
'd19198c8' => array(
'javelin-install',
'javelin-dom',
@ -1763,6 +1754,14 @@ return array(
'd254d646' => array(
'javelin-util',
),
'd32db212' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'javelin-scrollbar',
'javelin-quicksand',
'phabricator-keyboard-shortcut',
),
'd4a14807' => array(
'javelin-install',
'javelin-dom',

View file

@ -209,14 +209,19 @@ final class ConpherenceUpdateController
->setDatasource(new PhabricatorPeopleDatasource()));
require_celerity_resource('conpherence-update-css');
return id(new AphrontDialogView())
$view = id(new AphrontDialogView())
->setTitle(pht('Add Participants'))
->addHiddenInput('action', 'add_person')
->addHiddenInput(
'latest_transaction_id',
$request->getInt('latest_transaction_id'))
->appendChild($form);
if ($request->getExists('minimal_display')) {
$view->addHiddenInput('minimal_display', true);
}
return $view;
}
private function renderRemovePersonDialogue(
ConpherenceThread $conpherence) {

View file

@ -146,21 +146,17 @@ final class ConpherenceDurableColumnView extends AphrontTagView {
$dropdown_id = celerity_generate_unique_node_id();
$settings_list = new PHUIListView();
$cw_registry =
ConpherenceWidgetConfigConstants::getWidgetRegistry();
$first = true;
foreach ($cw_registry as $widget => $config) {
$header_actions = $this->getHeaderActionsConfig($conpherence);
foreach ($header_actions as $action) {
$settings_list->addMenuItem(
id(new PHUIListItemView())
->setHref('#')
->setDisabled($first)
->setName($config['name'])
->setIcon($config['icon'])
->addSigil('conpherence-durable-column-widget-selected')
->setHref($action['href'])
->setName($action['name'])
->setIcon($action['icon'])
->addSigil('conpherence-durable-column-header-action')
->setMetadata(array(
'widget' => $widget,
'action' => $action['key'],
)));
$first = false;
}
$settings_menu = phutil_tag(
@ -220,6 +216,28 @@ final class ConpherenceDurableColumnView extends AphrontTagView {
}
private function getHeaderActionsConfig(ConpherenceThread $conpherence) {
return array(
array(
'name' => pht('Add Participants'),
'href' => '/conpherence/update/'.$conpherence->getID().'/',
'icon' => 'fa-plus',
'key' => ConpherenceUpdateActions::ADD_PERSON,
),
array(
'name' => pht('View in Conpherence'),
'href' => '/conpherence/'.$conpherence->getID().'/',
'icon' => 'fa-comments',
'key' => 'go_conpherence',
),
array(
'name' => pht('Close Window'),
'href' => '#',
'icon' => 'fa-times',
'key' => 'close_window',
),);
}
private function buildTransactions() {
$conpherence = $this->getSelectedConpherence();
if (!$conpherence) {

View file

@ -170,4 +170,8 @@ JX.behavior('aphlict-dropdown', function(config, statics) {
dirty = true;
refresh();
});
JX.Stratcom.listen('notification-panel-close', null, function() {
set_visible(null);
});
});

View file

@ -6,7 +6,6 @@
* javelin-scrollbar
* javelin-quicksand
* phabricator-keyboard-shortcut
* javelin-behavior-conpherence-widget-pane
*/
JX.behavior('durable-column', function() {
@ -102,20 +101,25 @@ JX.behavior('durable-column', function() {
// end copy / hack of stuff with big ole TODO on it
function _toggleColumn() {
if (window.location.pathname.indexOf('/conpherence/') === 0) {
return;
}
show = !show;
JX.DOM.alterClass(frame, 'with-durable-column', show);
var column = JX.$('conpherence-durable-column');
if (show) {
JX.DOM.show(column);
loadThreadContent(loadThreadID);
} else {
JX.DOM.hide(column);
}
JX.Stratcom.invoke('resize');
JX.Quicksand.setFrame(show ? quick : null);
}
new JX.KeyboardShortcut('\\', 'Toggle Conpherence Column')
.setHandler(function() {
show = !show;
JX.DOM.alterClass(frame, 'with-durable-column', show);
var column = JX.$('conpherence-durable-column');
if (show) {
JX.DOM.show(column);
loadThreadContent(loadThreadID);
} else {
JX.DOM.hide(column);
}
JX.Stratcom.invoke('resize');
JX.Quicksand.setFrame(show ? quick : null);
})
.setHandler(_toggleColumn)
.register();
new JX.Scrollbar(JX.$('conpherence-durable-column-content'));
@ -124,29 +128,49 @@ JX.behavior('durable-column', function() {
JX.Stratcom.listen(
'click',
'conpherence-durable-column-widget-selected',
'conpherence-durable-column-header-action',
function (e) {
e.kill();
var data = e.getNodeData('conpherence-durable-column-widget-selected');
var widget = data.widget;
if (widget == 'conpherence-message-pane') {
return loadThreadContent(loadThreadID);
var data = e.getNodeData('conpherence-durable-column-header-action');
var action = data.action;
var link = e.getNode('tag:a');
switch (action) {
case 'add_person':
JX.Stratcom.invoke('notification-panel-close');
var params = {
action: action,
latest_transaction_id: latestTransactionID,
minimal_display: true
};
var workflow = new JX.Workflow.newFromLink(link)
.setData(params)
.setHandler(function(r) {
var messages = _getColumnMessagesNode();
JX.DOM.appendContent(messages, JX.$H(r.transactions));
messages.scrollTop = messages.scrollHeight;
latestTransactionID = r.latest_transaction_id;
// since this is a two step workflow, and the "finally" method
// gets called on the first form load, restore "updating" if
// necessary
if (updating === null) {
updating = {
threadPHID: loadedThreadPHID,
knownID: latestTransactionID
};
}
});
sync_workflow(workflow);
break;
case 'go_conpherence':
JX.$U(link.href).go();
break;
case 'close_window':
JX.Stratcom.invoke('notification-panel-close');
_toggleColumn();
break;
}
_markLoading(true);
var uri = '/conpherence/widget/' + loadThreadID + '/';
loadedThreadID = null;
var params = { widget : widget };
new JX.Workflow(uri)
.setData(params)
.setHandler(function(r) {
var body = _getColumnBodyNode();
JX.DOM.setContent(body, JX.$H(r));
new JX.Scrollbar(JX.$('conpherence-durable-column-content'));
_markLoading(false);
})
.start();
});
function _getColumnNode() {