From 961ef9c28da1663d85e05ca10a85d015096a4879 Mon Sep 17 00:00:00 2001 From: Manon Bourgognon <manon.bourgognon@epitech.eu> Date: Thu, 18 Feb 2021 10:50:52 +0100 Subject: [PATCH 1/9] Add validationMixin documentation --- .../Components/Solid-Delete.rst | 5 +- .../Components/Solid-Form.rst | 19 +++--- .../Mixins/validation-mixin.rst | 66 +++++++++++++++++++ .../import_documentation/attributes-list.rst | 23 ++++++- 4 files changed, 101 insertions(+), 12 deletions(-) create mode 100644 source/import_documentation/Mixins/validation-mixin.rst diff --git a/source/import_documentation/Components/Solid-Delete.rst b/source/import_documentation/Components/Solid-Delete.rst index 0470de6..91be84d 100644 --- a/source/import_documentation/Components/Solid-Delete.rst +++ b/source/import_documentation/Components/Solid-Delete.rst @@ -33,7 +33,10 @@ Attributes ``confirmation-message`` ~~~~~~~~~~~~~~~~~~~~~~~~~ - Add this attribute to create a dialog box linked with the submit button of the solid-form. + *Available from version 0.13* + **Migrated to the validation mixin page in version 0.16** + + Add this attribute to create a dialog box linked with the button of the solid-delete. Its value matches the message displayed in the dialog box. diff --git a/source/import_documentation/Components/Solid-Form.rst b/source/import_documentation/Components/Solid-Form.rst index 7414c91..f74fdf6 100644 --- a/source/import_documentation/Components/Solid-Form.rst +++ b/source/import_documentation/Components/Solid-Form.rst @@ -29,7 +29,7 @@ Attributes List of the fields used to create the form (by default, all of them are used). ``label-[field]`` -~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~ When displaying a form, the default labels are the fields names of the model. If you want something fancier, you can set this attribute. i.e. ``label-username="Your name"`` @@ -41,7 +41,7 @@ Attributes display their own submit button. ``upload-url-[field]`` -~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~ URL to upload file for field ``[field]``, it automatically set ``widget-[field]`` to ``solid-form-file`` if net defined. It’s particularly useful with a dropdown field. @@ -51,13 +51,13 @@ Attributes Text of the submit button of the form. ``range-[field]`` -~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~ URL of a container which list the accepted values for the field ``[field]``. It’s particularly useful with a dropdown field. ``enum-[field]`` -~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~ *Available from version 0.13* List of values of your choice for the field ``[field]``. @@ -72,7 +72,7 @@ Attributes and "a", "b", "c" will be loaded in value attribute. ``order-asc-[field]`` or ``order-desc-[field]`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Name of the field used to order the range list ``[field]``. ``partial`` @@ -81,12 +81,12 @@ Attributes all the fields of the resource to update. ``min-[field]`` -~~~~~~~~~~~ +~~~~~~~~~~~~~~~ Add this attribute for the field ``[field]`` to define its minimum value. It works only with a ``solid-form-number`` widget. ``max-[field]`` -~~~~~~~~~~~ +~~~~~~~~~~~~~~~ Add this attribute for the field ``[field]`` to define its maximum value. It works only with a ``solid-form-number`` widget. @@ -98,15 +98,16 @@ Attributes It works only with a ``solid-form-text`` widget. ``title-[field]`` -~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~ *Available from version 0.13* Add this attribute for the field ``[field]`` to precise extra information about an element. It works only with a ``solid-form-text`` widget. ``confirmation-message`` -~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~ *Available from version 0.13* + **Migrated to the validation mixin page in version 0.16** Add this attribute to create a dialog box linked with the submit button of the solid-form. Its value matches the message displayed in the dialog box. diff --git a/source/import_documentation/Mixins/validation-mixin.rst b/source/import_documentation/Mixins/validation-mixin.rst new file mode 100644 index 0000000..e14d13b --- /dev/null +++ b/source/import_documentation/Mixins/validation-mixin.rst @@ -0,0 +1,66 @@ +.. _validation-mixin: +validation-mixin +================ +*Available from version 0.16* + +The validation mixin creates a modal dialog before deleting or submitting data. + +Used by: +-------- + + * :ref:`solid-delete <solid-delete>` + * :ref:`solid-form <solid-form>` + +Attributes +---------- + +``confirmation-type`` +~~~~~~~~~~~~~~~~~~~~~ + It is a prerequisite and can take two options : + + - ``confirm``: to access to a basic modal dialog. + - ``dialog``: to get a ``<dialog>`` more customizable. + +``confirmation-message`` +~~~~~~~~~~~~~~~~~~~~~~~~ + Message displayed in the modal dialog (``confirm`` or ``dialog`` type). + The message by default is "Please, confirm your choice". + + +**The attributes below only concern ``dialog`` type.** + +``confirmation-submit-text`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Text displayed on the submit button ("Ok" by default). + +``confirmation-cancel-text`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Text displayed on the cancel button ("Cancel" by default). + +``confirmation-submit-class`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Submit button class name (undefined by default). + +``confirmation-cancel-class`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Cancel button class name (undefined by default). + + + Some examples of the use of validation mixin attributes : + + .. code:: html + + <solid-delete + data-src="http://server/user/" + confirmation-type="confirm" + confirmation-message="Thank you to confirm the data deletion." + ></solid-delete> + + <solid-form + data-src="../data/list/events.jsonld" + confirmation-type="dialog" + confirmation-message="Are you sure you want to create this event ?" + confirmation-submit-text="Yes, I am" + confirmation-submit-class="submit-button" + confirmation-cancel-class="cancel-button" + ></solid-form> \ No newline at end of file diff --git a/source/import_documentation/attributes-list.rst b/source/import_documentation/attributes-list.rst index 5da3c35..369b60e 100644 --- a/source/import_documentation/attributes-list.rst +++ b/source/import_documentation/attributes-list.rst @@ -30,10 +30,29 @@ List of attributes (core framework) ~~~~~~~~~~~~~~ * :ref:`solid-map <solid-map>` +``confirmation-cancel-text`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * :ref:`validation-mixin <validation-mixin>` + +``confirmation-cancel-class`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * :ref:`validation-mixin <validation-mixin>` + ``confirmation-message`` ~~~~~~~~~~~~~~~~~~~~~~~~ - * :ref:`solid-form <solid-form>` - * :ref:`solid-delete <solid-delete>` + * :ref:`validation-mixin <validation-mixin>` + +``confirmation-type`` +~~~~~~~~~~~~~~~~~~~~~ + * :ref:`validation-mixin <validation-mixin>` + +``confirmation-submit-class`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * :ref:`validation-mixin <validation-mixin>` + +``confirmation-submit-text`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * :ref:`validation-mixin <validation-mixin>` ``counter-template`` ~~~~~~~~~~~~~~~~~~~~ -- GitLab From cb496cf389a4f3ae676b8c78d82dd0f1246eee13 Mon Sep 17 00:00:00 2001 From: Manon Bourgognon <manon.bourgognon@epitech.eu> Date: Fri, 19 Feb 2021 10:50:04 +0100 Subject: [PATCH 2/9] Add validationMixin ref in solid-delete, s-form --- source/import_documentation/Components/Solid-Delete.rst | 1 + source/import_documentation/Components/Solid-Form.rst | 1 + 2 files changed, 2 insertions(+) diff --git a/source/import_documentation/Components/Solid-Delete.rst b/source/import_documentation/Components/Solid-Delete.rst index 91be84d..44c8733 100644 --- a/source/import_documentation/Components/Solid-Delete.rst +++ b/source/import_documentation/Components/Solid-Delete.rst @@ -16,6 +16,7 @@ Mixins This component uses the following mixin: * :ref:`next-mixin <next-mixin>` + * :ref:`validation-mixin <validation-mixin>` Please check their documentation to know more about its capabilities. diff --git a/source/import_documentation/Components/Solid-Form.rst b/source/import_documentation/Components/Solid-Form.rst index f74fdf6..da988a6 100644 --- a/source/import_documentation/Components/Solid-Form.rst +++ b/source/import_documentation/Components/Solid-Form.rst @@ -17,6 +17,7 @@ Mixins This component uses the following mixins: * :ref:`next-mixin <next-mixin>` * :ref:`store-mixin <store-mixin>` + * :ref:`validation-mixin <validation-mixin>` * :ref:`widget-mixin <widget-mixin>` Please check their documentation to know more about their capabilities. -- GitLab From 9d366bf2bfecb95b1b554b60388ee64c9a88e809 Mon Sep 17 00:00:00 2001 From: Manon Bourgognon <manon.bourgognon@epitech.eu> Date: Wed, 24 Feb 2021 15:54:26 +0100 Subject: [PATCH 3/9] solid-form-time widget addition --- source/import_documentation/Components/Solid-Form.rst | 11 +++++++++-- source/import_documentation/Widgets/Reference.rst | 1 + source/import_documentation/attributes-list.rst | 4 ++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/source/import_documentation/Components/Solid-Form.rst b/source/import_documentation/Components/Solid-Form.rst index da988a6..65a0446 100644 --- a/source/import_documentation/Components/Solid-Form.rst +++ b/source/import_documentation/Components/Solid-Form.rst @@ -84,12 +84,12 @@ Attributes ``min-[field]`` ~~~~~~~~~~~~~~~ Add this attribute for the field ``[field]`` to define its minimum value. - It works only with a ``solid-form-number`` widget. + It works only with ``solid-form-number`` and ``solid-form-time`` widgets. ``max-[field]`` ~~~~~~~~~~~~~~~ Add this attribute for the field ``[field]`` to define its maximum value. - It works only with a ``solid-form-number`` widget. + It works only with ``solid-form-number`` and ``solid-form-time`` widgets. ``pattern-[field]`` ~~~~~~~~~~~~~~~ @@ -127,6 +127,13 @@ Attributes If the attribute is defined, each change in an input will trigger a request to update the resource. This attribute works only when editing resources, not creating them. +``step-[field]`` +~~~~~~~~~~~~~~~~ + *Available from version 0.16* + + Add this attribute for the field ``[field]`` to define the stepping interval number to use as constraint validation . Its value is given in seconds (default value is 60). + It works only with a ``solid-form-time`` widget. + Widgets ------- By default, the widget used is ``<solid-form-label-text>``. Cf the diff --git a/source/import_documentation/Widgets/Reference.rst b/source/import_documentation/Widgets/Reference.rst index 537daab..43f6fb8 100644 --- a/source/import_documentation/Widgets/Reference.rst +++ b/source/import_documentation/Widgets/Reference.rst @@ -58,6 +58,7 @@ Name of the template to use. Available templates: - ``image``: Works like ``file`` but allow only images in the input, and create a preview of the image when selected by the user. - ``color``: set ``value`` in an ``<input>`` of type ``color``. - ``password``: set ``value`` in an ``<input>`` of type ``password``. + - ``time``: set ``value`` in an ``<input>`` of type ``time``. The format value is ``hh:mm``. - ``set`` diff --git a/source/import_documentation/attributes-list.rst b/source/import_documentation/attributes-list.rst index 369b60e..a796c1d 100644 --- a/source/import_documentation/attributes-list.rst +++ b/source/import_documentation/attributes-list.rst @@ -231,6 +231,10 @@ List of attributes (core framework) ~~~~~~~~~~~~~~~~~~~~~~~ * :ref:`solid-form-search <solid-form-search>` +``step-[field]`` +~~~~~~~~~~~~~~~~ + * :ref:`solid-form <solid-form>` + ``(search-fields)`` deprecated ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * :ref:`filter-mixin <filter-mixin>` -- GitLab From 578e2a00a29a892a995e6b1a0c306ef10612eb6b Mon Sep 17 00:00:00 2001 From: Manon Bourgognon <manon.bourgognon@epitech.eu> Date: Wed, 24 Feb 2021 19:05:01 +0100 Subject: [PATCH 4/9] Add maxlength attribute for textarea --- source/import_documentation/Components/Solid-Form.rst | 5 +++++ source/import_documentation/attributes-list.rst | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/source/import_documentation/Components/Solid-Form.rst b/source/import_documentation/Components/Solid-Form.rst index da988a6..64fb256 100644 --- a/source/import_documentation/Components/Solid-Form.rst +++ b/source/import_documentation/Components/Solid-Form.rst @@ -127,6 +127,11 @@ Attributes If the attribute is defined, each change in an input will trigger a request to update the resource. This attribute works only when editing resources, not creating them. +``maxlength-[field]`` +~~~~~~~~~~~~~~~~~~~~~ + Add this attribute for the field ``[field]`` to define the maximum number of characters that can be typed. + It works only with a ``solid-form-textarea`` widget. + Widgets ------- By default, the widget used is ``<solid-form-label-text>``. Cf the diff --git a/source/import_documentation/attributes-list.rst b/source/import_documentation/attributes-list.rst index 369b60e..59ee4b4 100644 --- a/source/import_documentation/attributes-list.rst +++ b/source/import_documentation/attributes-list.rst @@ -141,6 +141,10 @@ List of attributes (core framework) ``max-[field]`` ~~~~~~~~~~~~~~~ * :ref:`solid-form <solid-form>` + +``maxlength-[field]`` +~~~~~~~~~~~~~~~~~~~~~ + * :ref:`solid-form <solid-form>` ``min-[field]`` ~~~~~~~~~~~~~~~ -- GitLab From 9006cbade6c1460ae0d915034d7c2306932535d8 Mon Sep 17 00:00:00 2001 From: Manon Bourgognon <manon.bourgognon@epitech.eu> Date: Thu, 25 Feb 2021 14:47:36 +0100 Subject: [PATCH 5/9] Add minlength and widgets also concerned --- source/import_documentation/Components/Solid-Form.rst | 7 ++++++- source/import_documentation/attributes-list.rst | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/source/import_documentation/Components/Solid-Form.rst b/source/import_documentation/Components/Solid-Form.rst index 64fb256..c955ea2 100644 --- a/source/import_documentation/Components/Solid-Form.rst +++ b/source/import_documentation/Components/Solid-Form.rst @@ -130,7 +130,12 @@ Attributes ``maxlength-[field]`` ~~~~~~~~~~~~~~~~~~~~~ Add this attribute for the field ``[field]`` to define the maximum number of characters that can be typed. - It works only with a ``solid-form-textarea`` widget. + It works only with ``<input type="text">``, ``solid-form-email`` or ``solid-form-password`` and ``solid-form-textarea`` widgets. + +``minlength-[field]`` +~~~~~~~~~~~~~~~~~~~~~ + Add this attribute for the field ``[field]`` to define the minimum number of characters that can be typed. + It works only with ``<input type="text">``, ``solid-form-email`` or ``solid-form-password`` and ``solid-form-textarea`` widgets. Widgets ------- diff --git a/source/import_documentation/attributes-list.rst b/source/import_documentation/attributes-list.rst index 59ee4b4..d01feec 100644 --- a/source/import_documentation/attributes-list.rst +++ b/source/import_documentation/attributes-list.rst @@ -150,6 +150,10 @@ List of attributes (core framework) ~~~~~~~~~~~~~~~ * :ref:`solid-form <solid-form>` +``minlength-[field]`` +~~~~~~~~~~~~~~~~~~~~~ + * :ref:`solid-form <solid-form>` + ``multiple-[field]`` ~~~~~~~~~~~~~~~~~~~~ * :ref:`widget-mixin <widget-mixin>` -- GitLab From 732b28da531b6387e07d95b7ed9264e3c91642a5 Mon Sep 17 00:00:00 2001 From: Manon Bourgognon <manon.bourgognon@epitech.eu> Date: Thu, 25 Feb 2021 15:41:14 +0100 Subject: [PATCH 6/9] add minlength and maxlength version --- source/import_documentation/Components/Solid-Form.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/import_documentation/Components/Solid-Form.rst b/source/import_documentation/Components/Solid-Form.rst index c955ea2..c909459 100644 --- a/source/import_documentation/Components/Solid-Form.rst +++ b/source/import_documentation/Components/Solid-Form.rst @@ -129,11 +129,15 @@ Attributes ``maxlength-[field]`` ~~~~~~~~~~~~~~~~~~~~~ + *Available from version 0.16* + Add this attribute for the field ``[field]`` to define the maximum number of characters that can be typed. It works only with ``<input type="text">``, ``solid-form-email`` or ``solid-form-password`` and ``solid-form-textarea`` widgets. ``minlength-[field]`` ~~~~~~~~~~~~~~~~~~~~~ + *Available from version 0.16* + Add this attribute for the field ``[field]`` to define the minimum number of characters that can be typed. It works only with ``<input type="text">``, ``solid-form-email`` or ``solid-form-password`` and ``solid-form-textarea`` widgets. -- GitLab From 7c4f197ad8d1019ea3bb37172fa2c31143dc9dbb Mon Sep 17 00:00:00 2001 From: Manon Bourgognon <manon.bourgognon@epitech.eu> Date: Thu, 25 Feb 2021 16:14:02 +0100 Subject: [PATCH 7/9] Add step attribute for solid-form-number widget --- source/import_documentation/Components/Solid-Form.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/import_documentation/Components/Solid-Form.rst b/source/import_documentation/Components/Solid-Form.rst index 65a0446..fe5c1e6 100644 --- a/source/import_documentation/Components/Solid-Form.rst +++ b/source/import_documentation/Components/Solid-Form.rst @@ -131,8 +131,10 @@ Attributes ~~~~~~~~~~~~~~~~ *Available from version 0.16* - Add this attribute for the field ``[field]`` to define the stepping interval number to use as constraint validation . Its value is given in seconds (default value is 60). - It works only with a ``solid-form-time`` widget. + Add this attribute for the field ``[field]`` to define the stepping interval number to use as constraint validation. Its based on the ``min-[field]`` value. + It works with : + - ``solid-form-time`` widget : Its value is given in seconds (default value is 60). + - ``solid-form-number`` widget : Its default value is 1. Widgets ------- -- GitLab From a01570e611d54d19b516b4d3a75174fb89c75a7a Mon Sep 17 00:00:00 2001 From: Manon Bourgognon <manon.bourgognon@epitech.eu> Date: Mon, 1 Mar 2021 11:21:02 +0100 Subject: [PATCH 8/9] add default-widget-[field] --- source/import_documentation/Mixins/widget-mixin.rst | 4 ++++ source/import_documentation/attributes-list.rst | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/source/import_documentation/Mixins/widget-mixin.rst b/source/import_documentation/Mixins/widget-mixin.rst index 06afbdd..083585f 100644 --- a/source/import_documentation/Mixins/widget-mixin.rst +++ b/source/import_documentation/Mixins/widget-mixin.rst @@ -85,6 +85,10 @@ Attributes ~~~~~~~~~~~~~~~~~~ The widget to use for all the fields, except if a specific one is defined for a field. +``default-widget-[field]`` +~~~~~~~~~~~~~~~~~~~~~~~~~~ + The widget displayed by default if the ``[field]`` is empty. + ``action-[field]`` ~~~~~~~~~~~~~~~~~~ Displays a link with a ``<solid-link>`` tag with the current resource as ``data-src`` and the value of the attribute as ``next``. diff --git a/source/import_documentation/attributes-list.rst b/source/import_documentation/attributes-list.rst index a796c1d..04bfa6f 100644 --- a/source/import_documentation/attributes-list.rst +++ b/source/import_documentation/attributes-list.rst @@ -75,6 +75,10 @@ List of attributes (core framework) ~~~~~~~~~~~~~~~~~~ * :ref:`widget-mixin <widget-mixin>` +``default-widget-[field]`` +~~~~~~~~~~~~~~~~~~~~~~~~~~ + * :ref:`widget-mixin <widget-mixin>` + ``editable-[field]`` ~~~~~~~~~~~~~~~~~~~~ * :ref:`widget-mixin <widget-mixin>` -- GitLab From f6fe1fc907d95221102f807dd7a3f91725b18953 Mon Sep 17 00:00:00 2001 From: Manon Bourgognon <manon.bourgognon@epitech.eu> Date: Mon, 1 Mar 2021 11:36:13 +0100 Subject: [PATCH 9/9] maxlength and minlength correction --- source/import_documentation/Components/Solid-Form.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/import_documentation/Components/Solid-Form.rst b/source/import_documentation/Components/Solid-Form.rst index c909459..0dc68bd 100644 --- a/source/import_documentation/Components/Solid-Form.rst +++ b/source/import_documentation/Components/Solid-Form.rst @@ -132,14 +132,14 @@ Attributes *Available from version 0.16* Add this attribute for the field ``[field]`` to define the maximum number of characters that can be typed. - It works only with ``<input type="text">``, ``solid-form-email`` or ``solid-form-password`` and ``solid-form-textarea`` widgets. + It works only with ``solid-form-text``, ``solid-form-email`` or ``solid-form-password`` and ``solid-form-textarea`` widgets. ``minlength-[field]`` ~~~~~~~~~~~~~~~~~~~~~ *Available from version 0.16* Add this attribute for the field ``[field]`` to define the minimum number of characters that can be typed. - It works only with ``<input type="text">``, ``solid-form-email`` or ``solid-form-password`` and ``solid-form-textarea`` widgets. + It works only with ``solid-form-text``, ``solid-form-email`` or ``solid-form-password`` and ``solid-form-textarea`` widgets. Widgets ------- -- GitLab