mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-06 01:19:24 +01:00
Conpherence - move crumb-based room edit to widget; other cleanup
Summary: We use a non-standard way to invoke the edit dialogue (title, picture, etc) via the crumb. Stop doing that and instead use the widget technology to invoke the dialogue. This requires making the widget handling code a bit more nuanced as nothing has wanted to pop a dialogue before. I plan to clean this up as I add the action to "Mark as Favorite" to the UI. In particular, I want to stop rendering the un-used DOM and make a workflow-based widget action a property as opposed to something hardcoded. This may be too ambitious depending on how similar these workflows are.... This also updates the ThreadSearchEngine to be a bit more modern. Additionally, go through making some user-facing strings a bit more sensical. Test Plan: changed settings from conpherence full and durable column successfully. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D13449
This commit is contained in:
parent
14229042a2
commit
0094343556
7 changed files with 97 additions and 76 deletions
|
@ -342,7 +342,7 @@ return array(
|
|||
'rsrc/js/application/conpherence/behavior-menu.js' => 'd3782c93',
|
||||
'rsrc/js/application/conpherence/behavior-pontificate.js' => '21ba5861',
|
||||
'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3',
|
||||
'rsrc/js/application/conpherence/behavior-widget-pane.js' => 'cafc59ab',
|
||||
'rsrc/js/application/conpherence/behavior-widget-pane.js' => 'a8458711',
|
||||
'rsrc/js/application/countdown/timer.js' => 'e4cc26b3',
|
||||
'rsrc/js/application/daemon/behavior-bulk-job-reload.js' => 'edf8a145',
|
||||
'rsrc/js/application/dashboard/behavior-dashboard-async-panel.js' => '469c0d9e',
|
||||
|
@ -550,7 +550,7 @@ return array(
|
|||
'javelin-behavior-conpherence-drag-and-drop-photo' => 'cf86d16a',
|
||||
'javelin-behavior-conpherence-menu' => 'd3782c93',
|
||||
'javelin-behavior-conpherence-pontificate' => '21ba5861',
|
||||
'javelin-behavior-conpherence-widget-pane' => 'cafc59ab',
|
||||
'javelin-behavior-conpherence-widget-pane' => 'a8458711',
|
||||
'javelin-behavior-countdown-timer' => 'e4cc26b3',
|
||||
'javelin-behavior-dark-console' => 'f411b6ae',
|
||||
'javelin-behavior-dashboard-async-panel' => '469c0d9e',
|
||||
|
@ -1586,6 +1586,19 @@ return array(
|
|||
'javelin-stratcom',
|
||||
'javelin-dom',
|
||||
),
|
||||
'a8458711' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
'javelin-stratcom',
|
||||
'javelin-workflow',
|
||||
'javelin-util',
|
||||
'phabricator-notification',
|
||||
'javelin-behavior-device',
|
||||
'phuix-dropdown-menu',
|
||||
'phuix-action-list-view',
|
||||
'phuix-action-view',
|
||||
'conpherence-thread-manager',
|
||||
),
|
||||
'a8d8459d' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
|
@ -1755,19 +1768,6 @@ return array(
|
|||
'javelin-stratcom',
|
||||
'phabricator-phtize',
|
||||
),
|
||||
'cafc59ab' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
'javelin-stratcom',
|
||||
'javelin-workflow',
|
||||
'javelin-util',
|
||||
'phabricator-notification',
|
||||
'javelin-behavior-device',
|
||||
'phuix-dropdown-menu',
|
||||
'phuix-action-list-view',
|
||||
'phuix-action-view',
|
||||
'conpherence-thread-manager',
|
||||
),
|
||||
'ccf1cbf8' => array(
|
||||
'javelin-install',
|
||||
'javelin-dom',
|
||||
|
|
|
@ -48,11 +48,17 @@ final class ConpherenceWidgetConfigConstants extends ConpherenceConstants {
|
|||
),
|
||||
),
|
||||
'widgets-settings' => array(
|
||||
'name' => pht('Settings'),
|
||||
'name' => pht('Notifications'),
|
||||
'icon' => 'fa-wrench',
|
||||
'deviceOnly' => false,
|
||||
'hasCreate' => false,
|
||||
),
|
||||
'widgets-edit' => array(
|
||||
'name' => pht('Edit Room'),
|
||||
'icon' => 'fa-pencil',
|
||||
'deviceOnly' => false,
|
||||
'hasCreate' => false,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -84,8 +84,7 @@ abstract class ConpherenceController extends PhabricatorController {
|
|||
$crumbs->addCrumb(
|
||||
id(new PHUICrumbView())
|
||||
->setName($data['title'])
|
||||
->setHref($this->getApplicationURI('update/'.$conpherence->getID().'/'))
|
||||
->setWorkflow(true));
|
||||
->setHref('/'.$conpherence->getMonogram()));
|
||||
|
||||
return hsprintf(
|
||||
'%s',
|
||||
|
|
|
@ -114,6 +114,13 @@ final class ConpherenceWidgetController extends ConpherenceController {
|
|||
'style' => 'display: none',
|
||||
),
|
||||
$this->renderSettingsWidgetPaneContent());
|
||||
$widgets[] = phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'widgets-body',
|
||||
'id' => 'widgets-edit',
|
||||
'style' => 'display: none',
|
||||
));
|
||||
|
||||
// without this implosion we get "," between each element in our widgets
|
||||
// array
|
||||
|
@ -144,12 +151,15 @@ final class ConpherenceWidgetController extends ConpherenceController {
|
|||
$conpherence,
|
||||
PhabricatorPolicyCapability::CAN_JOIN);
|
||||
if ($can_join) {
|
||||
$text = pht('Settings are available after joining the room.');
|
||||
$text = pht(
|
||||
'Notification settings are available after joining the room.');
|
||||
} else if ($viewer->isLoggedIn()) {
|
||||
$text = pht('Settings not applicable to rooms you can not join.');
|
||||
$text = pht(
|
||||
'Notification settings not applicable to rooms you can not join.');
|
||||
} else {
|
||||
$text = pht(
|
||||
'Settings are available after logging in and joining the room.');
|
||||
'Notification settings are available after logging in and joining '.
|
||||
'the room.');
|
||||
}
|
||||
return phutil_tag(
|
||||
'div',
|
||||
|
|
|
@ -11,56 +11,46 @@ final class ConpherenceThreadSearchEngine
|
|||
return 'PhabricatorConpherenceApplication';
|
||||
}
|
||||
|
||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||
$saved = new PhabricatorSavedQuery();
|
||||
|
||||
$saved->setParameter(
|
||||
'participantPHIDs',
|
||||
$this->readUsersFromRequest($request, 'participants'));
|
||||
|
||||
$saved->setParameter('fulltext', $request->getStr('fulltext'));
|
||||
|
||||
return $saved;
|
||||
public function newQuery() {
|
||||
return id(new ConpherenceThreadQuery())
|
||||
->needParticipantCache(true);
|
||||
}
|
||||
|
||||
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
|
||||
$query = id(new ConpherenceThreadQuery())
|
||||
->needParticipantCache(true);
|
||||
protected function buildCustomSearchFields() {
|
||||
return array(
|
||||
id(new PhabricatorSearchUsersField())
|
||||
->setLabel(pht('Participants'))
|
||||
->setKey('participants')
|
||||
->setAliases(array('participant')),
|
||||
id(new PhabricatorSearchTextField())
|
||||
->setLabel(pht('Contains Words'))
|
||||
->setKey('fulltext'),
|
||||
);
|
||||
}
|
||||
|
||||
$participant_phids = $saved->getParameter('participantPHIDs', array());
|
||||
if ($participant_phids && is_array($participant_phids)) {
|
||||
$query->withParticipantPHIDs($participant_phids);
|
||||
protected function getDefaultFieldOrder() {
|
||||
return array(
|
||||
'participants',
|
||||
'...',
|
||||
);
|
||||
}
|
||||
|
||||
protected function shouldShowOrderField() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function buildQueryFromParameters(array $map) {
|
||||
$query = $this->newQuery();
|
||||
if ($map['participants']) {
|
||||
$query->withParticipantPHIDs($map['participants']);
|
||||
}
|
||||
|
||||
$fulltext = $saved->getParameter('fulltext');
|
||||
if (strlen($fulltext)) {
|
||||
$query->withFulltext($fulltext);
|
||||
if ($map['fulltext']) {
|
||||
$query->withFulltext($map['fulltext']);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function buildSearchForm(
|
||||
AphrontFormView $form,
|
||||
PhabricatorSavedQuery $saved) {
|
||||
|
||||
$participant_phids = $saved->getParameter('participantPHIDs', array());
|
||||
$fulltext = $saved->getParameter('fulltext');
|
||||
|
||||
$form
|
||||
->appendControl(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
->setDatasource(new PhabricatorPeopleDatasource())
|
||||
->setName('participants')
|
||||
->setLabel(pht('Participants'))
|
||||
->setValue($participant_phids))
|
||||
->appendControl(
|
||||
id(new AphrontFormTextControl())
|
||||
->setName('fulltext')
|
||||
->setLabel(pht('Contains Words'))
|
||||
->setValue($fulltext));
|
||||
}
|
||||
|
||||
protected function getURI($path) {
|
||||
return '/conpherence/search/'.$path;
|
||||
}
|
||||
|
@ -68,14 +58,12 @@ final class ConpherenceThreadSearchEngine
|
|||
protected function getBuiltinQueryNames() {
|
||||
$names = array();
|
||||
|
||||
$names = array(
|
||||
'all' => pht('All Rooms'),
|
||||
);
|
||||
|
||||
if ($this->requireViewer()->isLoggedIn()) {
|
||||
$names['participant'] = pht('Joined Rooms');
|
||||
}
|
||||
|
||||
$names['all'] = pht('All Rooms');
|
||||
|
||||
return $names;
|
||||
}
|
||||
|
||||
|
@ -89,7 +77,7 @@ final class ConpherenceThreadSearchEngine
|
|||
return $query;
|
||||
case 'participant':
|
||||
return $query->setParameter(
|
||||
'participantPHIDs',
|
||||
'participants',
|
||||
array($this->requireViewer()->getPHID()));
|
||||
}
|
||||
|
||||
|
|
|
@ -333,13 +333,13 @@ final class ConpherenceDurableColumnView extends AphrontTagView {
|
|||
));
|
||||
|
||||
$item = id(new PHUIListItemView())
|
||||
->setName(pht('Settings'))
|
||||
->setName(pht('Room Actions'))
|
||||
->setIcon('fa-bars')
|
||||
->addClass('core-menu-item')
|
||||
->addSigil('conpherence-settings-menu')
|
||||
->setID($bubble_id)
|
||||
->setHref('#')
|
||||
->setAural(pht('Settings'))
|
||||
->setAural(pht('Room Actions'))
|
||||
->setOrder(300);
|
||||
$settings_button = id(new PHUIListView())
|
||||
->addMenuItem($item)
|
||||
|
|
|
@ -81,16 +81,34 @@ JX.behavior('conpherence-widget-pane', function(config) {
|
|||
continue;
|
||||
}
|
||||
|
||||
var handler;
|
||||
var href;
|
||||
if (widget == 'widgets-edit') {
|
||||
var threadManager = JX.ConpherenceThreadManager.getInstance();
|
||||
handler = function(e) {
|
||||
e.prevent();
|
||||
menu.close();
|
||||
threadManager.runUpdateWorkflowFromLink(
|
||||
e.getTarget(),
|
||||
{
|
||||
action : 'metadata',
|
||||
force_ajax : true,
|
||||
stage : 'submit'
|
||||
});
|
||||
};
|
||||
href = threadManager._getUpdateURI();
|
||||
} else {
|
||||
handler = JX.bind(null, function(widget, e) {
|
||||
toggleWidget({widget: widget});
|
||||
e.prevent();
|
||||
menu.close();
|
||||
}, widget);
|
||||
}
|
||||
var item = new JX.PHUIXActionView()
|
||||
.setIcon(widget_data.icon || 'none')
|
||||
.setName(widget_data.name)
|
||||
.setHandler(
|
||||
JX.bind(null, function(widget, e) {
|
||||
toggleWidget({widget: widget});
|
||||
e.prevent();
|
||||
menu.close();
|
||||
}, widget));
|
||||
|
||||
.setHref(href)
|
||||
.setHandler(handler);
|
||||
map[widget_data.name] = item;
|
||||
list.addItem(item);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue