Use popover to edit task and description directly from board.
- Click on 'description' icon opens the 'edit-description' page. - Edit task and edit description now open in popover, like the assign dialog.
This commit is contained in:
@@ -162,17 +162,24 @@ class Task extends Base
|
|||||||
|
|
||||||
$task['score'] = $task['score'] ?: '';
|
$task['score'] = $task['score'] ?: '';
|
||||||
|
|
||||||
$this->response->html($this->template->layout('task_edit', array(
|
$params = array(
|
||||||
'values' => $task,
|
'values' => $task,
|
||||||
'errors' => array(),
|
'errors' => array(),
|
||||||
'task' => $task,
|
'task' => $task,
|
||||||
'columns_list' => $this->board->getColumnsList($task['project_id']),
|
'columns_list' => $this->board->getColumnsList($task['project_id']),
|
||||||
'users_list' => $this->project->getUsersList($task['project_id']),
|
'users_list' => $this->project->getUsersList($task['project_id']),
|
||||||
'colors_list' => $this->task->getColors(),
|
'colors_list' => $this->task->getColors(),
|
||||||
'categories_list' => $this->category->getList($task['project_id']),
|
'categories_list' => $this->category->getList($task['project_id']),
|
||||||
'menu' => 'tasks',
|
'ajax' => $this->request->isAjax(),
|
||||||
'title' => t('Edit a task')
|
'menu' => 'tasks',
|
||||||
)));
|
'title' => t('Edit a task')
|
||||||
|
);
|
||||||
|
if ($this->request->isAjax()) {
|
||||||
|
$this->response->html($this->template->load('task_edit', $params));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->response->html($this->template->layout('task_edit', $params));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -191,7 +198,13 @@ class Task extends Base
|
|||||||
|
|
||||||
if ($this->task->update($values)) {
|
if ($this->task->update($values)) {
|
||||||
$this->session->flash(t('Task updated successfully.'));
|
$this->session->flash(t('Task updated successfully.'));
|
||||||
$this->response->redirect('?controller=task&action=show&task_id='.$values['id']);
|
|
||||||
|
if ($this->request->getIntegerParam('ajax')) {
|
||||||
|
$this->response->redirect('?controller=board&action=show&project_id='.$task['project_id']);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->response->redirect('?controller=task&action=show&task_id='.$values['id']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->session->flashError(t('Unable to update your task.'));
|
$this->session->flashError(t('Unable to update your task.'));
|
||||||
@@ -357,13 +370,20 @@ class Task extends Base
|
|||||||
{
|
{
|
||||||
$task = $this->getTask();
|
$task = $this->getTask();
|
||||||
|
|
||||||
$this->response->html($this->taskLayout('task_edit_description', array(
|
$params = array(
|
||||||
'values' => $task,
|
'values' => $task,
|
||||||
'errors' => array(),
|
'errors' => array(),
|
||||||
'task' => $task,
|
'task' => $task,
|
||||||
'menu' => 'tasks',
|
'ajax' => $this->request->isAjax(),
|
||||||
'title' => t('Edit the description')
|
'menu' => 'tasks',
|
||||||
)));
|
'title' => t('Edit the description')
|
||||||
|
);
|
||||||
|
if ($this->request->isAjax()) {
|
||||||
|
$this->response->html($this->template->load('task_edit_description', $params));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->response->html($this->taskLayout('task_edit_description', $params));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -387,7 +407,12 @@ class Task extends Base
|
|||||||
$this->session->flashError(t('Unable to update your task.'));
|
$this->session->flashError(t('Unable to update your task.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->response->redirect('?controller=task&action=show&task_id='.$task['id']);
|
if ($this->request->getIntegerParam('ajax')) {
|
||||||
|
$this->response->redirect('?controller=board&action=show&project_id='.$task['project_id']);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->response->redirect('?controller=task&action=show&task_id='.$task['id']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->response->html($this->taskLayout('task_edit_description', array(
|
$this->response->html($this->taskLayout('task_edit_description', array(
|
||||||
|
|||||||
@@ -20,13 +20,13 @@
|
|||||||
|
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
|
||||||
<a href="?controller=task&action=edit&task_id=<?= $task['id'] ?>" title="<?= t('Edit this task') ?>">#<?= $task['id'] ?></a> -
|
<a class="task-board-popover" href="?controller=task&action=edit&task_id=<?= $task['id'] ?>" title="<?= t('Edit this task') ?>">#<?= $task['id'] ?></a> -
|
||||||
|
|
||||||
<span class="task-board-user">
|
<span class="task-board-user">
|
||||||
<?php if (! empty($task['owner_id'])): ?>
|
<?php if (! empty($task['owner_id'])): ?>
|
||||||
<a href="?controller=board&action=assign&task_id=<?= $task['id'] ?>" title="<?= t('Change assignee') ?>"><?= t('Assigned to %s', $task['username']) ?></a>
|
<a class="task-board-popover" href="?controller=board&action=assign&task_id=<?= $task['id'] ?>" title="<?= t('Change assignee') ?>"><?= t('Assigned to %s', $task['username']) ?></a>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<a href="?controller=board&action=assign&task_id=<?= $task['id'] ?>" title="<?= t('Change assignee') ?>" class="task-board-nobody"><?= t('Nobody assigned') ?></a>
|
<a class="task-board-popover" href="?controller=board&action=assign&task_id=<?= $task['id'] ?>" title="<?= t('Change assignee') ?>" class="task-board-nobody"><?= t('Nobody assigned') ?></a>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
@@ -69,8 +69,8 @@
|
|||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if (! empty($task['description'])): ?>
|
<?php if (! empty($task['description'])): ?>
|
||||||
<i class="fa fa-file-text-o" title="<?= t('Description') ?>"></i>
|
<a class="task-board-popover" href='?controller=task&action=editDescription&task_id=<?= $task['id'] ?>'><i class="fa fa-file-text-o" title="<?= t('Description') ?>"></i></a>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
<section id="main">
|
<section id="main">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h2><?= t('Edit a task') ?></h2>
|
<h2><?= t('Edit a task') ?></h2>
|
||||||
|
<?php if (!$ajax): ?>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="?controller=board&action=show&project_id=<?= $task['project_id'] ?>"><?= t('Back to the board') ?></a></li>
|
<li><a href="?controller=board&action=show&project_id=<?= $task['project_id'] ?>"><?= t('Back to the board') ?></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<?php endif ?>
|
||||||
</div>
|
</div>
|
||||||
<section>
|
<section>
|
||||||
<form method="post" action="?controller=task&action=update&task_id=<?= $task['id'] ?>" autocomplete="off">
|
<form method="post" action="?controller=task&action=update&task_id=<?= $task['id'] ?>&ajax=<?= $ajax ?>" autocomplete="off">
|
||||||
|
|
||||||
<?= Helper\form_csrf() ?>
|
<?= Helper\form_csrf() ?>
|
||||||
|
|
||||||
@@ -47,7 +49,12 @@
|
|||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
|
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
|
||||||
<?= t('or') ?> <a href="?controller=task&action=show&task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a>
|
<?= t('or') ?>
|
||||||
|
<?php if ($ajax): ?>
|
||||||
|
<a href="?controller=board&action=show&project_id=<?= $task['project_id'] ?>"><?= t('cancel') ?></a>
|
||||||
|
<?php else: ?>
|
||||||
|
<a href="?controller=task&action=show&task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a>
|
||||||
|
<?php endif ?>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<h2><?= t('Edit the description') ?></h2>
|
<h2><?= t('Edit the description') ?></h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form method="post" action="?controller=task&action=saveDescription&task_id=<?= $task['id'] ?>" autocomplete="off">
|
<form method="post" action="?controller=task&action=saveDescription&task_id=<?= $task['id'] ?>&ajax=<?= $ajax ?>" autocomplete="off">
|
||||||
|
|
||||||
<?= Helper\form_csrf() ?>
|
<?= Helper\form_csrf() ?>
|
||||||
|
|
||||||
@@ -13,6 +13,11 @@
|
|||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
|
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
|
||||||
<?= t('or') ?>
|
<?= t('or') ?>
|
||||||
|
<?php if ($ajax): ?>
|
||||||
|
<a href="?controller=board&action=show&project_id=<?= $task['project_id'] ?>"><?= t('cancel') ?></a>
|
||||||
|
<?php else: ?>
|
||||||
<a href="?controller=task&action=show&task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a>
|
<a href="?controller=task&action=show&task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a>
|
||||||
|
<?php endif ?>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
@@ -15,14 +15,14 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Open assignee popover
|
// Open assignee popover
|
||||||
$(".task-board-user a").click(function(e) {
|
$(".task-board-popover").click(function(e) {
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
var taskId = $(this).parent().parent().attr("data-task-id");
|
var href = $(this).attr('href');
|
||||||
|
|
||||||
$.get("?controller=board&action=assign&task_id=" + taskId, function(data) {
|
$.get(href, function(data) {
|
||||||
popover_show(data);
|
popover_show(data);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user