mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-28 16:30:59 +01:00
Have "limit=1" tokenizers replace tokens instead of disabling "Browse"
Summary: Fixes T9984. When a tokenizer only allows one selection (like "Task Owner:" or "Land Onto Branch:"), keep the browse button active but have it //replace// values. Also, have "Create Subtask" default to the system default status, so subtasks of closed tasks are not also closed. Test Plan: - Browsed an empty limit=1 tokenizer. - Replaced a full limit=1 tokenizer. - Browsed an empty no-limit tokenizer. - Browsed more tokens into the no-limit tokenizer. - Typed some tokens normally. - Created a subtask of a closed task. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9984 Differential Revision: https://secure.phabricator.com/D14785
This commit is contained in:
parent
c19654db16
commit
29e2acd525
3 changed files with 31 additions and 13 deletions
|
@ -8,7 +8,7 @@
|
|||
return array(
|
||||
'names' => array(
|
||||
'core.pkg.css' => '6d8c526d',
|
||||
'core.pkg.js' => '46bc8dbd',
|
||||
'core.pkg.js' => 'c60f35d8',
|
||||
'darkconsole.pkg.js' => 'e7393ebb',
|
||||
'differential.pkg.css' => '2de124c9',
|
||||
'differential.pkg.js' => '6223dd9d',
|
||||
|
@ -244,7 +244,7 @@ return array(
|
|||
'rsrc/externals/javelin/lib/__tests__/URI.js' => '1e45fda9',
|
||||
'rsrc/externals/javelin/lib/__tests__/behavior.js' => '1ea62783',
|
||||
'rsrc/externals/javelin/lib/behavior.js' => '61cbc29a',
|
||||
'rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js' => '9fef18a5',
|
||||
'rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js' => 'c431f925',
|
||||
'rsrc/externals/javelin/lib/control/typeahead/Typeahead.js' => '70baed2f',
|
||||
'rsrc/externals/javelin/lib/control/typeahead/normalizer/TypeaheadNormalizer.js' => 'e6e25838',
|
||||
'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadCompositeSource.js' => '503e17fd',
|
||||
|
@ -704,7 +704,7 @@ return array(
|
|||
'javelin-scrollbar' => '087e919c',
|
||||
'javelin-sound' => '949c0fe5',
|
||||
'javelin-stratcom' => '6c53634d',
|
||||
'javelin-tokenizer' => '9fef18a5',
|
||||
'javelin-tokenizer' => 'c431f925',
|
||||
'javelin-typeahead' => '70baed2f',
|
||||
'javelin-typeahead-composite-source' => '503e17fd',
|
||||
'javelin-typeahead-normalizer' => 'e6e25838',
|
||||
|
@ -1581,12 +1581,6 @@ return array(
|
|||
'javelin-dom',
|
||||
'javelin-vector',
|
||||
),
|
||||
'9fef18a5' => array(
|
||||
'javelin-dom',
|
||||
'javelin-util',
|
||||
'javelin-stratcom',
|
||||
'javelin-install',
|
||||
),
|
||||
'a0b57eb8' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
|
@ -1783,6 +1777,12 @@ return array(
|
|||
'javelin-dom',
|
||||
'javelin-vector',
|
||||
),
|
||||
'c431f925' => array(
|
||||
'javelin-dom',
|
||||
'javelin-util',
|
||||
'javelin-stratcom',
|
||||
'javelin-install',
|
||||
),
|
||||
'c72aa091' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
|
|
|
@ -163,7 +163,10 @@ final class ManiphestTaskDetailController extends ManiphestController {
|
|||
$can_create = (bool)$edit_config;
|
||||
if ($can_create) {
|
||||
$form_key = $edit_config->getIdentifier();
|
||||
$edit_uri = "/task/edit/form/{$form_key}/?parent={$id}&template={$id}";
|
||||
$edit_uri = id(new PhutilURI("/task/edit/form/{$form_key}/"))
|
||||
->setQueryParam('parent', $id)
|
||||
->setQueryParam('template', $id)
|
||||
->setQueryParam('status', ManiphestTaskStatus::getDefaultStatus());
|
||||
$edit_uri = $this->getApplicationURI($edit_uri);
|
||||
} else {
|
||||
// TODO: This will usually give us a somewhat-reasonable error page, but
|
||||
|
|
|
@ -428,16 +428,23 @@ JX.install('Tokenizer', {
|
|||
|
||||
if (this.getBrowseURI()) {
|
||||
var button = JX.DOM.find(this._frame, 'a', 'tokenizer-browse');
|
||||
JX.DOM.alterClass(button, 'disabled', !!this._isAtTokenLimit());
|
||||
JX.DOM.alterClass(button, 'disabled', !!this._shouldLockBrowse());
|
||||
}
|
||||
|
||||
this.invoke('change', this);
|
||||
},
|
||||
|
||||
_isAtTokenLimit: function() {
|
||||
_shouldLockBrowse: function() {
|
||||
var limit = this.getLimit();
|
||||
|
||||
if (!limit) {
|
||||
// If there's no limit, never lock the browse button.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (limit == 1) {
|
||||
// If the limit is 1, we'll replace the current token if the
|
||||
// user selects a new one, so we never need to lock the button.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -486,7 +493,7 @@ JX.install('Tokenizer', {
|
|||
return;
|
||||
}
|
||||
|
||||
if (this._isAtTokenLimit()) {
|
||||
if (this._shouldLockBrowse()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -498,6 +505,14 @@ JX.install('Tokenizer', {
|
|||
source.addResult(r.token);
|
||||
var result = source.getResult(r.key);
|
||||
|
||||
// If we have a limit of 1 token, replace the current token with
|
||||
// the new token if we currently have a token.
|
||||
if (this.getLimit() == 1) {
|
||||
for (var k in this.getTokens()) {
|
||||
this.removeToken(k);
|
||||
}
|
||||
}
|
||||
|
||||
this.addToken(r.key, result.name);
|
||||
this.focus();
|
||||
}))
|
||||
|
|
Loading…
Reference in a new issue