mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02:42 +01:00
Modified create workflow to support rapid templated task creation, made Task Edit repopulate user input array fields on error
Reviewers: epriestley Test Plan: Create a new task in Maniphest, then click "Create Another Task Like This" Differential Revision: 734
This commit is contained in:
parent
9d94ea9fdf
commit
218856e8b8
3 changed files with 49 additions and 5 deletions
|
@ -163,6 +163,19 @@ class ManiphestTaskDetailController extends ManiphestController {
|
|||
implode("\n", $table).
|
||||
'</table>';
|
||||
|
||||
$create_new_button = '';
|
||||
if ($request->getStr('workflow') == 'create') {
|
||||
$create_new_button =
|
||||
'<div class="create-button-container">'.
|
||||
phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '/maniphest/task/create/?template='.$task->getID(),
|
||||
'class' => 'green button',
|
||||
),
|
||||
'Create New Task').
|
||||
'</div>';
|
||||
}
|
||||
|
||||
$actions = array();
|
||||
|
||||
|
@ -196,6 +209,7 @@ class ManiphestTaskDetailController extends ManiphestController {
|
|||
'<div class="maniphest-panel">'.
|
||||
$action_list->render().
|
||||
'<div class="maniphest-task-detail-core">'.
|
||||
$create_new_button.
|
||||
'<h1>'.
|
||||
'<span class="aphront-headsup-object-name">'.
|
||||
phutil_escape_html('T'.$task->getID()).
|
||||
|
|
|
@ -78,6 +78,8 @@ class ManiphestTaskEditController extends ManiphestController {
|
|||
$new_desc = $request->getStr('description');
|
||||
$new_status = $request->getStr('status');
|
||||
|
||||
$workflow = '';
|
||||
|
||||
if ($task->getID()) {
|
||||
if ($new_title != $task->getTitle()) {
|
||||
$changes[ManiphestTransactionType::TYPE_TITLE] = $new_title;
|
||||
|
@ -93,6 +95,8 @@ class ManiphestTaskEditController extends ManiphestController {
|
|||
$task->setDescription($new_desc);
|
||||
$changes[ManiphestTransactionType::TYPE_STATUS] =
|
||||
ManiphestTaskStatus::STATUS_OPEN;
|
||||
|
||||
$workflow = 'create';
|
||||
}
|
||||
|
||||
$owner_tokenizer = $request->getArr('assigned_to');
|
||||
|
@ -103,9 +107,12 @@ class ManiphestTaskEditController extends ManiphestController {
|
|||
$errors[] = 'Title is required.';
|
||||
}
|
||||
|
||||
if (!$errors) {
|
||||
|
||||
|
||||
if ($errors) {
|
||||
$task->setPriority($request->getInt('priority'));
|
||||
$task->setOwnerPHID($owner_phid);
|
||||
$task->setCCPHIDs($request->getArr('cc'));
|
||||
$task->setProjectPHIDs($request->getArr('projects'));
|
||||
} else {
|
||||
if ($request->getInt('priority') != $task->getPriority()) {
|
||||
$changes[ManiphestTransactionType::TYPE_PRIORITY] =
|
||||
$request->getInt('priority');
|
||||
|
@ -155,8 +162,14 @@ class ManiphestTaskEditController extends ManiphestController {
|
|||
$editor->applyTransactions($task, $transactions);
|
||||
}
|
||||
|
||||
$redirect_uri = '/T'.$task->getID();
|
||||
|
||||
if ($workflow) {
|
||||
$redirect_uri .= '?workflow='.$workflow;
|
||||
}
|
||||
|
||||
return id(new AphrontRedirectResponse())
|
||||
->setURI('/T'.$task->getID());
|
||||
->setURI($redirect_uri);
|
||||
}
|
||||
} else {
|
||||
if (!$task->getID()) {
|
||||
|
@ -166,10 +179,23 @@ class ManiphestTaskEditController extends ManiphestController {
|
|||
}
|
||||
}
|
||||
|
||||
$template_task = null;
|
||||
$template_id = $request->getStr('template');
|
||||
if ($template_id && !$request->isFormPost()) {
|
||||
$template_task = id(new ManiphestTask())->load($template_id);
|
||||
}
|
||||
|
||||
if (!$task->getID() && $template_task) {
|
||||
$task->setCCPHIDs($template_task->getCCPHIDs());
|
||||
$task->setProjectPHIDs($template_task->getProjectPHIDs());
|
||||
$task->setOwnerPHID($template_task->getOwnerPHID());
|
||||
}
|
||||
|
||||
$phids = array_merge(
|
||||
array($task->getOwnerPHID()),
|
||||
$task->getCCPHIDs(),
|
||||
$task->getProjectPHIDs());
|
||||
|
||||
$phids = array_filter($phids);
|
||||
$phids = array_unique($phids);
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
|
||||
.maniphest-task-properties {
|
||||
font-size: 12px;
|
||||
width: 100%;
|
||||
|
@ -42,3 +41,8 @@
|
|||
.maniphest-task-detail-core {
|
||||
margin-right: 265px;
|
||||
}
|
||||
|
||||
.maniphest-task-detail-core .create-button-container {
|
||||
float:right;
|
||||
margin-top:-0.5em;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue