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

Conpherence - add ability to change title in the durable column

Summary: Ref T7014.

Test Plan: changed the conpherence title from the column. since i can't get scrolling to work, i inspect the dom to verify the title change transaction showed up properly

Reviewers: epriestley, chad

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7014

Differential Revision: https://secure.phabricator.com/D12002
This commit is contained in:
Bob Trahan 2015-03-09 12:09:43 -07:00
parent 10a84d66db
commit 9b9a8001fa
7 changed files with 93 additions and 30 deletions

View file

@ -44,7 +44,7 @@ return array(
'rsrc/css/application/config/config-welcome.css' => '6abd79be', 'rsrc/css/application/config/config-welcome.css' => '6abd79be',
'rsrc/css/application/config/setup-issue.css' => '22270af2', 'rsrc/css/application/config/setup-issue.css' => '22270af2',
'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2', 'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2',
'rsrc/css/application/conpherence/durable-column.css' => '1ef6ae75', 'rsrc/css/application/conpherence/durable-column.css' => '9207426d',
'rsrc/css/application/conpherence/menu.css' => 'c6ac5299', 'rsrc/css/application/conpherence/menu.css' => 'c6ac5299',
'rsrc/css/application/conpherence/message-pane.css' => '5930260a', 'rsrc/css/application/conpherence/message-pane.css' => '5930260a',
'rsrc/css/application/conpherence/notification.css' => '04a6e10a', 'rsrc/css/application/conpherence/notification.css' => '04a6e10a',
@ -351,7 +351,7 @@ return array(
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761', 'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761',
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18', 'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de', 'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
'rsrc/js/application/conpherence/behavior-durable-column.js' => 'd32db212', 'rsrc/js/application/conpherence/behavior-durable-column.js' => 'e4affa94',
'rsrc/js/application/conpherence/behavior-menu.js' => '869e3445', 'rsrc/js/application/conpherence/behavior-menu.js' => '869e3445',
'rsrc/js/application/conpherence/behavior-pontificate.js' => '86df5915', 'rsrc/js/application/conpherence/behavior-pontificate.js' => '86df5915',
'rsrc/js/application/conpherence/behavior-widget-pane.js' => '40b1ff90', 'rsrc/js/application/conpherence/behavior-widget-pane.js' => '40b1ff90',
@ -512,7 +512,7 @@ return array(
'changeset-view-manager' => 'a9af1212', 'changeset-view-manager' => 'a9af1212',
'config-options-css' => '7fedf08b', 'config-options-css' => '7fedf08b',
'config-welcome-css' => '6abd79be', 'config-welcome-css' => '6abd79be',
'conpherence-durable-column-view' => '1ef6ae75', 'conpherence-durable-column-view' => '9207426d',
'conpherence-menu-css' => 'c6ac5299', 'conpherence-menu-css' => 'c6ac5299',
'conpherence-message-pane-css' => '5930260a', 'conpherence-message-pane-css' => '5930260a',
'conpherence-notification-css' => '04a6e10a', 'conpherence-notification-css' => '04a6e10a',
@ -582,7 +582,7 @@ return array(
'javelin-behavior-diffusion-locate-file' => '6d3e1947', 'javelin-behavior-diffusion-locate-file' => '6d3e1947',
'javelin-behavior-diffusion-pull-lastmodified' => '2b228192', 'javelin-behavior-diffusion-pull-lastmodified' => '2b228192',
'javelin-behavior-doorkeeper-tag' => 'e5822781', 'javelin-behavior-doorkeeper-tag' => 'e5822781',
'javelin-behavior-durable-column' => 'd32db212', 'javelin-behavior-durable-column' => 'e4affa94',
'javelin-behavior-error-log' => '6882e80a', 'javelin-behavior-error-log' => '6882e80a',
'javelin-behavior-fancy-datepicker' => 'c51ae228', 'javelin-behavior-fancy-datepicker' => 'c51ae228',
'javelin-behavior-global-drag-and-drop' => '07f199d8', 'javelin-behavior-global-drag-and-drop' => '07f199d8',
@ -1756,14 +1756,6 @@ return array(
'd254d646' => array( 'd254d646' => array(
'javelin-util', 'javelin-util',
), ),
'd32db212' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'javelin-scrollbar',
'javelin-quicksand',
'phabricator-keyboard-shortcut',
),
'd3aa4b40' => array( 'd3aa4b40' => array(
'javelin-dom', 'javelin-dom',
'javelin-util', 'javelin-util',
@ -1844,6 +1836,14 @@ return array(
'javelin-dom', 'javelin-dom',
'javelin-uri', 'javelin-uri',
), ),
'e4affa94' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
'javelin-scrollbar',
'javelin-quicksand',
'phabricator-keyboard-shortcut',
),
'e4cc26b3' => array( 'e4cc26b3' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-dom', 'javelin-dom',

View file

@ -62,11 +62,7 @@ abstract class ConpherenceController extends PhabricatorController {
protected function buildHeaderPaneContent(ConpherenceThread $conpherence) { protected function buildHeaderPaneContent(ConpherenceThread $conpherence) {
$crumbs = $this->buildApplicationCrumbs(); $crumbs = $this->buildApplicationCrumbs();
if ($conpherence->getTitle()) { $title = $this->getConpherenceTitle($conpherence);
$title = $conpherence->getTitle();
} else {
$title = pht('[No Title]');
}
$crumbs->addCrumb( $crumbs->addCrumb(
id(new PHUICrumbView()) id(new PHUICrumbView())
->setName($title) ->setName($title)
@ -85,4 +81,14 @@ abstract class ConpherenceController extends PhabricatorController {
$crumbs, $crumbs,
)); ));
} }
protected function getConpherenceTitle(ConpherenceThread $conpherence) {
if ($conpherence->getTitle()) {
$title = $conpherence->getTitle();
} else {
$title = pht('[No Title]');
}
return $title;
}
} }

View file

@ -108,7 +108,9 @@ final class ConpherenceUpdateController
->setTransactionType(ConpherenceTransactionType::TYPE_TITLE) ->setTransactionType(ConpherenceTransactionType::TYPE_TITLE)
->setNewValue($title); ->setNewValue($title);
$updated = true; $updated = true;
$response_mode = 'redirect'; if (!$request->getExists('force_ajax')) {
$response_mode = 'redirect';
}
} }
if (!$updated) { if (!$updated) {
$errors[] = pht( $errors[] = pht(
@ -271,7 +273,7 @@ final class ConpherenceUpdateController
->setValue($conpherence->getTitle())); ->setValue($conpherence->getTitle()));
require_celerity_resource('conpherence-update-css'); require_celerity_resource('conpherence-update-css');
return id(new AphrontDialogView()) $view = id(new AphrontDialogView())
->setTitle(pht('Update Conpherence')) ->setTitle(pht('Update Conpherence'))
->addHiddenInput('action', 'metadata') ->addHiddenInput('action', 'metadata')
->addHiddenInput( ->addHiddenInput(
@ -279,6 +281,15 @@ final class ConpherenceUpdateController
$request->getInt('latest_transaction_id')) $request->getInt('latest_transaction_id'))
->addHiddenInput('__continue__', true) ->addHiddenInput('__continue__', true)
->appendChild($form); ->appendChild($form);
if ($request->getExists('minimal_display')) {
$view->addHiddenInput('minimal_display', true);
}
if ($request->getExists('force_ajax')) {
$view->addHiddenInput('force_ajax', true);
}
return $view;
} }
private function loadAndRenderUpdates( private function loadAndRenderUpdates(
@ -361,8 +372,10 @@ final class ConpherenceUpdateController
if ($people_widget) { if ($people_widget) {
$people_html = hsprintf('%s', $people_widget->render()); $people_html = hsprintf('%s', $people_widget->render());
} }
$title = $this->getConpherenceTitle($conpherence);
$content = array( $content = array(
'transactions' => hsprintf('%s', $rendered_transactions), 'transactions' => hsprintf('%s', $rendered_transactions),
'conpherence_title' => (string) $title,
'latest_transaction_id' => $new_latest_transaction_id, 'latest_transaction_id' => $new_latest_transaction_id,
'nav_item' => hsprintf('%s', $nav_item), 'nav_item' => hsprintf('%s', $nav_item),
'conpherence_phid' => $conpherence->getPHID(), 'conpherence_phid' => $conpherence->getPHID(),

View file

@ -54,10 +54,7 @@ final class ConpherenceViewController extends
); );
} }
$title = $conpherence->getTitle(); $title = $this->getConpherenceTitle($conpherence);
if (!$title) {
$title = pht('[No Title]');
}
$content['title'] = $title; $content['title'] = $title;
if ($request->isAjax()) { if ($request->isAjax()) {

View file

@ -205,9 +205,10 @@ final class ConpherenceDurableColumnView extends AphrontTagView {
'class' => 'conpherence-durable-column-header', 'class' => 'conpherence-durable-column-header',
), ),
array( array(
phutil_tag( javelin_tag(
'div', 'div',
array( array(
'sigil' => 'conpherence-durable-column-header-text',
'class' => 'conpherence-durable-column-header-text', 'class' => 'conpherence-durable-column-header-text',
), ),
$title), $title),
@ -224,6 +225,12 @@ final class ConpherenceDurableColumnView extends AphrontTagView {
'icon' => 'fa-plus', 'icon' => 'fa-plus',
'key' => ConpherenceUpdateActions::ADD_PERSON, 'key' => ConpherenceUpdateActions::ADD_PERSON,
), ),
array(
'name' => pht('Rename Thread'),
'href' => '/conpherence/update/'.$conpherence->getID().'/',
'icon' => 'fa-pencil',
'key' => ConpherenceUpdateActions::METADATA,
),
array( array(
'name' => pht('View in Conpherence'), 'name' => pht('View in Conpherence'),
'href' => '/conpherence/'.$conpherence->getID().'/', 'href' => '/conpherence/'.$conpherence->getID().'/',

View file

@ -50,6 +50,7 @@
.conpherence-durable-column-header-text:hover { .conpherence-durable-column-header-text:hover {
color: #fff; color: #fff;
text-decoration: none;
} }
.conpherence-durable-column-icon-bar { .conpherence-durable-column-icon-bar {

View file

@ -90,7 +90,7 @@ JX.behavior('durable-column', function() {
knownID: latestTransactionID knownID: latestTransactionID
}; };
workflow.listen('finally', function() { workflow.listen('finally', function() {
var need_sync = (updating.knownID > latestTransactionID); var need_sync = (updating && updating.knownID > latestTransactionID);
updating = null; updating = null;
if (need_sync) { if (need_sync) {
update_thread(); update_thread();
@ -134,11 +134,43 @@ JX.behavior('durable-column', function() {
var data = e.getNodeData('conpherence-durable-column-header-action'); var data = e.getNodeData('conpherence-durable-column-header-action');
var action = data.action; var action = data.action;
var link = e.getNode('tag:a'); var link = e.getNode('tag:a');
var params = null;
switch (action) { switch (action) {
case 'metadata':
JX.Stratcom.invoke('notification-panel-close');
params = {
action: action,
latest_transaction_id: latestTransactionID,
minimal_display: true,
force_ajax: 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;
var title = _getColumnTitleNode();
JX.DOM.setContent(title, r.conpherence_title);
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 'add_person': case 'add_person':
JX.Stratcom.invoke('notification-panel-close'); JX.Stratcom.invoke('notification-panel-close');
var params = { params = {
action: action, action: action,
latest_transaction_id: latestTransactionID, latest_transaction_id: latestTransactionID,
minimal_display: true minimal_display: true
@ -193,6 +225,14 @@ JX.behavior('durable-column', function() {
'conpherence-durable-column-transactions'); 'conpherence-durable-column-transactions');
} }
function _getColumnTitleNode() {
var column = JX.$('conpherence-durable-column');
return JX.DOM.find(
column,
'div',
'conpherence-durable-column-header-text');
}
function _getColumnFormNode() { function _getColumnFormNode() {
var column = JX.$('conpherence-durable-column'); var column = JX.$('conpherence-durable-column');
return JX.DOM.find( return JX.DOM.find(
@ -231,7 +271,6 @@ JX.behavior('durable-column', function() {
// We can pick a thread from the server the first time // We can pick a thread from the server the first time
if (shouldInit) { if (shouldInit) {
shouldInit = false; shouldInit = false;
params = { shouldInit : true };
} else { } else {
params = { id : thread_id }; params = { id : thread_id };
} }
@ -282,9 +321,9 @@ JX.behavior('durable-column', function() {
} }
JX.Stratcom.listen( JX.Stratcom.listen(
'click', 'click',
'conpherence-send-message', 'conpherence-send-message',
_sendMessage); _sendMessage);
JX.Stratcom.listen( JX.Stratcom.listen(
['submit', 'didSyntheticSubmit'], ['submit', 'didSyntheticSubmit'],