Rename controller TaskLink to TaskInternalLink

This commit is contained in:
Frederic Guillot
2016-03-18 21:16:25 -04:00
parent 854457baf0
commit 73bae9bb34
15 changed files with 22 additions and 28 deletions

View File

@@ -3,13 +3,13 @@
namespace Kanboard\Controller; namespace Kanboard\Controller;
/** /**
* TaskLink controller * TaskInternalLink Controller
* *
* @package controller * @package controller
* @author Olivier Maridat * @author Olivier Maridat
* @author Frederic Guillot * @author Frederic Guillot
*/ */
class Tasklink extends Base class TaskInternalLink extends Base
{ {
/** /**
* Get the current link * Get the current link
@@ -37,12 +37,11 @@ class Tasklink extends Base
{ {
$task = $this->getTask(); $task = $this->getTask();
$this->response->html($this->template->render('tasklink/create', array( $this->response->html($this->template->render('task_internal_link/create', array(
'values' => $values, 'values' => $values,
'errors' => $errors, 'errors' => $errors,
'task' => $task, 'task' => $task,
'labels' => $this->link->getList(0, false), 'labels' => $this->link->getList(0, false),
'title' => t('Add a new link')
))); )));
} }
@@ -61,7 +60,7 @@ class Tasklink extends Base
if ($valid) { if ($valid) {
if ($this->taskLink->create($values['task_id'], $values['opposite_task_id'], $values['link_id'])) { if ($this->taskLink->create($values['task_id'], $values['opposite_task_id'], $values['link_id'])) {
$this->flash->success(t('Link added successfully.')); $this->flash->success(t('Link added successfully.'));
return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links', true); return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
} }
$errors = array('title' => array(t('The exact same link already exists'))); $errors = array('title' => array(t('The exact same link already exists')));
@@ -87,13 +86,12 @@ class Tasklink extends Base
$values['title'] = '#'.$opposite_task['id'].' - '.$opposite_task['title']; $values['title'] = '#'.$opposite_task['id'].' - '.$opposite_task['title'];
} }
$this->response->html($this->template->render('tasklink/edit', array( $this->response->html($this->template->render('task_internal_link/edit', array(
'values' => $values, 'values' => $values,
'errors' => $errors, 'errors' => $errors,
'task_link' => $task_link, 'task_link' => $task_link,
'task' => $task, 'task' => $task,
'labels' => $this->link->getList(0, false), 'labels' => $this->link->getList(0, false)
'title' => t('Edit link')
))); )));
} }
@@ -131,7 +129,7 @@ class Tasklink extends Base
$task = $this->getTask(); $task = $this->getTask();
$link = $this->getTaskLink(); $link = $this->getTaskLink();
$this->response->html($this->template->render('tasklink/remove', array( $this->response->html($this->template->render('task_internal_link/remove', array(
'link' => $link, 'link' => $link,
'task' => $task, 'task' => $task,
))); )));
@@ -153,6 +151,6 @@ class Tasklink extends Base
$this->flash->failure(t('Unable to remove this link.')); $this->flash->failure(t('Unable to remove this link.'));
} }
$this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links'); $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
} }
} }

View File

@@ -94,10 +94,8 @@ class AuthenticationProvider implements ServiceProviderInterface
$acl->add('Taskduplication', '*', Role::PROJECT_MEMBER); $acl->add('Taskduplication', '*', Role::PROJECT_MEMBER);
$acl->add('TaskRecurrence', '*', Role::PROJECT_MEMBER); $acl->add('TaskRecurrence', '*', Role::PROJECT_MEMBER);
$acl->add('TaskImport', '*', Role::PROJECT_MANAGER); $acl->add('TaskImport', '*', Role::PROJECT_MANAGER);
$acl->add('Tasklink', '*', Role::PROJECT_MEMBER); $acl->add('TaskInternalLink', '*', Role::PROJECT_MEMBER);
$acl->add('Tasklink', array('show'), Role::PROJECT_VIEWER);
$acl->add('TaskExternalLink', '*', Role::PROJECT_MEMBER); $acl->add('TaskExternalLink', '*', Role::PROJECT_MEMBER);
$acl->add('TaskExternalLink', array('show'), Role::PROJECT_VIEWER);
$acl->add('Taskmodification', '*', Role::PROJECT_MEMBER); $acl->add('Taskmodification', '*', Role::PROJECT_MEMBER);
$acl->add('Taskstatus', '*', Role::PROJECT_MEMBER); $acl->add('Taskstatus', '*', Role::PROJECT_MEMBER);
$acl->add('UserHelper', array('mention'), Role::PROJECT_MEMBER); $acl->add('UserHelper', array('mention'), Role::PROJECT_MEMBER);

View File

@@ -101,8 +101,6 @@ class RouteProvider implements ServiceProviderInterface
$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/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');
$container['route']->addRoute('project/:project_id/task/:task_id/internal/links', 'tasklink', 'show');
$container['route']->addRoute('project/:project_id/task/:task_id/external/links', 'TaskExternalLink', 'show');
// Exports // Exports
$container['route']->addRoute('export/tasks/:project_id', 'export', 'tasks'); $container['route']->addRoute('export/tasks/:project_id', 'export', 'tasks');

View File

@@ -6,7 +6,7 @@
<li><i class="fa fa-align-left fa-fw"></i>&nbsp;<?= $this->url->link(t('Change description'), 'taskmodification', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> <li><i class="fa fa-align-left fa-fw"></i>&nbsp;<?= $this->url->link(t('Change description'), 'taskmodification', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
<li><i class="fa fa-pencil-square-o fa-fw"></i>&nbsp;<?= $this->url->link(t('Edit this task'), 'taskmodification', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> <li><i class="fa fa-pencil-square-o fa-fw"></i>&nbsp;<?= $this->url->link(t('Edit this task'), 'taskmodification', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
<li><i class="fa fa-comment-o fa-fw"></i>&nbsp;<?= $this->url->link(t('Add a comment'), 'comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> <li><i class="fa fa-comment-o fa-fw"></i>&nbsp;<?= $this->url->link(t('Add a comment'), 'comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
<li><i class="fa fa-code-fork fa-fw"></i>&nbsp;<?= $this->url->link(t('Add a link'), 'tasklink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> <li><i class="fa fa-code-fork fa-fw"></i>&nbsp;<?= $this->url->link(t('Add a link'), 'TaskInternalLink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
<li><i class="fa fa-external-link fa-fw"></i>&nbsp;<?= $this->url->link(t('Add external link'), 'TaskExternalLink', 'find', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> <li><i class="fa fa-external-link fa-fw"></i>&nbsp;<?= $this->url->link(t('Add external link'), 'TaskExternalLink', 'find', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
<li><i class="fa fa-camera fa-fw"></i>&nbsp;<?= $this->url->link(t('Add a screenshot'), 'BoardPopover', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> <li><i class="fa fa-camera fa-fw"></i>&nbsp;<?= $this->url->link(t('Add a screenshot'), 'BoardPopover', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
<?php if ($task['is_active'] == 1): ?> <?php if ($task['is_active'] == 1): ?>

View File

@@ -21,7 +21,7 @@
</li> </li>
<li> <li>
<i class="fa fa-code-fork fa-fw"></i> <i class="fa fa-code-fork fa-fw"></i>
<?= $this->url->link(t('Add internal link'), 'tasklink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> <?= $this->url->link(t('Add internal link'), 'TaskInternalLink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
</li> </li>
<li> <li>
<i class="fa fa-external-link fa-fw"></i> <i class="fa fa-external-link fa-fw"></i>

View File

@@ -24,7 +24,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-subtask-url="<?= $this->url->href('subtask', 'create', 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-internal-link-url="<?= $this->url->href('tasklink', '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'])) ?>">
<?= $this->render($sidebar_template, array('task' => $task)) ?> <?= $this->render($sidebar_template, array('task' => $task)) ?>

View File

@@ -26,7 +26,7 @@
</li> </li>
<li> <li>
<i class="fa fa-code-fork fa-fw"></i> <i class="fa fa-code-fork fa-fw"></i>
<?= $this->url->link(t('Add internal link'), 'tasklink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?> <?= $this->url->link(t('Add internal link'), 'TaskInternalLink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
</li> </li>
<li> <li>
<i class="fa fa-external-link fa-fw"></i> <i class="fa fa-external-link fa-fw"></i>

View File

@@ -13,7 +13,7 @@
'editable' => false 'editable' => false
)) ?> )) ?>
<?= $this->render('tasklink/show', array( <?= $this->render('task_internal_link/show', array(
'task' => $task, 'task' => $task,
'links' => $links, 'links' => $links,
'project' => $project, 'project' => $project,

View File

@@ -19,7 +19,7 @@
)) ?> )) ?>
<?= $this->hook->render('template:task:show:before-internal-links', array('task' => $task, 'project' => $project)) ?> <?= $this->hook->render('template:task:show:before-internal-links', array('task' => $task, 'project' => $project)) ?>
<?= $this->render('tasklink/show', array( <?= $this->render('task_internal_link/show', array(
'task' => $task, 'task' => $task,
'links' => $internal_links, 'links' => $internal_links,
'project' => $project, 'project' => $project,

View File

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

View File

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

View File

@@ -2,7 +2,7 @@
<h2><?= t('Edit link') ?></h2> <h2><?= t('Edit link') ?></h2>
</div> </div>
<form action="<?= $this->url->href('tasklink', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'link_id' => $task_link['id'])) ?>" method="post" autocomplete="off"> <form action="<?= $this->url->href('TaskInternalLink', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'link_id' => $task_link['id'])) ?>" method="post" autocomplete="off">
<?= $this->form->csrf() ?> <?= $this->form->csrf() ?>
<?= $this->form->hidden('id', $values) ?> <?= $this->form->hidden('id', $values) ?>

View File

@@ -8,7 +8,7 @@
</p> </p>
<div class="form-actions"> <div class="form-actions">
<?= $this->url->link(t('Yes'), 'tasklink', 'remove', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), true, 'btn btn-red') ?> <?= $this->url->link(t('Yes'), 'TaskInternalLink', 'remove', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_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

@@ -3,7 +3,7 @@
<h3><a href="#" class="fa accordion-toggle"></a> <?= t('Internal links') ?></h3> <h3><a href="#" class="fa accordion-toggle"></a> <?= t('Internal links') ?></h3>
</div> </div>
<div class="accordion-content"> <div class="accordion-content">
<?= $this->render('tasklink/table', array( <?= $this->render('task_internal_link/table', array(
'links' => $links, 'links' => $links,
'task' => $task, 'task' => $task,
'project' => $project, 'project' => $project,

View File

@@ -72,8 +72,8 @@
<div class="dropdown"> <div class="dropdown">
<a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a> <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a>
<ul> <ul>
<li><?= $this->url->link(t('Edit'), 'tasklink', 'edit', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> <li><?= $this->url->link(t('Edit'), 'TaskInternalLink', 'edit', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
<li><?= $this->url->link(t('Remove'), 'tasklink', 'confirm', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li> <li><?= $this->url->link(t('Remove'), 'TaskInternalLink', 'confirm', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
</ul> </ul>
</div> </div>
</td> </td>