summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authordalmond <david.almond@f-grp.com>2016-08-17 12:20:12 +0100
committerDavid Almond <david.almond@f-grp.com>2016-08-17 12:51:59 +0100
commit5c685a2a78aea236153fb051ae9615ff0fe6e4a8 (patch)
treeb8ee97e5984ff13ec11d582bc5a53e9e01836ff3 /app
parent98efcf21e355ed6ac3827058b99df86ca67c75bb (diff)
Automatic Actions now support Swimlanes
Diffstat (limited to 'app')
-rw-r--r--app/Controller/ActionController.php1
-rw-r--r--app/Controller/ActionCreationController.php1
-rw-r--r--app/Core/Event/EventManager.php1
-rw-r--r--app/Model/ActionParameterModel.php5
-rw-r--r--app/ServiceProvider/ActionProvider.php4
-rw-r--r--app/Template/action/index.php2
-rw-r--r--app/Template/action_creation/params.php7
7 files changed, 18 insertions, 3 deletions
diff --git a/app/Controller/ActionController.php b/app/Controller/ActionController.php
index 097640f6..c935125a 100644
--- a/app/Controller/ActionController.php
+++ b/app/Controller/ActionController.php
@@ -33,6 +33,7 @@ class ActionController extends BaseController
'colors_list' => $this->colorModel->getList(),
'categories_list' => $this->categoryModel->getList($project['id']),
'links_list' => $this->linkModel->getList(0, false),
+ 'swimlane_list' => $this->swimlaneModel->getList($project['id']),
'title' => t('Automatic actions')
)));
}
diff --git a/app/Controller/ActionCreationController.php b/app/Controller/ActionCreationController.php
index 9b228f28..1629e68f 100644
--- a/app/Controller/ActionCreationController.php
+++ b/app/Controller/ActionCreationController.php
@@ -84,6 +84,7 @@ class ActionCreationController extends BaseController
'priorities_list' => $this->projectTaskPriorityModel->getPriorities($project),
'project' => $project,
'available_actions' => $this->actionManager->getAvailableActions(),
+ 'swimlane_list' => $this->swimlaneModel->getList($project['id']),
'events' => $this->actionManager->getCompatibleEvents($values['action_name']),
)));
}
diff --git a/app/Core/Event/EventManager.php b/app/Core/Event/EventManager.php
index 9ae43170..68e81a9e 100644
--- a/app/Core/Event/EventManager.php
+++ b/app/Core/Event/EventManager.php
@@ -53,6 +53,7 @@ class EventManager
TaskModel::EVENT_CREATE_UPDATE => t('Task creation or modification'),
TaskModel::EVENT_ASSIGNEE_CHANGE => t('Task assignee change'),
TaskModel::EVENT_DAILY_CRONJOB => t('Daily background job for tasks'),
+ TaskModel::EVENT_MOVE_SWIMLANE => t('Move a task to another swimlane'),
);
$events = array_merge($events, $this->events);
diff --git a/app/Model/ActionParameterModel.php b/app/Model/ActionParameterModel.php
index 9895da0f..d4d45178 100644
--- a/app/Model/ActionParameterModel.php
+++ b/app/Model/ActionParameterModel.php
@@ -157,7 +157,10 @@ class ActionParameterModel extends Base
case 'user_id':
case 'owner_id':
return $this->projectPermissionModel->isAssignable($project_id, $value) ? $value : false;
- default:
+ case 'swimlane_id':
+ $column = $this->swimlaneModel->getById($value);
+ return empty($column) ? false : $this->swimlaneModel->getIdByName($project_id, $column['name']) ?: false;
+ default:
return $value;
}
}
diff --git a/app/ServiceProvider/ActionProvider.php b/app/ServiceProvider/ActionProvider.php
index 946fbf41..d46562b7 100644
--- a/app/ServiceProvider/ActionProvider.php
+++ b/app/ServiceProvider/ActionProvider.php
@@ -36,6 +36,8 @@ use Kanboard\Action\TaskOpen;
use Kanboard\Action\TaskUpdateStartDate;
use Kanboard\Action\TaskCloseNoActivity;
use Kanboard\Action\TaskCloseNoActivityColumn;
+use Kanboard\Action\TaskAssignColorSwimlane;
+use Kanboard\Action\TaskAssignPrioritySwimlane;
/**
* Action Provider
@@ -86,6 +88,8 @@ class ActionProvider implements ServiceProviderInterface
$container['actionManager']->register(new TaskOpen($container));
$container['actionManager']->register(new TaskUpdateStartDate($container));
$container['actionManager']->register(new TaskAssignDueDateOnCreation($container));
+ $container['actionManager']->register(new TaskAssignColorSwimlane($container));
+ $container['actionManager']->register(new TaskAssignPrioritySwimlane($container));
return $container;
}
diff --git a/app/Template/action/index.php b/app/Template/action/index.php
index 0a94e4f0..7140dc85 100644
--- a/app/Template/action/index.php
+++ b/app/Template/action/index.php
@@ -54,6 +54,8 @@
<?= $this->text->in($param_value, $categories_list) ?>
<?php elseif ($this->text->contains($param_name, 'link_id')): ?>
<?= $this->text->in($param_value, $links_list) ?>
+ <?php elseif ($this->text->contains($param_name, 'swimlane_id')): ?>
+ <?= $this->text->in($param_value, $swimlane_list) ?>
<?php else: ?>
<?= $this->text->e($param_value) ?>
<?php endif ?>
diff --git a/app/Template/action_creation/params.php b/app/Template/action_creation/params.php
index fa892177..bcf863d7 100644
--- a/app/Template/action_creation/params.php
+++ b/app/Template/action_creation/params.php
@@ -41,10 +41,13 @@
<?php elseif ($this->text->contains($param_name, 'duration')): ?>
<?= $this->form->label($param_desc, $param_name) ?>
<?= $this->form->number('params['.$param_name.']', $values) ?>
- <?php else: ?>
+ <?php elseif ($this->text->contains($param_name, 'swimlane_id')): ?>
+ <?= $this->form->label($param_desc, $param_name) ?>
+ <?= $this->form->select('params['.$param_name.']', $swimlane_list, $values) ?>
+ <?php else: ?>
<?= $this->form->label($param_desc, $param_name) ?>
<?= $this->form->text('params['.$param_name.']', $values) ?>
- <?php endif ?>
+ <?php endif ?>
<?php endforeach ?>
<div class="form-actions">