summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-02-15 19:35:28 -0500
committerFrederic Guillot <fred@kanboard.net>2015-02-15 19:35:28 -0500
commit321b1914ef1ee4d7e1a39d60fddd1151cb195f9c (patch)
treefede454cbf957df30cb0639c460a301e49bdfd34 /app
parent186f8ba840e5e6e00a96881a04bb7efdf3d8c7d4 (diff)
Display confirmation box to close task from the board and improve popover listeners
Diffstat (limited to 'app')
-rw-r--r--app/Controller/Task.php11
-rw-r--r--app/Core/Helper.php2
-rw-r--r--app/Template/board/task.php12
-rw-r--r--app/Template/board/task_footer.php2
-rw-r--r--app/Template/file/show.php2
-rw-r--r--app/Template/task/close.php4
6 files changed, 21 insertions, 12 deletions
diff --git a/app/Controller/Task.php b/app/Controller/Task.php
index e561d5f7..741db61e 100644
--- a/app/Controller/Task.php
+++ b/app/Controller/Task.php
@@ -251,6 +251,7 @@ class Task extends Base
public function close()
{
$task = $this->getTask();
+ $redirect = $this->request->getStringParam('redirect');
if ($this->request->getStringParam('confirmation') === 'yes') {
@@ -262,15 +263,23 @@ class Task extends Base
$this->session->flashError(t('Unable to close this task.'));
}
- if ($this->request->getStringParam('redirect') === 'board') {
+ if ($redirect === 'board') {
$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'])));
}
+ if ($this->request->isAjax()) {
+ $this->response->html($this->template->render('task/close', array(
+ 'task' => $task,
+ 'redirect' => $redirect,
+ )));
+ }
+
$this->response->html($this->taskLayout('task/close', array(
'task' => $task,
+ 'redirect' => $redirect,
)));
}
diff --git a/app/Core/Helper.php b/app/Core/Helper.php
index 57d1b98a..187fcfbb 100644
--- a/app/Core/Helper.php
+++ b/app/Core/Helper.php
@@ -666,7 +666,7 @@ class Helper
'subtaskRestriction',
array('task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'redirect' => $redirect),
false,
- 'popover-subtask-restriction'
+ 'popover'
);
}
diff --git a/app/Template/board/task.php b/app/Template/board/task.php
index 4c5a4252..a2a617a6 100644
--- a/app/Template/board/task.php
+++ b/app/Template/board/task.php
@@ -17,11 +17,11 @@
<li>
<a href="#" class="dropdown-menu"><?= '#'.$task['id'] ?></a>
<ul>
- <li><i class="fa fa-user"></i> <?= $this->a(t('Change assignee'), 'board', 'changeAssignee', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'assignee-popover') ?></li>
- <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, 'category-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-description-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-edit-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'], 'confirmation' => 'yes', 'redirect' => 'board'), true) ?></li>
+ <li><i class="fa fa-user"></i> <?= $this->a(t('Change assignee'), 'board', 'changeAssignee', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'task-board-popover') ?></li>
+ <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-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>
</li>
</ul>
@@ -39,7 +39,7 @@
'changeAssignee',
array('task_id' => $task['id'], 'project_id' => $task['project_id']),
false,
- 'assignee-popover',
+ 'task-board-popover',
t('Change assignee')
) ?>
</span>
diff --git a/app/Template/board/task_footer.php b/app/Template/board/task_footer.php
index 04d425e8..d413692c 100644
--- a/app/Template/board/task_footer.php
+++ b/app/Template/board/task_footer.php
@@ -7,7 +7,7 @@
'changeCategory',
array('task_id' => $task['id'], 'project_id' => $task['project_id']),
false,
- 'category-popover',
+ 'task-board-popover',
t('Change category')
) ?>
</span>
diff --git a/app/Template/file/show.php b/app/Template/file/show.php
index 179f5744..298976f6 100644
--- a/app/Template/file/show.php
+++ b/app/Template/file/show.php
@@ -11,7 +11,7 @@
<?= $this->a($this->e($file['name']), 'file', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
<span class="task-show-file-actions">
<?php if ($file['is_image']): ?>
- <?= $this->a(t('open'), 'file', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'file-popover') ?>,
+ <?= $this->a(t('open'), 'file', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?>,
<?php endif ?>
<?= $this->a(t('remove'), 'file', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
</span>
diff --git a/app/Template/task/close.php b/app/Template/task/close.php
index 316d58eb..a0a95787 100644
--- a/app/Template/task/close.php
+++ b/app/Template/task/close.php
@@ -8,8 +8,8 @@
</p>
<div class="form-actions">
- <?= $this->a(t('Yes'), 'task', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes'), true, 'btn btn-red') ?>
+ <?= $this->a(t('Yes'), 'task', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'confirmation' => 'yes', 'redirect' => $redirect), true, 'btn btn-red') ?>
<?= t('or') ?>
- <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
+ <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
</div>
</div> \ No newline at end of file