mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 04:20:55 +01:00
Merge pull request #44 from hunterbridges/workflow-create
Modified create workflow to support rapid templated task creation, made T
This commit is contained in:
commit
4efd36ccf5
3 changed files with 49 additions and 5 deletions
|
@ -163,6 +163,19 @@ class ManiphestTaskDetailController extends ManiphestController {
|
||||||
implode("\n", $table).
|
implode("\n", $table).
|
||||||
'</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();
|
$actions = array();
|
||||||
|
|
||||||
|
@ -196,6 +209,7 @@ class ManiphestTaskDetailController extends ManiphestController {
|
||||||
'<div class="maniphest-panel">'.
|
'<div class="maniphest-panel">'.
|
||||||
$action_list->render().
|
$action_list->render().
|
||||||
'<div class="maniphest-task-detail-core">'.
|
'<div class="maniphest-task-detail-core">'.
|
||||||
|
$create_new_button.
|
||||||
'<h1>'.
|
'<h1>'.
|
||||||
'<span class="aphront-headsup-object-name">'.
|
'<span class="aphront-headsup-object-name">'.
|
||||||
phutil_escape_html('T'.$task->getID()).
|
phutil_escape_html('T'.$task->getID()).
|
||||||
|
|
|
@ -78,6 +78,8 @@ class ManiphestTaskEditController extends ManiphestController {
|
||||||
$new_desc = $request->getStr('description');
|
$new_desc = $request->getStr('description');
|
||||||
$new_status = $request->getStr('status');
|
$new_status = $request->getStr('status');
|
||||||
|
|
||||||
|
$workflow = '';
|
||||||
|
|
||||||
if ($task->getID()) {
|
if ($task->getID()) {
|
||||||
if ($new_title != $task->getTitle()) {
|
if ($new_title != $task->getTitle()) {
|
||||||
$changes[ManiphestTransactionType::TYPE_TITLE] = $new_title;
|
$changes[ManiphestTransactionType::TYPE_TITLE] = $new_title;
|
||||||
|
@ -93,6 +95,8 @@ class ManiphestTaskEditController extends ManiphestController {
|
||||||
$task->setDescription($new_desc);
|
$task->setDescription($new_desc);
|
||||||
$changes[ManiphestTransactionType::TYPE_STATUS] =
|
$changes[ManiphestTransactionType::TYPE_STATUS] =
|
||||||
ManiphestTaskStatus::STATUS_OPEN;
|
ManiphestTaskStatus::STATUS_OPEN;
|
||||||
|
|
||||||
|
$workflow = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
$owner_tokenizer = $request->getArr('assigned_to');
|
$owner_tokenizer = $request->getArr('assigned_to');
|
||||||
|
@ -103,9 +107,12 @@ class ManiphestTaskEditController extends ManiphestController {
|
||||||
$errors[] = 'Title is required.';
|
$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()) {
|
if ($request->getInt('priority') != $task->getPriority()) {
|
||||||
$changes[ManiphestTransactionType::TYPE_PRIORITY] =
|
$changes[ManiphestTransactionType::TYPE_PRIORITY] =
|
||||||
$request->getInt('priority');
|
$request->getInt('priority');
|
||||||
|
@ -155,8 +162,14 @@ class ManiphestTaskEditController extends ManiphestController {
|
||||||
$editor->applyTransactions($task, $transactions);
|
$editor->applyTransactions($task, $transactions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$redirect_uri = '/T'.$task->getID();
|
||||||
|
|
||||||
|
if ($workflow) {
|
||||||
|
$redirect_uri .= '?workflow='.$workflow;
|
||||||
|
}
|
||||||
|
|
||||||
return id(new AphrontRedirectResponse())
|
return id(new AphrontRedirectResponse())
|
||||||
->setURI('/T'.$task->getID());
|
->setURI($redirect_uri);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!$task->getID()) {
|
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(
|
$phids = array_merge(
|
||||||
array($task->getOwnerPHID()),
|
array($task->getOwnerPHID()),
|
||||||
$task->getCCPHIDs(),
|
$task->getCCPHIDs(),
|
||||||
$task->getProjectPHIDs());
|
$task->getProjectPHIDs());
|
||||||
|
|
||||||
$phids = array_filter($phids);
|
$phids = array_filter($phids);
|
||||||
$phids = array_unique($phids);
|
$phids = array_unique($phids);
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.maniphest-task-properties {
|
.maniphest-task-properties {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -42,3 +41,8 @@
|
||||||
.maniphest-task-detail-core {
|
.maniphest-task-detail-core {
|
||||||
margin-right: 265px;
|
margin-right: 265px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.maniphest-task-detail-core .create-button-container {
|
||||||
|
float:right;
|
||||||
|
margin-top:-0.5em;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue