summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Controller/TaskMovePositionController.php43
-rw-r--r--app/Formatter/BoardColumnFormatter.php1
-rw-r--r--app/Formatter/BoardSwimlaneFormatter.php1
-rw-r--r--app/Template/task/sidebar.php16
-rw-r--r--app/Template/task_move_position/show.php43
5 files changed, 99 insertions, 5 deletions
diff --git a/app/Controller/TaskMovePositionController.php b/app/Controller/TaskMovePositionController.php
new file mode 100644
index 00000000..0db742c3
--- /dev/null
+++ b/app/Controller/TaskMovePositionController.php
@@ -0,0 +1,43 @@
+<?php
+
+namespace Kanboard\Controller;
+
+use Kanboard\Formatter\BoardFormatter;
+
+/**
+ * Class TaskMovePositionController
+ *
+ * @package Kanboard\Controller
+ * @author Frederic Guillot
+ */
+class TaskMovePositionController extends BaseController
+{
+ public function show()
+ {
+ $task = $this->getTask();
+
+ $this->response->html($this->template->render('task_move_position/show', array(
+ 'task' => $task,
+ 'board' => BoardFormatter::getInstance($this->container)
+ ->withProjectId($task['project_id'])
+ ->withQuery($this->taskFinderModel->getExtendedQuery())
+ ->format()
+ )));
+ }
+
+ public function save()
+ {
+ $task = $this->getTask();
+ $values = $this->request->getJson();
+
+ $result = $this->taskPositionModel->movePosition(
+ $task['project_id'],
+ $task['id'],
+ $values['column_id'],
+ $values['position'],
+ $values['swimlane_id']
+ );
+
+ $this->response->json(array('result' => $result));
+ }
+}
diff --git a/app/Formatter/BoardColumnFormatter.php b/app/Formatter/BoardColumnFormatter.php
index d49a577a..85d31b5c 100644
--- a/app/Formatter/BoardColumnFormatter.php
+++ b/app/Formatter/BoardColumnFormatter.php
@@ -78,6 +78,7 @@ class BoardColumnFormatter extends BaseFormatter implements FormatterInterface
public function format()
{
foreach ($this->columns as &$column) {
+ $column['id'] = (int) $column['id'];
$column['tasks'] = BoardTaskFormatter::getInstance($this->container)
->withTasks($this->tasks)
->withTags($this->tags)
diff --git a/app/Formatter/BoardSwimlaneFormatter.php b/app/Formatter/BoardSwimlaneFormatter.php
index c2abb444..9b2ad935 100644
--- a/app/Formatter/BoardSwimlaneFormatter.php
+++ b/app/Formatter/BoardSwimlaneFormatter.php
@@ -81,6 +81,7 @@ class BoardSwimlaneFormatter extends BaseFormatter implements FormatterInterface
$nb_columns = count($this->columns);
foreach ($this->swimlanes as &$swimlane) {
+ $swimlane['id'] = (int) $swimlane['id'];
$swimlane['columns'] = BoardColumnFormatter::getInstance($this->container)
->withSwimlaneId($swimlane['id'])
->withColumns($this->columns)
diff --git a/app/Template/task/sidebar.php b/app/Template/task/sidebar.php
index 728741ba..de0750ff 100644
--- a/app/Template/task/sidebar.php
+++ b/app/Template/task/sidebar.php
@@ -78,15 +78,21 @@
<i class="fa fa-clone fa-fw"></i>
<?= $this->url->link(t('Move to another project'), 'TaskDuplicationController', 'move', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
</li>
- <li>
- <?php if ($task['is_active'] == 1): ?>
+ <?php if ($task['is_active'] == 1): ?>
+ <li>
+ <i class="fa fa-arrows fa-fw"></i>
+ <?= $this->url->link(t('Move position'), 'TaskMovePositionController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
+ </li>
+ <li>
<i class="fa fa-times fa-fw"></i>
<?= $this->url->link(t('Close this task'), 'TaskStatusController', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
- <?php else: ?>
+ </li>
+ <?php else: ?>
+ <li>
<i class="fa fa-check-square-o fa-fw"></i>
<?= $this->url->link(t('Open this task'), 'TaskStatusController', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
- <?php endif ?>
- </li>
+ </li>
+ <?php endif ?>
<?php if ($this->user->canRemoveTask($task)): ?>
<li>
<i class="fa fa-trash-o fa-fw"></i>
diff --git a/app/Template/task_move_position/show.php b/app/Template/task_move_position/show.php
new file mode 100644
index 00000000..29e1bcb1
--- /dev/null
+++ b/app/Template/task_move_position/show.php
@@ -0,0 +1,43 @@
+<div class="page-header">
+ <h2><?= t('Move task to another position on the board') ?></h2>
+</div>
+
+<script type="x/templates" id="template-task-move-position">
+ <?= $this->form->label(t('Swimlane'), 'swimlane') ?>
+ <select v-model="swimlaneId" @change="onChangeSwimlane()" id="form-swimlane">
+ <option v-for="swimlane in board" v-bind:value="swimlane.id">
+ {{ swimlane.name }}
+ </option>
+ </select>
+
+ <div v-if="columns.length > 0">
+ <?= $this->form->label(t('Column'), 'column') ?>
+ <select v-model="columnId" @change="onChangeColumn()" id="form-column">
+ <option v-for="column in columns" v-bind:value="column.id">
+ {{ column.title }}
+ </option>
+ </select>
+ </div>
+
+ <div v-if="tasks.length > 0">
+ <?= $this->form->label(t('Position'), 'position') ?>
+ <select v-model="position" id="form-position">
+ <option v-for="task in tasks" v-bind:value="task.position">
+ #{{ task.id }} - {{ task.title }}
+ </option>
+ </select>
+ <label><input type="radio" value="before" v-model="positionChoice"><?= t('Insert before this task') ?></label>
+ <label><input type="radio" value="after" v-model="positionChoice"><?= t('Insert after this task') ?></label>
+ </div>
+
+ <div class="form-actions">
+ <input type="button" value="<?= t('Save') ?>" class="btn btn-blue" @click="onSubmit">
+ <?= t('or') ?>
+ <?= $this->url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
+ </div>
+</script>
+
+<task-move-position
+ save-url="<?= $this->url->href('TaskMovePositionController', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"
+ :board='<?= json_encode($board, JSON_HEX_APOS) ?>'
+></task-move-position>