Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
abidibo committed Feb 22, 2021
2 parents 8def866 + 0d71c7f commit d561ade
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,16 @@ With Baton you can optionally configure a search field in the sidebar above the

![Search field](docs/images/search-field.png)

This is an autocomplete field, which will calls a custom api at every keyup event (for strings of length > 3). Such api receives the `text` param in the querystring and should return a json response including the search results in the form:
With this functionality, you can configure a sidebar input search field with autocomplete functionality that can let you surf easily and quickly to any page you desire.

```
'SEARCH_FIELD': {
'label': 'Label shown as placeholder',
'url': '/api/path/',
},
```

The autocomplete field will call a custom api at every keyup event (for strings of length > 3). Such api receives the `text` param in the querystring and should return a json response including the search results in the form:

```
{
Expand All @@ -272,6 +281,9 @@ This is an autocomplete field, which will calls a custom api at every keyup even
}
```

In order to activate this functionality you should add the BATON configuration:


You should provide the results length and the data as an array of objects which must contain the `label` and `url` keys. The `icon` key is optional.

Let's see an example:
Expand Down
13 changes: 9 additions & 4 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,14 @@ Search Field

.. image:: images/search-field.png

With Baton you can optionally configure a search field in the sidebar above the menu.
With this functionality, you can configure a sidebar input search field with autocomplete functionality that can let you surf easily and quickly to any page you desire. ::

This is an autocomplete field, which will calls a custom api at every keyup event (for strings of length > 3). Such api receives the `text` param in the querystring and should return a json response including the search results in the form::
'SEARCH_FIELD': {
'label': 'Label shown as placeholder',
'url': '/api/path/',
},

The autocomplete field will call a custom api at every keyup event (for strings of length > 3). Such api receives the ``text`` param in the querystring and should return a json response including the search results in the form: ::

{
length: 2,
Expand All @@ -331,9 +336,9 @@ This is an autocomplete field, which will calls a custom api at every keyup even
]
}

You should provide the results length and the data as an array of objects which must contain the `label` and `url` keys. The `icon` key is optional.
You should provide the results length and the data as an array of objects which must contain the ``label`` and ``url`` keys. The ``icon`` key is optional.

Let's see an example::
Let's see an example: ::

@staff_member_required
def admin_search(request):
Expand Down

0 comments on commit d561ade

Please sign in to comment.