From 0d71c7f684a409fb19fd8cc11fbefc16807d81d7 Mon Sep 17 00:00:00 2001 From: abidibo Date: Mon, 22 Feb 2021 13:12:13 +0100 Subject: [PATCH] updates docs --- README.md | 14 +++++++++++++- docs/configuration.rst | 13 +++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3e943ea8..31be14da 100644 --- a/README.md +++ b/README.md @@ -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: ``` { @@ -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: diff --git a/docs/configuration.rst b/docs/configuration.rst index e04f5cb5..e9bc3c6c 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -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, @@ -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):