mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-13 16:21:07 +01:00
Increase the click target area for the object selector
Summary: Make clicking the link also select the object (this operation is very common). Add an arrow to the left to view the object (this operation is very rare). Increase link target area to the entire cell. Also simplify some handlers. Test Plan: Clicked things with wild abandon. Behavior seemed unchanged. Reviewers: cpiro, btrahan Reviewed By: cpiro CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D1962
This commit is contained in:
parent
0f45e85ce5
commit
1fc4dea55e
3 changed files with 82 additions and 77 deletions
|
@ -441,7 +441,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'javelin-behavior-burn-chart' =>
|
||||
array(
|
||||
'uri' => '/res/053cffd4/rsrc/js/application/maniphest/behavior-burn-chart.js',
|
||||
'uri' => '/res/0bc23e4d/rsrc/js/application/maniphest/behavior-burn-chart.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -828,7 +828,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'javelin-behavior-phabricator-object-selector' =>
|
||||
array(
|
||||
'uri' => '/res/73f3fbcf/rsrc/js/application/core/behavior-object-selector.js',
|
||||
'uri' => '/res/b711be4b/rsrc/js/application/core/behavior-object-selector.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -836,7 +836,6 @@ celerity_register_resource_map(array(
|
|||
1 => 'javelin-dom',
|
||||
2 => 'javelin-request',
|
||||
3 => 'javelin-util',
|
||||
4 => 'javelin-stratcom',
|
||||
),
|
||||
'disk' => '/rsrc/js/application/core/behavior-object-selector.js',
|
||||
),
|
||||
|
@ -1617,7 +1616,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'phabricator-object-selector-css' =>
|
||||
array(
|
||||
'uri' => '/res/608461d2/rsrc/css/application/objectselector/object-selector.css',
|
||||
'uri' => '/res/7eb4c705/rsrc/css/application/objectselector/object-selector.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
|
@ -2004,7 +2003,7 @@ celerity_register_resource_map(array(
|
|||
'uri' => '/res/pkg/21d01ed8/core.pkg.js',
|
||||
'type' => 'js',
|
||||
),
|
||||
'1cb6883c' =>
|
||||
'1fd457be' =>
|
||||
array(
|
||||
'name' => 'differential.pkg.css',
|
||||
'symbols' =>
|
||||
|
@ -2022,10 +2021,10 @@ celerity_register_resource_map(array(
|
|||
10 => 'phabricator-content-source-view-css',
|
||||
11 => 'differential-local-commits-view-css',
|
||||
),
|
||||
'uri' => '/res/pkg/1cb6883c/differential.pkg.css',
|
||||
'uri' => '/res/pkg/1fd457be/differential.pkg.css',
|
||||
'type' => 'css',
|
||||
),
|
||||
'c42635d2' =>
|
||||
'0d08d81b' =>
|
||||
array(
|
||||
'name' => 'differential.pkg.js',
|
||||
'symbols' =>
|
||||
|
@ -2048,7 +2047,7 @@ celerity_register_resource_map(array(
|
|||
15 => 'javelin-behavior-differential-dropdown-menus',
|
||||
16 => 'javelin-behavior-buoyant',
|
||||
),
|
||||
'uri' => '/res/pkg/c42635d2/differential.pkg.js',
|
||||
'uri' => '/res/pkg/0d08d81b/differential.pkg.js',
|
||||
'type' => 'js',
|
||||
),
|
||||
'61f9d480' =>
|
||||
|
@ -2129,7 +2128,7 @@ celerity_register_resource_map(array(
|
|||
'aphront-crumbs-view-css' => '78e8854e',
|
||||
'aphront-dialog-view-css' => '78e8854e',
|
||||
'aphront-form-view-css' => '78e8854e',
|
||||
'aphront-headsup-action-list-view-css' => '1cb6883c',
|
||||
'aphront-headsup-action-list-view-css' => '1fd457be',
|
||||
'aphront-list-filter-view-css' => '78e8854e',
|
||||
'aphront-pager-view-css' => '78e8854e',
|
||||
'aphront-panel-view-css' => '78e8854e',
|
||||
|
@ -2137,40 +2136,40 @@ celerity_register_resource_map(array(
|
|||
'aphront-table-view-css' => '78e8854e',
|
||||
'aphront-tokenizer-control-css' => '78e8854e',
|
||||
'aphront-typeahead-control-css' => '78e8854e',
|
||||
'differential-changeset-view-css' => '1cb6883c',
|
||||
'differential-core-view-css' => '1cb6883c',
|
||||
'differential-inline-comment-editor' => 'c42635d2',
|
||||
'differential-local-commits-view-css' => '1cb6883c',
|
||||
'differential-revision-add-comment-css' => '1cb6883c',
|
||||
'differential-revision-comment-css' => '1cb6883c',
|
||||
'differential-revision-comment-list-css' => '1cb6883c',
|
||||
'differential-revision-detail-css' => '1cb6883c',
|
||||
'differential-revision-history-css' => '1cb6883c',
|
||||
'differential-table-of-contents-css' => '1cb6883c',
|
||||
'differential-changeset-view-css' => '1fd457be',
|
||||
'differential-core-view-css' => '1fd457be',
|
||||
'differential-inline-comment-editor' => '0d08d81b',
|
||||
'differential-local-commits-view-css' => '1fd457be',
|
||||
'differential-revision-add-comment-css' => '1fd457be',
|
||||
'differential-revision-comment-css' => '1fd457be',
|
||||
'differential-revision-comment-list-css' => '1fd457be',
|
||||
'differential-revision-detail-css' => '1fd457be',
|
||||
'differential-revision-history-css' => '1fd457be',
|
||||
'differential-table-of-contents-css' => '1fd457be',
|
||||
'diffusion-commit-view-css' => '61f9d480',
|
||||
'javelin-behavior' => '4fbae2af',
|
||||
'javelin-behavior-aphront-basic-tokenizer' => '2af849fb',
|
||||
'javelin-behavior-aphront-drag-and-drop' => 'c42635d2',
|
||||
'javelin-behavior-aphront-drag-and-drop-textarea' => 'c42635d2',
|
||||
'javelin-behavior-aphront-drag-and-drop' => '0d08d81b',
|
||||
'javelin-behavior-aphront-drag-and-drop-textarea' => '0d08d81b',
|
||||
'javelin-behavior-aphront-form-disable-on-submit' => '21d01ed8',
|
||||
'javelin-behavior-buoyant' => 'c42635d2',
|
||||
'javelin-behavior-differential-accept-with-errors' => 'c42635d2',
|
||||
'javelin-behavior-differential-add-reviewers-and-ccs' => 'c42635d2',
|
||||
'javelin-behavior-differential-comment-jump' => 'c42635d2',
|
||||
'javelin-behavior-differential-diff-radios' => 'c42635d2',
|
||||
'javelin-behavior-differential-dropdown-menus' => 'c42635d2',
|
||||
'javelin-behavior-differential-edit-inline-comments' => 'c42635d2',
|
||||
'javelin-behavior-differential-feedback-preview' => 'c42635d2',
|
||||
'javelin-behavior-differential-keyboard-navigation' => 'c42635d2',
|
||||
'javelin-behavior-differential-populate' => 'c42635d2',
|
||||
'javelin-behavior-differential-show-more' => 'c42635d2',
|
||||
'javelin-behavior-buoyant' => '0d08d81b',
|
||||
'javelin-behavior-differential-accept-with-errors' => '0d08d81b',
|
||||
'javelin-behavior-differential-add-reviewers-and-ccs' => '0d08d81b',
|
||||
'javelin-behavior-differential-comment-jump' => '0d08d81b',
|
||||
'javelin-behavior-differential-diff-radios' => '0d08d81b',
|
||||
'javelin-behavior-differential-dropdown-menus' => '0d08d81b',
|
||||
'javelin-behavior-differential-edit-inline-comments' => '0d08d81b',
|
||||
'javelin-behavior-differential-feedback-preview' => '0d08d81b',
|
||||
'javelin-behavior-differential-keyboard-navigation' => '0d08d81b',
|
||||
'javelin-behavior-differential-populate' => '0d08d81b',
|
||||
'javelin-behavior-differential-show-more' => '0d08d81b',
|
||||
'javelin-behavior-maniphest-batch-selector' => '86fc0b0c',
|
||||
'javelin-behavior-maniphest-transaction-controls' => '86fc0b0c',
|
||||
'javelin-behavior-maniphest-transaction-expand' => '86fc0b0c',
|
||||
'javelin-behavior-maniphest-transaction-preview' => '86fc0b0c',
|
||||
'javelin-behavior-phabricator-autofocus' => '21d01ed8',
|
||||
'javelin-behavior-phabricator-keyboard-shortcuts' => '21d01ed8',
|
||||
'javelin-behavior-phabricator-object-selector' => 'c42635d2',
|
||||
'javelin-behavior-phabricator-object-selector' => '0d08d81b',
|
||||
'javelin-behavior-phabricator-watch-anchor' => '21d01ed8',
|
||||
'javelin-behavior-refresh-csrf' => '21d01ed8',
|
||||
'javelin-behavior-workflow' => '21d01ed8',
|
||||
|
@ -2195,20 +2194,20 @@ celerity_register_resource_map(array(
|
|||
'maniphest-task-summary-css' => '31583232',
|
||||
'maniphest-transaction-detail-css' => '31583232',
|
||||
'phabricator-app-buttons-css' => '78e8854e',
|
||||
'phabricator-content-source-view-css' => '1cb6883c',
|
||||
'phabricator-content-source-view-css' => '1fd457be',
|
||||
'phabricator-core-buttons-css' => '78e8854e',
|
||||
'phabricator-core-css' => '78e8854e',
|
||||
'phabricator-directory-css' => '78e8854e',
|
||||
'phabricator-drag-and-drop-file-upload' => 'c42635d2',
|
||||
'phabricator-drag-and-drop-file-upload' => '0d08d81b',
|
||||
'phabricator-dropdown-menu' => '21d01ed8',
|
||||
'phabricator-jump-nav' => '78e8854e',
|
||||
'phabricator-keyboard-shortcut' => '21d01ed8',
|
||||
'phabricator-keyboard-shortcut-manager' => '21d01ed8',
|
||||
'phabricator-menu-item' => '21d01ed8',
|
||||
'phabricator-object-selector-css' => '1cb6883c',
|
||||
'phabricator-object-selector-css' => '1fd457be',
|
||||
'phabricator-paste-file-upload' => '21d01ed8',
|
||||
'phabricator-remarkup-css' => '78e8854e',
|
||||
'phabricator-shaped-request' => 'c42635d2',
|
||||
'phabricator-shaped-request' => '0d08d81b',
|
||||
'phabricator-standard-page-view' => '78e8854e',
|
||||
'phabricator-transaction-view-css' => '78e8854e',
|
||||
'syntax-highlighting-css' => '78e8854e',
|
||||
|
|
|
@ -48,13 +48,17 @@ td.phabricator-object-selector-search-text {
|
|||
}
|
||||
|
||||
.phabricator-object-selector-handle th {
|
||||
padding: 4px 1em;
|
||||
font-weight: bold;
|
||||
vertical-align: middle;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.phabricator-object-selector-handle th a {
|
||||
display: block;
|
||||
padding: 4px 1em;
|
||||
}
|
||||
|
||||
.phabricator-object-selector-header {
|
||||
padding: 2px;
|
||||
border-bottom: 1px solid #d0d0d0;
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* javelin-dom
|
||||
* javelin-request
|
||||
* javelin-util
|
||||
* javelin-stratcom
|
||||
*/
|
||||
|
||||
JX.behavior('phabricator-object-selector', function(config) {
|
||||
|
@ -15,7 +14,7 @@ JX.behavior('phabricator-object-selector', function(config) {
|
|||
for (var k in handles) {
|
||||
phids[k] = true;
|
||||
}
|
||||
var attach_list = {};
|
||||
var button_list = {};
|
||||
var query_timer = null;
|
||||
var query_delay = 50;
|
||||
|
||||
|
@ -32,7 +31,7 @@ JX.behavior('phabricator-object-selector', function(config) {
|
|||
}
|
||||
|
||||
var display = [];
|
||||
attach_list = {};
|
||||
button_list = {};
|
||||
for (var k in r) {
|
||||
handles[r[k].phid] = r[k];
|
||||
display.push(renderHandle(r[k], true));
|
||||
|
@ -62,38 +61,45 @@ JX.behavior('phabricator-object-selector', function(config) {
|
|||
|
||||
function renderHandle(h, attach) {
|
||||
|
||||
var link = JX.$N(
|
||||
var view_object_link = JX.$N(
|
||||
'a',
|
||||
{href : h.uri, target : '_blank'},
|
||||
{href: h.uri, target: '_blank'},
|
||||
"\u2197");
|
||||
|
||||
var select_object_link = JX.$N(
|
||||
'a',
|
||||
{href: '#', sigil: 'object-attacher'},
|
||||
h.name);
|
||||
|
||||
var td = JX.$N('td');
|
||||
var select_object_button = JX.$N(
|
||||
'a',
|
||||
{href: '#', sigil: 'object-attacher', className: 'button small grey'},
|
||||
attach ? 'Select' : 'Remove');
|
||||
|
||||
var cells = [
|
||||
JX.$N('td', {}, view_object_link),
|
||||
JX.$N('th', {}, select_object_link),
|
||||
JX.$N('td', {}, select_object_button),
|
||||
];
|
||||
|
||||
var table = JX.$N(
|
||||
'table',
|
||||
{className: 'phabricator-object-selector-handle'},
|
||||
{className: 'phabricator-object-selector-handle'});
|
||||
|
||||
table.appendChild(
|
||||
JX.$N(
|
||||
'tr',
|
||||
{},
|
||||
[JX.$N('th', {}, link), td]));
|
||||
{sigil: 'object-attach-row', meta: {handle: h, table:table}},
|
||||
cells));
|
||||
|
||||
var btn = JX.$N(
|
||||
'a',
|
||||
{className: 'button small grey'},
|
||||
attach ? 'Select' : 'Remove');
|
||||
|
||||
JX.Stratcom.addSigil(btn, 'object-attach-button');
|
||||
JX.Stratcom.addData(btn, {handle : h, table : table});
|
||||
if (attach) {
|
||||
attach_list[h.phid] = btn;
|
||||
button_list[h.phid] = select_object_button;
|
||||
if (h.phid in phids) {
|
||||
JX.DOM.alterClass(btn, 'disabled', true);
|
||||
btn.disabled = true;
|
||||
JX.DOM.alterClass(select_object_button, 'disabled', true);
|
||||
select_object_button.disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
JX.DOM.setContent(td, btn);
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
|
@ -115,18 +121,19 @@ JX.behavior('phabricator-object-selector', function(config) {
|
|||
JX.DOM.listen(
|
||||
JX.$(config.results),
|
||||
'click',
|
||||
'object-attach-button',
|
||||
'object-attacher',
|
||||
function(e) {
|
||||
e.kill();
|
||||
var button = e.getNode('object-attach-button');
|
||||
if (button.disabled) {
|
||||
|
||||
var data = e.getNodeData('object-attach-row');
|
||||
var phid = data.handle.phid;
|
||||
if (phids[phid]) {
|
||||
return;
|
||||
}
|
||||
|
||||
var data = e.getNodeData('object-attach-button');
|
||||
phids[data.handle.phid] = true;
|
||||
JX.DOM.alterClass(button, 'disabled', true);
|
||||
button.disabled = true;
|
||||
phids[phid] = true;
|
||||
JX.DOM.alterClass(button_list[phid], 'disabled', true);
|
||||
button_list[phid].disabled = true;
|
||||
|
||||
redrawAttached();
|
||||
});
|
||||
|
@ -134,21 +141,16 @@ JX.behavior('phabricator-object-selector', function(config) {
|
|||
JX.DOM.listen(
|
||||
JX.$(config.current),
|
||||
'click',
|
||||
'object-attach-button',
|
||||
'object-attacher',
|
||||
function(e) {
|
||||
e.kill();
|
||||
var button = e.getNode('object-attach-button');
|
||||
if (button.disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
var data = e.getNodeData('object-attach-button');
|
||||
delete phids[data.handle.phid];
|
||||
var data = e.getNodeData('object-attach-row');
|
||||
var phid = data.handle.phid;
|
||||
|
||||
if (attach_list[data.handle.phid]) {
|
||||
JX.DOM.alterClass(attach_list[data.handle.phid], 'disabled', false);
|
||||
attach_list[data.handle.phid].disabled = false;
|
||||
}
|
||||
delete phids[phid];
|
||||
JX.DOM.alterClass(button_list[phid], 'disabled', false);
|
||||
button_list[phid].disabled = false;
|
||||
|
||||
redrawAttached();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue