Add search in task title when using an integer only input
This commit is contained in:
@@ -17,6 +17,7 @@ New features:
|
|||||||
|
|
||||||
Improvements:
|
Improvements:
|
||||||
|
|
||||||
|
* Add search in task title when using an integer only input
|
||||||
* Show all tasks when using no search criteria
|
* Show all tasks when using no search criteria
|
||||||
* Add column vertical scrolling
|
* Add column vertical scrolling
|
||||||
* Set dynamically column height based on viewport size
|
* Set dynamically column height based on viewport size
|
||||||
|
|||||||
@@ -242,11 +242,11 @@ class TaskFilter extends Base
|
|||||||
*/
|
*/
|
||||||
public function filterByTitle($title)
|
public function filterByTitle($title)
|
||||||
{
|
{
|
||||||
if (strlen($title) > 1 && $title{0} === '#' && ctype_digit(substr($title, 1))) {
|
if (ctype_digit($title) || (strlen($title) > 1 && $title{0} === '#' && ctype_digit(substr($title, 1)))) {
|
||||||
$this->query->eq(Task::TABLE.'.id', substr($title, 1));
|
$this->query->beginOr();
|
||||||
}
|
$this->query->eq(Task::TABLE.'.id', str_replace('#', '', $title));
|
||||||
else if (ctype_digit($title)) {
|
$this->query->ilike(Task::TABLE.'.title', '%'.$title.'%');
|
||||||
$this->query->eq(Task::TABLE.'.id', $title);
|
$this->query->closeOr();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->query->ilike(Task::TABLE.'.title', '%'.$title.'%');
|
$this->query->ilike(Task::TABLE.'.title', '%'.$title.'%');
|
||||||
|
|||||||
@@ -15,8 +15,9 @@ assigne:me due:tomorrow my title
|
|||||||
Search by task id or title
|
Search by task id or title
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
- Search by task id: `#123` or `123`
|
- Search by task id: `#123`
|
||||||
- Search by task title: anything that don't match any search attributes mentioned below
|
- Search by task id and task title: `123`
|
||||||
|
- Search by task title: anything that don't match any search attributes
|
||||||
|
|
||||||
Search by status
|
Search by status
|
||||||
----------------
|
----------------
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ class TaskFilterTest extends Base
|
|||||||
$this->assertEquals(1, $p->create(array('name' => 'test')));
|
$this->assertEquals(1, $p->create(array('name' => 'test')));
|
||||||
$this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'task1')));
|
$this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'task1')));
|
||||||
$this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'task2')));
|
$this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'task2')));
|
||||||
|
$this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'task 43')));
|
||||||
|
|
||||||
$tf->search('#2');
|
$tf->search('#2');
|
||||||
$tasks = $tf->findAll();
|
$tasks = $tf->findAll();
|
||||||
@@ -137,6 +138,12 @@ class TaskFilterTest extends Base
|
|||||||
$this->assertNotEmpty($tasks);
|
$this->assertNotEmpty($tasks);
|
||||||
$this->assertCount(1, $tasks);
|
$this->assertCount(1, $tasks);
|
||||||
$this->assertEquals('task1', $tasks[0]['title']);
|
$this->assertEquals('task1', $tasks[0]['title']);
|
||||||
|
|
||||||
|
$tf->search('43');
|
||||||
|
$tasks = $tf->findAll();
|
||||||
|
$this->assertNotEmpty($tasks);
|
||||||
|
$this->assertCount(1, $tasks);
|
||||||
|
$this->assertEquals('task 43', $tasks[0]['title']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSearchWithReference()
|
public function testSearchWithReference()
|
||||||
|
|||||||
Reference in New Issue
Block a user