Helper: admin/util/search

« All helpers

For use in conjunction with Model::where_search() and adding terms and exact matches to a search box on an admin screen.


{! admin/util/search !}

$(function () {
    $.search_init ({
        form: '#search-form',     // form selector
        query: '#search-query',   // query field selector
        links: '.search-for',     // selector to modify search via links
        options: '.search-option' // selector to modify search via select boxes

<form method="get" id="search-form">
    <input type="text" name="q" id="search-query" />

<a href="#" class="search-for" data-search="Foo">Foo</a>

<a href="#"
   data-search="company:&quot;Example Inc.&quot;">Example Inc.</a>

<select class="search-option" data-prefix="field">
    ...options for field:"value" searches...