[WIP] Adding documentation for fields

This commits adds the doc regarding those fields:
- EmailField
- PercentageField
- PhoneField
- UrlField
This commit is contained in:
luvi 2021-11-25 12:06:45 +01:00
parent 1898da3e85
commit 0ea53d6a0d

View File

@ -128,6 +128,10 @@ Reference List
- `datetime`
- `datetime`
- description...
* - :ref:`EmailField <frontend/fields/email_field>`
- `text`
- `char`
- display email addresses
* - :ref:`HandleField <frontend/fields/handle_field>`
- `handle`
- `integer`
@ -148,6 +152,14 @@ Reference List
- `many2one`
- `many2one`
- description...
* - :ref:`PercentageField <frontend/fields/percentage_field>`
- `text`
- `float`
- display percentages
* - :ref:`PhoneField <frontend/fields/phone_field>`
- `text`
- `char`, `integer`
- display phone numbers
* - :ref:`PriorityField <frontend/fields/priority_field>`
- `priority`
- `selection`
@ -176,6 +188,10 @@ Reference List
- `text`
- `html`, `text`
- description...
* - :ref:`UrlField <frontend/fields/url_field>`
- `text`
- `char`
- display URLs
.. _frontend/fields/boolean_favorite_field:
@ -268,6 +284,18 @@ DateTimeField
- Technical name: `datetime`
- Supported types: `datetime`
.. _frontend/fields/email_field:
EmailField
----------
- Location: `@web/fields/email_field`
- Technical name: `email`
- Supported types: `char`
The `EmailField` component represents a textual value containing an email address. The field
is an input with the `email` type in edit mode, and a link with an `href` in readonly mode with
the `mailto:` prefix. It opens an email application if available whenever a click is made by the user.
.. _frontend/fields/handle_field:
@ -318,6 +346,34 @@ Many2OneField
- Technical name: `many2one`
- Supported types: `many2one`
.. _frontend/fields/percentage_field:
PercentageField
---------------
- Location: `@web/fields/percentage_field`
- Technical name: `percentage`
- Supported types: `float`
The `PercentageField` component represents a percentage. To use the field, you must give a
float value. Then, the field will format and display the value to a percentage, using a single
decimal (e.g. `0.5671` would be converted to `56.7%`). When the user enters the edit mode, the
value is still visible as a percentage, but the inner value is not rounded this time. In the
end, the value is always saved as a float value.
.. _frontend/fields/phone_field:
PhoneField
----------
- Location: `@web/fields/phone_field`
- Technical name: `phone`
- Supported types: `char`, `integer`
The `PhoneField` component represents a phone number. This field is used as
an input with the `phone` type in edit mode, and a link with an `href` in readonly mode.
The link contains the `tel:` prefix which means that it starts a call to the given number
whenever a user clicks on it.
.. _frontend/fields/priority_field:
@ -369,7 +425,7 @@ StatInfoField
- Supported types: `float`, `integer`
.. _frontend/fields/status_field:
.. _frontend/fields/statusbar_field:
StatusBarField
--------------
@ -387,3 +443,30 @@ TextField
- Location: `@web/fields/text_field`
- Technical name: `text`
- Supported types: `html`, `text`
.. _frontend/fields/url_field:
UrlField
--------
- Location: `@web/fields/url_field`
- Technical name: `url`
- Supported types: `char`
The `UrlField` component represents a URL. That field
has a text input in edit mode, and a link with an `href` to the given value. By default,
the URL value is displayed when the view is readonly, but if an other value is given as
the `text` attribute, the link will display the given value instead.
It supports the following options:
.. list-table::
:widths: 20 20 60
:header-rows: 1
* - Name
- Type
- Description
* - `website_path`
- `boolean`
- optional. if `true`, the href will be the exact given value. No prefix will be added to format the URL