1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-29 16:08:22 +01:00

Use active project filter as default field value when creating new tasks

Summary: See T389. If you're looking at tasks in project X, default new tasks
into project X.
Test Plan:
  - Created a new task without associated projects.
  - Created a new task from a filter view with 1 and 2 projects; defaults were
filled in.
  - Submitted task with invalid title, projects were correctly preserved.

Reviewed By: skrul
Reviewers: skrul, hunterbridges, jungejason, tuomaspelkonen, aran
CC: aran, skrul, epriestley
Differential Revision: 757
This commit is contained in:
epriestley 2011-08-01 13:51:27 -07:00
parent 7baf7c774d
commit 3ceb3d340b
3 changed files with 14 additions and 1 deletions

View file

@ -47,6 +47,11 @@ class ManiphestTaskEditController extends ManiphestController {
// These allow task creation with defaults. // These allow task creation with defaults.
if (!$request->isFormPost()) { if (!$request->isFormPost()) {
$task->setTitle($request->getStr('title')); $task->setTitle($request->getStr('title'));
$default_projects = $request->getStr('projects');
if ($default_projects) {
$task->setProjectPHIDs(explode(';', $default_projects));
}
} }
$file_phids = $request->getArr('files', array()); $file_phids = $request->getArr('files', array());

View file

@ -176,12 +176,19 @@ class ManiphestTaskListController extends ManiphestController {
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue('Filter Tasks')); ->setValue('Filter Tasks'));
$create_uri = new PhutilURI('/maniphest/task/create/');
if ($project_phids) {
// If we have project filters selected, use them as defaults for task
// creation.
$create_uri->setQueryParam('projects', implode(';', $project_phids));
}
$filter = new AphrontListFilterView(); $filter = new AphrontListFilterView();
$filter->addButton( $filter->addButton(
phutil_render_tag( phutil_render_tag(
'a', 'a',
array( array(
'href' => '/maniphest/task/create/', 'href' => (string)$create_uri,
'class' => 'green button', 'class' => 'green button',
), ),
'Create New Task')); 'Create New Task'));

View file

@ -23,6 +23,7 @@ phutil_require_module('phabricator', 'view/layout/listfilter');
phutil_require_module('phabricator', 'view/layout/sidenav'); phutil_require_module('phabricator', 'view/layout/sidenav');
phutil_require_module('phutil', 'markup'); phutil_require_module('phutil', 'markup');
phutil_require_module('phutil', 'parser/uri');
phutil_require_module('phutil', 'utils'); phutil_require_module('phutil', 'utils');