Merge and improve pull-request #704
This commit is contained in:
@@ -75,6 +75,7 @@ class Task extends Base
|
||||
'links' => $this->taskLink->getLinks($task['id']),
|
||||
'task' => $task,
|
||||
'values' => $values,
|
||||
'link_label_list' => $this->link->getList(0, false),
|
||||
'columns_list' => $this->board->getColumnsList($task['project_id']),
|
||||
'colors_list' => $this->color->getList(),
|
||||
'date_format' => $this->config->get('application_date_format'),
|
||||
|
||||
@@ -36,6 +36,7 @@ class Tasklink extends Base
|
||||
public function create(array $values = array(), array $errors = array())
|
||||
{
|
||||
$task = $this->getTask();
|
||||
$ajax = $this->request->isAjax() || $this->request->getIntegerParam('ajax');
|
||||
|
||||
if (empty($values)) {
|
||||
$values = array(
|
||||
@@ -43,6 +44,17 @@ class Tasklink extends Base
|
||||
);
|
||||
}
|
||||
|
||||
if ($ajax) {
|
||||
$this->response->html($this->template->render('tasklink/create', array(
|
||||
'values' => $values,
|
||||
'errors' => $errors,
|
||||
'task' => $task,
|
||||
'labels' => $this->link->getList(0, false),
|
||||
'title' => t('Add a new link'),
|
||||
'ajax' => $ajax,
|
||||
)));
|
||||
}
|
||||
|
||||
$this->response->html($this->taskLayout('tasklink/create', array(
|
||||
'values' => $values,
|
||||
'errors' => $errors,
|
||||
@@ -61,6 +73,7 @@ class Tasklink extends Base
|
||||
{
|
||||
$task = $this->getTask();
|
||||
$values = $this->request->getValues();
|
||||
$ajax = $this->request->isAjax() || $this->request->getIntegerParam('ajax');
|
||||
|
||||
list($valid, $errors) = $this->taskLink->validateCreation($values);
|
||||
|
||||
@@ -68,6 +81,9 @@ class Tasklink extends Base
|
||||
|
||||
if ($this->taskLink->create($values['task_id'], $values['opposite_task_id'], $values['link_id'])) {
|
||||
$this->session->flash(t('Link added successfully.'));
|
||||
if ($ajax) {
|
||||
$this->response->redirect($this->helper->url('board', 'show', array('project_id' => $task['project_id'])));
|
||||
}
|
||||
$this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links');
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Model;
|
||||
|
||||
use SimpleValidator\Validator;
|
||||
use SimpleValidator\Validators;
|
||||
use PicoDb\Table;
|
||||
|
||||
/**
|
||||
* TaskLink model
|
||||
@@ -57,6 +58,7 @@ class TaskLink extends Base
|
||||
->join(Link::TABLE, 'id', 'link_id')
|
||||
->join(Task::TABLE, 'id', 'opposite_task_id')
|
||||
->join(Board::TABLE, 'id', 'column_id', Task::TABLE)
|
||||
->orderBy(Link::TABLE.'.id ASC, '.Board::TABLE.'.position ASC, '.Task::TABLE.'.is_active DESC, '.Task::TABLE.'.id', Table::SORT_ASC)
|
||||
->findAll();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<li><i class="fa fa-tag"></i> <?= $this->a(t('Change category'), 'board', 'changeCategory', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li>
|
||||
<li><i class="fa fa-align-left"></i> <?= $this->a(t('Change description'), 'task', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li>
|
||||
<li><i class="fa fa-comment-o"></i> <?= $this->a(t('Add a comment'), 'comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li>
|
||||
<li><i class="fa fa-code-fork"></i> <?= $this->a(t('Add a link'), 'tasklink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li>
|
||||
<li><i class="fa fa-pencil-square-o"></i> <?= $this->a(t('Edit this task'), 'task', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li>
|
||||
<li><i class="fa fa-close"></i> <?= $this->a(t('Close this task'), 'task', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'redirect' => 'board'), false, 'task-board-popover') ?></li>
|
||||
</ul>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?= $this->render('task/details', array('task' => $task, 'project' => $project)) ?>
|
||||
<?= $this->render('task/time', array('task' => $task, 'values' => $values, 'date_format' => $date_format, 'date_formats' => $date_formats)) ?>
|
||||
<?= $this->render('task/show_description', array('task' => $task)) ?>
|
||||
<?= $this->render('tasklink/show', array('task' => $task, 'links' => $links)) ?>
|
||||
<?= $this->render('tasklink/show', array('task' => $task, 'links' => $links, 'link_label_list' => $link_label_list)) ?>
|
||||
<?= $this->render('subtask/show', array('task' => $task, 'subtasks' => $subtasks, 'project' => $project)) ?>
|
||||
<?= $this->render('task/timesheet', array('task' => $task)) ?>
|
||||
<?= $this->render('file/show', array('task' => $task, 'files' => $files, 'images' => $images)) ?>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<h2><?= t('Add a new link') ?></h2>
|
||||
</div>
|
||||
|
||||
<form action="<?= $this->u('tasklink', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post" autocomplete="off">
|
||||
<form action="<?= $this->u('tasklink', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'ajax' => isset($ajax))) ?>" method="post" autocomplete="off">
|
||||
|
||||
<?= $this->formCsrf() ?>
|
||||
<?= $this->formHidden('task_id', $values) ?>
|
||||
@@ -22,6 +22,10 @@
|
||||
<div class="form-actions">
|
||||
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
|
||||
<?= t('or') ?>
|
||||
<?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
|
||||
<?php if (isset($ajax)): ?>
|
||||
<?= $this->a(t('cancel'), 'board', 'show', array('project_id' => $task['project_id']), false, 'close-popover') ?>
|
||||
<?php else: ?>
|
||||
<?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</form>
|
||||
@@ -41,4 +41,24 @@
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</table>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (! isset($not_editable) && isset($link_label_list)): ?>
|
||||
<form action="<?= $this->u('tasklink', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post" autocomplete="off">
|
||||
|
||||
<?= $this->formCsrf() ?>
|
||||
<?= $this->formHidden('task_id', array('task_id' => $task['id'])) ?>
|
||||
<?= $this->formHidden('opposite_task_id', array()) ?>
|
||||
|
||||
<?= $this->formSelect('link_id', $link_label_list, array(), array()) ?>
|
||||
|
||||
<?= $this->formText(
|
||||
'title',
|
||||
array(),
|
||||
array(),
|
||||
array('required', 'data-dst-field="opposite_task_id"', 'data-search-url="'.$this->u('app', 'autocomplete', array('exclude_task_id' => $task['id'])).'"'),
|
||||
'task-autocomplete') ?>
|
||||
|
||||
<input type="submit" value="<?= t('Add') ?>" class="btn btn-blue"/>
|
||||
</form>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
|
||||
Reference in New Issue
Block a user