Add search in task title when using an integer only input
This commit is contained in:
parent
1983fc5f7a
commit
5b888a2345
|
|
@ -17,6 +17,7 @@ New features:
|
|||
|
||||
Improvements:
|
||||
|
||||
* Add search in task title when using an integer only input
|
||||
* Show all tasks when using no search criteria
|
||||
* Add column vertical scrolling
|
||||
* Set dynamically column height based on viewport size
|
||||
|
|
|
|||
|
|
@ -242,11 +242,11 @@ class TaskFilter extends Base
|
|||
*/
|
||||
public function filterByTitle($title)
|
||||
{
|
||||
if (strlen($title) > 1 && $title{0} === '#' && ctype_digit(substr($title, 1))) {
|
||||
$this->query->eq(Task::TABLE.'.id', substr($title, 1));
|
||||
}
|
||||
else if (ctype_digit($title)) {
|
||||
$this->query->eq(Task::TABLE.'.id', $title);
|
||||
if (ctype_digit($title) || (strlen($title) > 1 && $title{0} === '#' && ctype_digit(substr($title, 1)))) {
|
||||
$this->query->beginOr();
|
||||
$this->query->eq(Task::TABLE.'.id', str_replace('#', '', $title));
|
||||
$this->query->ilike(Task::TABLE.'.title', '%'.$title.'%');
|
||||
$this->query->closeOr();
|
||||
}
|
||||
else {
|
||||
$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: `#123` or `123`
|
||||
- Search by task title: anything that don't match any search attributes mentioned below
|
||||
- Search by task id: `#123`
|
||||
- Search by task id and task title: `123`
|
||||
- Search by task title: anything that don't match any search attributes
|
||||
|
||||
Search by status
|
||||
----------------
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ class TaskFilterTest extends Base
|
|||
$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' => 'task2')));
|
||||
$this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'task 43')));
|
||||
|
||||
$tf->search('#2');
|
||||
$tasks = $tf->findAll();
|
||||
|
|
@ -137,6 +138,12 @@ class TaskFilterTest extends Base
|
|||
$this->assertNotEmpty($tasks);
|
||||
$this->assertCount(1, $tasks);
|
||||
$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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue