Add filters helper for search form

This commit is contained in:
Frederic Guillot
2015-07-04 14:23:45 -04:00
parent b01eb12a6c
commit cf8aeea6af
10 changed files with 115 additions and 25 deletions

View File

@@ -0,0 +1,21 @@
<div class="dropdown filters">
<span>
<i class="fa fa-caret-down"></i> <a href="#" class="dropdown-menu"><?= t('Filters') ?></a>
<ul>
<li><a href="#" class="filter-helper" data-filter="<?= isset($reset) ? $reset : '' ?>"><?= t('Reset filters') ?></a></li>
<li><a href="#" class="filter-helper" data-filter="status:open assignee:me"><?= t('My tasks') ?></a></li>
<li><a href="#" class="filter-helper" data-filter="status:open assignee:me due:tomorrow"><?= t('My tasks due tomorrow') ?></a></li>
<li><a href="#" class="filter-helper" data-filter="due:today"><?= t('Tasks due today') ?></a></li>
<li><a href="#" class="filter-helper" data-filter="due:tomorrow"><?= t('Tasks due tomorrow') ?></a></li>
<li><a href="#" class="filter-helper" data-filter="due:yesterday"><?= t('Tasks due yesterday') ?></a></li>
<li><a href="#" class="filter-helper" data-filter="status:closed"><?= t('Closed tasks') ?></a></li>
<li><a href="#" class="filter-helper" data-filter="status:open"><?= t('Open tasks') ?></a></li>
<li><a href="#" class="filter-helper" data-filter="assignee:nobody"><?= t('Not assigned') ?></a></li>
<li><a href="#" class="filter-helper" data-filter="category:none"><?= t('No category') ?></a></li>
<li>
<i class="fa fa-external-link"></i>
<a href="http://kanboard.net/documentation/search" target="_blank"><?= t('View advanced search syntax') ?></a>
</li>
</ul>
</span>
</div>

View File

@@ -1,9 +1,12 @@
<form method="get" action="?" autocomplete="off">
<?= $this->form->hidden('controller', array('controller' => 'search')) ?>
<?= $this->form->hidden('action', array('controller' => 'index')) ?>
<?= $this->form->text('search', array(), array(), array('placeholder="'.t('Search').'"'), 'form-input-large') ?>
<input type="submit" value="<?= t('Search') ?>" class="btn btn-blue"/>
</form>
<div class="search">
<form method="get" action="?" class="search">
<?= $this->form->hidden('controller', array('controller' => 'search')) ?>
<?= $this->form->hidden('action', array('controller' => 'index')) ?>
<?= $this->form->text('search', array(), array(), array('placeholder="'.t('Search').'"'), 'form-input-large') ?>
</form>
<?= $this->render('app/filters_helper') ?>
</div>
<?= $this->render('app/projects', array('paginator' => $project_paginator)) ?>
<?= $this->render('app/tasks', array('paginator' => $task_paginator)) ?>

View File

@@ -45,4 +45,5 @@
<?= $this->form->hidden('action', $filters) ?>
<?= $this->form->text('search', $filters, array(), array('placeholder="'.t('Filter').'"'), 'form-input-large') ?>
</form>
<?= $this->render('app/filters_helper', array('reset' => 'status:open')) ?>
</div>

View File

@@ -8,12 +8,15 @@
</ul>
</div>
<form method="get" action="?" autocomplete="off">
<?= $this->form->hidden('controller', $values) ?>
<?= $this->form->hidden('action', $values) ?>
<?= $this->form->text('search', $values, array(), array(empty($values['search']) ? 'autofocus' : '', 'required', 'placeholder="'.t('Search').'"'), 'form-input-large') ?>
<input type="submit" value="<?= t('Search') ?>" class="btn btn-blue"/>
</form>
<div class="search">
<form method="get" action="?" class="search">
<?= $this->form->hidden('controller', $values) ?>
<?= $this->form->hidden('action', $values) ?>
<?= $this->form->text('search', $values, array(), array(empty($values['search']) ? 'autofocus' : '', 'placeholder="'.t('Search').'"'), 'form-input-large') ?>
</form>
<?= $this->render('app/filters_helper') ?>
</div>
<?php if (empty($values['search'])): ?>
<div class="listing">
@@ -28,7 +31,7 @@
<li><?= t('Search by description: ') ?><strong>description:"Something to find"</strong></li>
<li><?= t('Search by due date: ') ?><strong>due:2015-07-01</strong></li>
</ul>
<p><a href="http://kanboard.net/documentation/search" target="_blank"><?= t('More examples in the documentation') ?></a></p>
<p><i class="fa fa-external-link fa-fw"></i><a href="http://kanboard.net/documentation/search" target="_blank"><?= t('More examples in the documentation') ?></a></p>
</div>
<?php elseif (! empty($values['search']) && $paginator->isEmpty()): ?>
<p class="alert"><?= t('Nothing found.') ?></p>