From 8b90ae3f35fa07c8dc8d4d51d1ddaa4ec58da054 Mon Sep 17 00:00:00 2001 From: Manon Bourgognon <manon.bourgognon@epitech.eu> Date: Fri, 8 Jan 2021 19:49:01 +0100 Subject: [PATCH] Add sorted-by mixin doc --- .../Mixins/sorter-mixin.rst | 30 +++++++++++++++++++ .../import_documentation/attributes-list.rst | 4 +++ 2 files changed, 34 insertions(+) diff --git a/source/import_documentation/Mixins/sorter-mixin.rst b/source/import_documentation/Mixins/sorter-mixin.rst index c6a4206..c5c4644 100644 --- a/source/import_documentation/Mixins/sorter-mixin.rst +++ b/source/import_documentation/Mixins/sorter-mixin.rst @@ -41,4 +41,34 @@ Attributes data-src="http://server/users/" fields="username" order-by-random + ></solid-display> + +``sorted-by`` +~~~~~~~~~~~~~ + + Target a ``<solid-form-search>`` used to provide several options for the user to sort current list of resource. + + The ``fields`` attribute of ``<solid-form-search>`` must at least contain ``field``. + ``Field`` attribute contains the fields of the resource to be offered to the user for sorting the data. + + ``Order`` attribute allows you to propose 2 sorting orders: ascending (``asc`) and descending (``desc``). + By default, the order is ascending. + + The ``<solid-display>`` cannot combine ``order-asc`` or ``order-desc`` attribute AND ``sorted-by`` attribute. + + example: + + .. code:: html + + <solid-form-search + id="my-sorter" + fields="field, order" + enum-field="username, email" + enum-order="ascending order = asc, descending order = desc" + ></solid-form-search> + + <solid-display + data-src="http://server/users" + fields="username, last_name, email" + sorted-by="my-sorter" ></solid-display> \ No newline at end of file diff --git a/source/import_documentation/attributes-list.rst b/source/import_documentation/attributes-list.rst index 1fde6c9..7f42901 100644 --- a/source/import_documentation/attributes-list.rst +++ b/source/import_documentation/attributes-list.rst @@ -192,6 +192,10 @@ List of attributes (core framework) ~~~~~~~~~~~~~~~~~~~~ * :ref:`required-mixin <required-mixin>` +``sorted-by`` +~~~~~~~~~~~~~~~ + * :ref:`sorter-mixin <sorter-mixin>` + ``start-value-[field]`` ~~~~~~~~~~~~~~~~~~~~~~~ * :ref:`solid-form-search <solid-form-search>` -- GitLab