Improve project move view

This commit is contained in:
Frédéric Guillot
2014-08-31 20:44:58 -08:00
parent 7e44dee903
commit 7dd0a24411
2 changed files with 21 additions and 12 deletions

View File

@@ -436,6 +436,9 @@ class Task extends Base
$task = $this->getTask(); $task = $this->getTask();
$values = $task; $values = $task;
$errors = array(); $errors = array();
$projects_list = $this->project->getAvailableList($this->acl->getUserId());
unset($projects_list[$task['project_id']]);
if ($this->request->isPost()) { if ($this->request->isPost()) {
@@ -457,7 +460,7 @@ class Task extends Base
'values' => $values, 'values' => $values,
'errors' => $errors, 'errors' => $errors,
'task' => $task, 'task' => $task,
'projects_list' => $this->project->getAvailableList($this->acl->getUserId()), 'projects_list' => $projects_list,
'menu' => 'tasks', 'menu' => 'tasks',
'title' => t('Move the task to another project') 'title' => t('Move the task to another project')
))); )));

View File

@@ -2,17 +2,23 @@
<h2><?= t('Move the task to another project') ?></h2> <h2><?= t('Move the task to another project') ?></h2>
</div> </div>
<form method="post" action="?controller=task&amp;action=move&amp;task_id=<?= $task['id'] ?>&amp;project_id=<?= $task['project_id'] ?>" autocomplete="off"> <?php if (empty($projects_list)): ?>
<p class="alert"><?= t('No project') ?></p>
<?php else: ?>
<?= Helper\form_csrf() ?> <form method="post" action="?controller=task&amp;action=move&amp;task_id=<?= $task['id'] ?>&amp;project_id=<?= $task['project_id'] ?>" autocomplete="off">
<?= Helper\form_hidden('id', $values) ?> <?= Helper\form_csrf() ?>
<?= Helper\form_label(t('Project'), 'project_id') ?>
<?= Helper\form_select('project_id', $projects_list, $values, $errors) ?><br/>
<div class="form-actions"> <?= Helper\form_hidden('id', $values) ?>
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> <?= Helper\form_label(t('Project'), 'project_id') ?>
<?= t('or') ?> <?= Helper\form_select('project_id', $projects_list, $values, $errors) ?><br/>
<a href="?controller=board&amp;action=show&amp;project_id=<?= $task['project_id'] ?>"><?= t('cancel') ?></a>
</div> <div class="form-actions">
</form> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
<?= t('or') ?>
<a href="?controller=task&amp;action=show&amp;task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a>
</div>
</form>
<?php endif ?>