Allow quickly creating and changing state of subtask (pull-request #312)
This commit is contained in:
@@ -184,4 +184,26 @@ class Subtask extends Base
|
|||||||
|
|
||||||
$this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'#subtasks');
|
$this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'#subtasks');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change status to the next status: Toto -> In Progress -> Done
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public function toggleStatus()
|
||||||
|
{
|
||||||
|
$task = $this->getTask();
|
||||||
|
$subtask = $this->getSubtask();
|
||||||
|
|
||||||
|
$value = array(
|
||||||
|
'id' => $subtask['id'],
|
||||||
|
'status' => ($subtask['status'] + 1) % 3
|
||||||
|
);
|
||||||
|
|
||||||
|
if (! $this->subTask->update($value)) {
|
||||||
|
$this->session->flashError(t('Unable to update your sub-task.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'#subtasks');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -536,4 +536,6 @@ return array(
|
|||||||
// 'ISO format is always accepted, example: "%s" and "%s"' => '',
|
// 'ISO format is always accepted, example: "%s" and "%s"' => '',
|
||||||
// 'New private project' => '',
|
// 'New private project' => '',
|
||||||
// 'This project is private' => '',
|
// 'This project is private' => '',
|
||||||
|
// 'Type here to create a new sub-task' => '',
|
||||||
|
// 'Add' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -536,4 +536,6 @@ return array(
|
|||||||
// 'ISO format is always accepted, example: "%s" and "%s"' => '',
|
// 'ISO format is always accepted, example: "%s" and "%s"' => '',
|
||||||
// 'New private project' => '',
|
// 'New private project' => '',
|
||||||
// 'This project is private' => '',
|
// 'This project is private' => '',
|
||||||
|
// 'Type here to create a new sub-task' => '',
|
||||||
|
// 'Add' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -536,4 +536,6 @@ return array(
|
|||||||
// 'ISO format is always accepted, example: "%s" and "%s"' => '',
|
// 'ISO format is always accepted, example: "%s" and "%s"' => '',
|
||||||
// 'New private project' => '',
|
// 'New private project' => '',
|
||||||
// 'This project is private' => '',
|
// 'This project is private' => '',
|
||||||
|
// 'Type here to create a new sub-task' => '',
|
||||||
|
// 'Add' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -536,4 +536,6 @@ return array(
|
|||||||
'ISO format is always accepted, example: "%s" and "%s"' => 'Le format ISO est toujours accepté, exemple : « %s » et « %s »',
|
'ISO format is always accepted, example: "%s" and "%s"' => 'Le format ISO est toujours accepté, exemple : « %s » et « %s »',
|
||||||
'New private project' => 'Nouveau projet privé',
|
'New private project' => 'Nouveau projet privé',
|
||||||
'This project is private' => 'Ce projet est privé',
|
'This project is private' => 'Ce projet est privé',
|
||||||
|
'Type here to create a new sub-task' => 'Créer une sous-tâche en écrivant le titre ici',
|
||||||
|
'Add' => 'Ajouter',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -536,4 +536,6 @@ return array(
|
|||||||
// 'ISO format is always accepted, example: "%s" and "%s"' => '',
|
// 'ISO format is always accepted, example: "%s" and "%s"' => '',
|
||||||
// 'New private project' => '',
|
// 'New private project' => '',
|
||||||
// 'This project is private' => '',
|
// 'This project is private' => '',
|
||||||
|
// 'Type here to create a new sub-task' => '',
|
||||||
|
// 'Add' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -536,4 +536,6 @@ return array(
|
|||||||
// 'ISO format is always accepted, example: "%s" and "%s"' => '',
|
// 'ISO format is always accepted, example: "%s" and "%s"' => '',
|
||||||
// 'New private project' => '',
|
// 'New private project' => '',
|
||||||
// 'This project is private' => '',
|
// 'This project is private' => '',
|
||||||
|
// 'Type here to create a new sub-task' => '',
|
||||||
|
// 'Add' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -536,4 +536,6 @@ return array(
|
|||||||
// 'ISO format is always accepted, example: "%s" and "%s"' => '',
|
// 'ISO format is always accepted, example: "%s" and "%s"' => '',
|
||||||
// 'New private project' => '',
|
// 'New private project' => '',
|
||||||
// 'This project is private' => '',
|
// 'This project is private' => '',
|
||||||
|
// 'Type here to create a new sub-task' => '',
|
||||||
|
// 'Add' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -536,4 +536,6 @@ return array(
|
|||||||
// 'ISO format is always accepted, example: "%s" and "%s"' => '',
|
// 'ISO format is always accepted, example: "%s" and "%s"' => '',
|
||||||
// 'New private project' => '',
|
// 'New private project' => '',
|
||||||
// 'This project is private' => '',
|
// 'This project is private' => '',
|
||||||
|
// 'Type here to create a new sub-task' => '',
|
||||||
|
// 'Add' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -536,4 +536,6 @@ return array(
|
|||||||
// 'ISO format is always accepted, example: "%s" and "%s"' => '',
|
// 'ISO format is always accepted, example: "%s" and "%s"' => '',
|
||||||
// 'New private project' => '',
|
// 'New private project' => '',
|
||||||
// 'This project is private' => '',
|
// 'This project is private' => '',
|
||||||
|
// 'Type here to create a new sub-task' => '',
|
||||||
|
// 'Add' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -536,4 +536,6 @@ return array(
|
|||||||
// 'ISO format is always accepted, example: "%s" and "%s"' => '',
|
// 'ISO format is always accepted, example: "%s" and "%s"' => '',
|
||||||
// 'New private project' => '',
|
// 'New private project' => '',
|
||||||
// 'This project is private' => '',
|
// 'This project is private' => '',
|
||||||
|
// 'Type here to create a new sub-task' => '',
|
||||||
|
// 'Add' => '',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class Acl extends Base
|
|||||||
'user' => array('edit', 'forbidden', 'logout', 'show', 'external', 'unlinkgoogle', 'unlinkgithub', 'sessions', 'removesession', 'last', 'notifications', 'password'),
|
'user' => array('edit', 'forbidden', 'logout', 'show', 'external', 'unlinkgoogle', 'unlinkgithub', 'sessions', 'removesession', 'last', 'notifications', 'password'),
|
||||||
'comment' => array('create', 'save', 'confirm', 'remove', 'update', 'edit', 'forbidden'),
|
'comment' => array('create', 'save', 'confirm', 'remove', 'update', 'edit', 'forbidden'),
|
||||||
'file' => array('create', 'save', 'download', 'confirm', 'remove', 'open', 'image'),
|
'file' => array('create', 'save', 'download', 'confirm', 'remove', 'open', 'image'),
|
||||||
'subtask' => array('create', 'save', 'edit', 'update', 'confirm', 'remove'),
|
'subtask' => array('create', 'save', 'edit', 'update', 'confirm', 'remove', 'togglestatus'),
|
||||||
'task' => array('show', 'create', 'save', 'edit', 'update', 'close', 'open', 'duplicate', 'remove', 'description', 'move', 'copy'),
|
'task' => array('show', 'create', 'save', 'edit', 'update', 'close', 'open', 'duplicate', 'remove', 'description', 'move', 'copy'),
|
||||||
'category' => array('index', 'save', 'edit', 'update', 'confirm', 'remove'),
|
'category' => array('index', 'save', 'edit', 'update', 'confirm', 'remove'),
|
||||||
'action' => array('index', 'event', 'params', 'create', 'confirm', 'remove'),
|
'action' => array('index', 'event', 'params', 'create', 'confirm', 'remove'),
|
||||||
|
|||||||
@@ -26,7 +26,22 @@
|
|||||||
<?php foreach ($subtasks as $subtask): ?>
|
<?php foreach ($subtasks as $subtask): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?= Helper\escape($subtask['title']) ?></td>
|
<td><?= Helper\escape($subtask['title']) ?></td>
|
||||||
<td><?= Helper\escape($subtask['status_name']) ?></td>
|
<td>
|
||||||
|
<?php if (!isset($not_editable)): ?>
|
||||||
|
<a href="<?= Helper\u('subtask', 'toggleStatus', array('task_id' => $task['id'], 'subtask_id' => $subtask['id'])) ?>">
|
||||||
|
<?php endif ?>
|
||||||
|
<?php if ($subtask['status'] == 0): ?>
|
||||||
|
<i class="fa fa-square-o fa-fw"></i><i class="fa"> <?= Helper\escape($subtask['status_name']) ?></i>
|
||||||
|
<?php elseif ($subtask['status'] == 1): ?>
|
||||||
|
<i class="fa fa-gears fa-fw"></i><i class="fa"> <?= Helper\escape($subtask['status_name']) ?></i>
|
||||||
|
<?php else: ?>
|
||||||
|
<i class="fa fa-check-square-o fa-fw"></i><i class="fa"> <?= Helper\escape($subtask['status_name']) ?></i>
|
||||||
|
<?php endif ?>
|
||||||
|
<?php if (! isset($not_editable)): ?>
|
||||||
|
</a>
|
||||||
|
<?php endif ?>
|
||||||
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php if (! empty($subtask['username'])): ?>
|
<?php if (! empty($subtask['username'])): ?>
|
||||||
<?= Helper\escape($subtask['name'] ?: $subtask['username']) ?>
|
<?= Helper\escape($subtask['name'] ?: $subtask['username']) ?>
|
||||||
@@ -43,9 +58,9 @@
|
|||||||
</td>
|
</td>
|
||||||
<?php if (! isset($not_editable)): ?>
|
<?php if (! isset($not_editable)): ?>
|
||||||
<td>
|
<td>
|
||||||
<a href="?controller=subtask&action=edit&task_id=<?= $task['id'] ?>&subtask_id=<?= $subtask['id'] ?>"><?= t('Edit') ?></a>
|
<?= Helper\a(t('Edit'), 'subtask', 'edit', array('task_id' => $task['id'], 'subtask_id' => $subtask['id'])) ?>
|
||||||
<?= t('or') ?>
|
<?= t('or') ?>
|
||||||
<a href="?controller=subtask&action=confirm&task_id=<?= $task['id'] ?>&subtask_id=<?= $subtask['id'] ?>"><?= t('Remove') ?></a>
|
<?= Helper\a(t('Remove'), 'subtask', 'confirm', array('task_id' => $task['id'], 'subtask_id' => $subtask['id'])) ?>
|
||||||
</td>
|
</td>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -57,6 +72,15 @@
|
|||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<?php if (! isset($not_editable)): ?>
|
||||||
|
<form method="post" action="<?= Helper\u('subtask', 'save', array('task_id' => $task['id'])) ?>" autocomplete="off">
|
||||||
|
<?= Helper\form_csrf() ?>
|
||||||
|
<?= Helper\form_hidden('task_id', array('task_id' => $task['id'])) ?>
|
||||||
|
<?= Helper\form_text('title', array(), array(), array('required', 'placeholder="'.t('Type here to create a new sub-task').'"')) ?>
|
||||||
|
<input type="submit" value="<?= t('Add') ?>" class="btn btn-blue"/>
|
||||||
|
</form>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
<div class="subtasks-time-tracking">
|
<div class="subtasks-time-tracking">
|
||||||
<h4><?= t('Time tracking') ?></h4>
|
<h4><?= t('Time tracking') ?></h4>
|
||||||
<ul>
|
<ul>
|
||||||
@@ -67,4 +91,4 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user