summaryrefslogtreecommitdiff
path: root/app/Controller/App.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-02-14 16:11:13 -0500
committerFrederic Guillot <fred@kanboard.net>2015-02-14 16:11:13 -0500
commitf7e4c3928aba9cb7f5222cb4af67846312bbb435 (patch)
tree78f5854a0bdc538c977bad718a11d605a4caaca6 /app/Controller/App.php
parent364382b1b58db8bf1bd2c8866e21c869a7a5d6d0 (diff)
Refactoring/simplification of the pull-request about links
Diffstat (limited to 'app/Controller/App.php')
-rw-r--r--app/Controller/App.php29
1 files changed, 22 insertions, 7 deletions
diff --git a/app/Controller/App.php b/app/Controller/App.php
index ef0a08a9..46731e7c 100644
--- a/app/Controller/App.php
+++ b/app/Controller/App.php
@@ -2,7 +2,8 @@
namespace Controller;
-use Model\Subtask as SubTaskModel;
+use Model\Subtask as SubtaskModel;
+use Model\Task as TaskModel;
/**
* Application controller
@@ -39,7 +40,7 @@ class App extends Base
*/
public function index($user_id = 0, $action = 'index')
{
- $status = array(SubTaskModel::STATUS_TODO, SubTaskModel::STATUS_INPROGRESS);
+ $status = array(SubTaskModel::STATUS_TODO, SubtaskModel::STATUS_INPROGRESS);
$user_id = $user_id ?: $this->userSession->getId();
$projects = $this->projectPermission->getActiveMemberProjects($user_id);
$project_ids = array_keys($projects);
@@ -88,11 +89,8 @@ class App extends Base
if (empty($payload['text'])) {
$this->response->html('<p>'.t('Nothing to preview...').'</p>');
}
- else {
- $this->response->html(
- $this->template->markdown($payload['text'])
- );
- }
+
+ $this->response->html($this->template->markdown($payload['text']));
}
/**
@@ -104,4 +102,21 @@ class App extends Base
{
$this->response->css($this->color->getCss());
}
+
+ /**
+ * Task autocompletion (Ajax)
+ *
+ * @access public
+ */
+ public function autocomplete()
+ {
+ $this->response->json(
+ $this->taskFilter
+ ->create()
+ ->filterByProjects($this->projectPermission->getActiveMemberProjectIds($this->userSession->getId()))
+ ->excludeTasks(array($this->request->getIntegerParam('exclude_task_id')))
+ ->filterByTitle($this->request->getStringParam('term'))
+ ->toAutoCompletion()
+ );
+ }
}