objects: add compact quicksearch element

This commit is contained in:
Thomas Gelf 2016-03-20 13:18:55 +01:00
parent 7cd77c75ba
commit 4f219992d8
3 changed files with 47 additions and 2 deletions

View File

@ -1,11 +1,12 @@
<?php if (! $this->compact): ?>
<div class="controls">
<?= $this->tabs ?>
<h1><?= $this->escape($this->title) ?></h1>
<h1><?= $this->escape($this->title) ?><?= $this->quickSearch ?></h1>
<span data-base-target="_next">
<?= $this->addLink ?>
</span>
<?php if (count($table) || ($this->filterEditor && ! $this->filterEditor->getFilter()->isEmpty())): ?>
<?php if ($this->filterEditor && ! $this->filterEditor->getFilter()->isEmpty()): ?>
<?= $this->filterEditor ?>
<?php endif ?>
<?= $this->table->getPaginator() ?>

View File

@ -156,6 +156,21 @@ abstract class ActionController extends Controller
return $this->view->tabs;
}
protected function provideQuickSearch()
{
$htm = '<form action="%s" class="quicksearch inline" method="post">'
. '<input type="text" name="q" value="" placeholder="%s" class="search" />'
. '</form>';
$this->view->quickSearch = sprintf(
$htm,
$this->getRequest()->getUrl()->without('q')->without('page'),
$this->translate('Search...')
);
return $this;
}
protected function setViewScript($name)
{
$this->_helper->viewRenderer->setNoController(true);

View File

@ -184,6 +184,35 @@ input[type=text], input[type=password], textarea, select {
}
}
form.quicksearch {
float: right;
input.search {
width: 8em;
min-width: auto;
border: none;
background-size: 0.75em auto;
background-position: 0.5em 0.75em;
padding-left: 1.5em;
&:focus {
width: 16em;
.transition(width 0.5s ease);
border: none;
}
}
}
h1 form.quicksearch {
font-size: 0.75em;
font-weight: normal;
padding-left: 1em;
float: none;
}
#layout.twocols h1 form.quicksearch {
float: right;
}
ul.extensible-set {
margin: 0;
padding: 0;