Rename subtask controller

This commit is contained in:
Frederic Guillot
2016-05-17 22:25:18 -04:00
parent 996997a12d
commit 46ed06268d
15 changed files with 33 additions and 33 deletions

View File

@@ -3,14 +3,15 @@
namespace Kanboard\Controller; namespace Kanboard\Controller;
use Kanboard\Core\Controller\AccessForbiddenException; use Kanboard\Core\Controller\AccessForbiddenException;
use Kanboard\Core\Controller\PageNotFoundException;
/** /**
* Subtask controller * Subtask controller
* *
* @package controller * @package Kanboard\Controller
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class Subtask extends BaseController class SubtaskController extends BaseController
{ {
/** /**
* Creation form * Creation form
@@ -19,7 +20,7 @@ class Subtask extends BaseController
* @param array $values * @param array $values
* @param array $errors * @param array $errors
* @throws AccessForbiddenException * @throws AccessForbiddenException
* @throws \Kanboard\Core\Controller\PageNotFoundException * @throws PageNotFoundException
*/ */
public function create(array $values = array(), array $errors = array()) public function create(array $values = array(), array $errors = array())
{ {
@@ -76,7 +77,7 @@ class Subtask extends BaseController
* @param array $values * @param array $values
* @param array $errors * @param array $errors
* @throws AccessForbiddenException * @throws AccessForbiddenException
* @throws \Kanboard\Core\Controller\PageNotFoundException * @throws PageNotFoundException
*/ */
public function edit(array $values = array(), array $errors = array()) public function edit(array $values = array(), array $errors = array())
{ {
@@ -166,7 +167,7 @@ class Subtask extends BaseController
$task_id = $this->request->getIntegerParam('task_id'); $task_id = $this->request->getIntegerParam('task_id');
$values = $this->request->getJson(); $values = $this->request->getJson();
if (! empty($values) && $this->helper->user->hasProjectAccess('Subtask', 'movePosition', $project_id)) { if (! empty($values) && $this->helper->user->hasProjectAccess('SubtaskController', 'movePosition', $project_id)) {
$result = $this->subtask->changePosition($task_id, $values['subtask_id'], $values['position']); $result = $this->subtask->changePosition($task_id, $values['subtask_id'], $values['position']);
$this->response->json(array('result' => $result)); $this->response->json(array('result' => $result));
} else { } else {

View File

@@ -7,22 +7,22 @@ use Kanboard\Model\Subtask as SubtaskModel;
/** /**
* Subtask Restriction * Subtask Restriction
* *
* @package controller * @package Kanboard\Controller
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class SubtaskRestriction extends BaseController class SubtaskRestrictionController extends BaseController
{ {
/** /**
* Show popup * Show popup
* *
* @access public * @access public
*/ */
public function popover() public function show()
{ {
$task = $this->getTask(); $task = $this->getTask();
$subtask = $this->getSubtask(); $subtask = $this->getSubtask();
$this->response->html($this->template->render('subtask_restriction/popover', array( $this->response->html($this->template->render('subtask_restriction/show', array(
'status_list' => array( 'status_list' => array(
SubtaskModel::STATUS_TODO => t('Todo'), SubtaskModel::STATUS_TODO => t('Todo'),
SubtaskModel::STATUS_DONE => t('Done'), SubtaskModel::STATUS_DONE => t('Done'),
@@ -38,7 +38,7 @@ class SubtaskRestriction extends BaseController
* *
* @access public * @access public
*/ */
public function update() public function save()
{ {
$task = $this->getTask(); $task = $this->getTask();
$subtask = $this->getSubtask(); $subtask = $this->getSubtask();

View File

@@ -5,10 +5,10 @@ namespace Kanboard\Controller;
/** /**
* Subtask Status * Subtask Status
* *
* @package controller * @package Kanboard\Controller
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class SubtaskStatus extends BaseController class SubtaskStatusController extends BaseController
{ {
/** /**
* Change status to the next status: Toto -> In Progress -> Done * Change status to the next status: Toto -> In Progress -> Done

View File

@@ -36,18 +36,18 @@ class SubtaskHelper extends Base
*/ */
public function toggleStatus(array $subtask, $project_id, $refresh_table = false) public function toggleStatus(array $subtask, $project_id, $refresh_table = false)
{ {
if (! $this->helper->user->hasProjectAccess('subtask', 'edit', $project_id)) { if (! $this->helper->user->hasProjectAccess('SubtaskController', 'edit', $project_id)) {
return $this->getTitle($subtask); return $this->getTitle($subtask);
} }
$params = array('task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'refresh-table' => (int) $refresh_table); $params = array('task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'refresh-table' => (int) $refresh_table);
if ($subtask['status'] == 0 && isset($this->sessionStorage->hasSubtaskInProgress) && $this->sessionStorage->hasSubtaskInProgress) { if ($subtask['status'] == 0 && isset($this->sessionStorage->hasSubtaskInProgress) && $this->sessionStorage->hasSubtaskInProgress) {
return $this->helper->url->link($this->getTitle($subtask), 'SubtaskRestriction', 'popover', $params, false, 'popover'); return $this->helper->url->link($this->getTitle($subtask), 'SubtaskRestrictionController', 'show', $params, false, 'popover');
} }
$class = 'subtask-toggle-status '.($refresh_table ? 'subtask-refresh-table' : ''); $class = 'subtask-toggle-status '.($refresh_table ? 'subtask-refresh-table' : '');
return $this->helper->url->link($this->getTitle($subtask), 'SubtaskStatus', 'change', $params, false, $class); return $this->helper->url->link($this->getTitle($subtask), 'SubtaskStatusController', 'change', $params, false, $class);
} }
public function selectTitle(array $values, array $errors = array(), array $attributes = array()) public function selectTitle(array $values, array $errors = array(), array $attributes = array())

View File

@@ -86,9 +86,9 @@ class AuthenticationProvider implements ServiceProviderInterface
$acl->add('ProjectEdit', '*', Role::PROJECT_MANAGER); $acl->add('ProjectEdit', '*', Role::PROJECT_MANAGER);
$acl->add('ProjectFile', '*', Role::PROJECT_MEMBER); $acl->add('ProjectFile', '*', Role::PROJECT_MEMBER);
$acl->add('Projectuser', '*', Role::PROJECT_MANAGER); $acl->add('Projectuser', '*', Role::PROJECT_MANAGER);
$acl->add('Subtask', '*', Role::PROJECT_MEMBER); $acl->add('SubtaskController', '*', Role::PROJECT_MEMBER);
$acl->add('SubtaskRestriction', '*', Role::PROJECT_MEMBER); $acl->add('SubtaskRestrictionController', '*', Role::PROJECT_MEMBER);
$acl->add('SubtaskStatus', '*', Role::PROJECT_MEMBER); $acl->add('SubtaskStatusController', '*', Role::PROJECT_MEMBER);
$acl->add('Swimlane', '*', Role::PROJECT_MANAGER); $acl->add('Swimlane', '*', Role::PROJECT_MANAGER);
$acl->add('Task', 'remove', Role::PROJECT_MEMBER); $acl->add('Task', 'remove', Role::PROJECT_MEMBER);
$acl->add('TaskCreationController', '*', Role::PROJECT_MEMBER); $acl->add('TaskCreationController', '*', Role::PROJECT_MEMBER);

View File

@@ -100,7 +100,6 @@ class RouteProvider implements ServiceProviderInterface
$container['route']->addRoute('project/:project_id/task/:task_id/activity', 'activity', 'task'); $container['route']->addRoute('project/:project_id/task/:task_id/activity', 'activity', 'task');
$container['route']->addRoute('project/:project_id/task/:task_id/transitions', 'task', 'transitions'); $container['route']->addRoute('project/:project_id/task/:task_id/transitions', 'task', 'transitions');
$container['route']->addRoute('project/:project_id/task/:task_id/analytics', 'task', 'analytics'); $container['route']->addRoute('project/:project_id/task/:task_id/analytics', 'task', 'analytics');
$container['route']->addRoute('project/:project_id/task/:task_id/subtasks', 'subtask', 'show');
$container['route']->addRoute('project/:project_id/task/:task_id/time-tracking', 'task', 'timetracking'); $container['route']->addRoute('project/:project_id/task/:task_id/time-tracking', 'task', 'timetracking');
// Exports // Exports

View File

@@ -2,7 +2,7 @@
<h2><?= t('Add a sub-task') ?></h2> <h2><?= t('Add a sub-task') ?></h2>
</div> </div>
<form class="popover-form" method="post" action="<?= $this->url->href('subtask', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off"> <form class="popover-form" method="post" action="<?= $this->url->href('SubtaskController', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?> <?= $this->form->csrf() ?>
<?= $this->form->hidden('task_id', $values) ?> <?= $this->form->hidden('task_id', $values) ?>

View File

@@ -2,7 +2,7 @@
<h2><?= t('Edit a sub-task') ?></h2> <h2><?= t('Edit a sub-task') ?></h2>
</div> </div>
<form class="popover-form" method="post" action="<?= $this->url->href('subtask', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>" autocomplete="off"> <form class="popover-form" method="post" action="<?= $this->url->href('SubtaskController', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?> <?= $this->form->csrf() ?>
<?= $this->form->hidden('id', $values) ?> <?= $this->form->hidden('id', $values) ?>

View File

@@ -3,11 +3,11 @@
<ul> <ul>
<li> <li>
<i class="fa fa-pencil-square-o" aria-hidden="true"></i> <i class="fa fa-pencil-square-o" aria-hidden="true"></i>
<?= $this->url->link(t('Edit'), 'subtask', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id']), false, 'popover') ?> <?= $this->url->link(t('Edit'), 'SubtaskController', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id']), false, 'popover') ?>
</li> </li>
<li> <li>
<i class="fa fa-trash-o" aria-hidden="true"></i> <i class="fa fa-trash-o" aria-hidden="true"></i>
<?= $this->url->link(t('Remove'), 'subtask', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id']), false, 'popover') ?> <?= $this->url->link(t('Remove'), 'SubtaskController', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id']), false, 'popover') ?>
</li> </li>
<li> <li>
<i class="fa fa-clone" aria-hidden="true"></i> <i class="fa fa-clone" aria-hidden="true"></i>

View File

@@ -13,7 +13,7 @@
</div> </div>
<div class="form-actions"> <div class="form-actions">
<?= $this->url->link(t('Yes'), 'subtask', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id']), true, 'btn btn-red') ?> <?= $this->url->link(t('Yes'), 'SubtaskController', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id']), true, 'btn btn-red') ?>
<?= t('or') ?> <?= t('or') ?>
<?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
</div> </div>

View File

@@ -1,7 +1,7 @@
<?php if (! empty($subtasks)): ?> <?php if (! empty($subtasks)): ?>
<table <table
class="subtasks-table table-stripped" class="subtasks-table table-stripped"
data-save-position-url="<?= $this->url->href('Subtask', 'movePosition', array('project_id' => $task['project_id'], 'task_id' => $task['id'])) ?>" data-save-position-url="<?= $this->url->href('SubtaskController', 'movePosition', array('project_id' => $task['project_id'], 'task_id' => $task['id'])) ?>"
> >
<thead> <thead>
<tr> <tr>
@@ -44,11 +44,11 @@
<li> <li>
<?php if ($subtask['is_timer_started']): ?> <?php if ($subtask['is_timer_started']): ?>
<i class="fa fa-pause"></i> <i class="fa fa-pause"></i>
<?= $this->url->link(t('Stop timer'), 'SubtaskStatus', 'timer', array('timer' => 'stop', 'project_id' => $task['project_id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id']), false, 'subtask-toggle-timer') ?> <?= $this->url->link(t('Stop timer'), 'SubtaskStatusController', 'timer', array('timer' => 'stop', 'project_id' => $task['project_id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id']), false, 'subtask-toggle-timer') ?>
(<?= $this->dt->age($subtask['timer_start_date']) ?>) (<?= $this->dt->age($subtask['timer_start_date']) ?>)
<?php else: ?> <?php else: ?>
<i class="fa fa-play-circle-o"></i> <i class="fa fa-play-circle-o"></i>
<?= $this->url->link(t('Start timer'), 'SubtaskStatus', 'timer', array('timer' => 'start', 'project_id' => $task['project_id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id']), false, 'subtask-toggle-timer') ?> <?= $this->url->link(t('Start timer'), 'SubtaskStatusController', 'timer', array('timer' => 'start', 'project_id' => $task['project_id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id']), false, 'subtask-toggle-timer') ?>
<?php endif ?> <?php endif ?>
</li> </li>
<?php endif ?> <?php endif ?>

View File

@@ -1,7 +1,7 @@
<div class="page-header"> <div class="page-header">
<h2><?= t('You already have one subtask in progress') ?></h2> <h2><?= t('You already have one subtask in progress') ?></h2>
</div> </div>
<form class="popover-form" action="<?= $this->url->href('SubtaskRestriction', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>" method="post"> <form class="popover-form" action="<?= $this->url->href('SubtaskRestrictionController', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>" method="post">
<?= $this->form->csrf() ?> <?= $this->form->csrf() ?>
@@ -12,6 +12,6 @@
<div class="form-actions"> <div class="form-actions">
<button type="submit" class="btn btn-red"><?= t('Save') ?></button> <button type="submit" class="btn btn-red"><?= t('Save') ?></button>
<?= t('or') ?> <?= t('or') ?>
<a href="#" class="close-popover"><?= t('cancel') ?></a> <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
</div> </div>
</form> </form>

View File

@@ -25,7 +25,7 @@
</li> </li>
<li> <li>
<i class="fa fa-plus fa-fw"></i> <i class="fa fa-plus fa-fw"></i>
<?= $this->url->link(t('Add a sub-task'), 'subtask', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> <?= $this->url->link(t('Add a sub-task'), 'SubtaskController', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
</li> </li>
<li> <li>
<i class="fa fa-code-fork fa-fw"></i> <i class="fa fa-code-fork fa-fw"></i>

View File

@@ -5,7 +5,7 @@
class="sidebar-container" id="task-view" class="sidebar-container" id="task-view"
data-edit-url="<?= $this->url->href('taskmodification', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" data-edit-url="<?= $this->url->href('taskmodification', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"
data-description-url="<?= $this->url->href('taskmodification', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" data-description-url="<?= $this->url->href('taskmodification', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"
data-subtask-url="<?= $this->url->href('subtask', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" data-subtask-url="<?= $this->url->href('SubtaskController', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"
data-internal-link-url="<?= $this->url->href('TaskInternalLink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" data-internal-link-url="<?= $this->url->href('TaskInternalLink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"
data-comment-url="<?= $this->url->href('comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"> data-comment-url="<?= $this->url->href('comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>">

View File

@@ -44,7 +44,7 @@
</li> </li>
<li> <li>
<i class="fa fa-plus fa-fw"></i> <i class="fa fa-plus fa-fw"></i>
<?= $this->url->link(t('Add a sub-task'), 'subtask', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> <?= $this->url->link(t('Add a sub-task'), 'SubtaskController', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
</li> </li>
<li> <li>
<i class="fa fa-code-fork fa-fw"></i> <i class="fa fa-code-fork fa-fw"></i>