forked from mdyd-dev/directory-structure
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuser_registration.liquid
More file actions
41 lines (39 loc) · 1.77 KB
/
user_registration.liquid
File metadata and controls
41 lines (39 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
name: user_registration
resource: User
fields:
first_name:
label: First Name # maciek: the question is - is there a value of having to define label per form configuration? I would assume
the main benefit of using this feature would be to define DRY up code, i.e. do not have to repeat label in all various forms which allow
user to edit first name. We have recently added possibility to add `metadata` to custom attributes, and it seems like a better place, because
it's globally attribute, not per form. Moreover, it will work only for one language; I think better way of handling labels, placeholders etc
would be to define metadata on custom attribute label to something like 'user.first_name' and then use `translations` feature to define the actual value
based on the current language.
Another way to look at this feature is to allow to not only provide `metadata` on attribute level, but also at form level as well, in which scenario it would look more like
```
first_name:
metadata:
label: First Name
custom_prop: Something
```
I am just not seeing proper use case for it. There are two issues with metadata on custom attribute currently:
1. We don't inject it to `form_builder` currently - something we want and need to do
2. It will be possible only for custom attributes, not system fields - but the long term plan is to remove necessity of using system fields anyway
validation:
- rule: not_empty
last_name:
label: Last Name
validation:
- rule: presence
error: '{{form.fields.last_name.label}} must be provided'
email:
label: Email
password:
label: Password
organization:
label: Organization
map: models/organization:name
validation:
- rule: presense
error: '{{form.fields.organization.label}} must be provided'
---