1
1
# Directus conditional fields
2
2
3
- ![ Directus conditional fields] ( https://raw.githubusercontent.com/lucasfrey/directus-conditional-fields/master/directus-conditional-fields.gif " Directus conditional fields")
3
+ Conditional fields is a custom extension that allow you to hide and show fields in a collection
4
4
5
- Conditional fields is a custom extension that allow you to hide and show fields in a collection called ` block ` (for now).
6
- In order to work, you will need to create a collection with these parameters:
5
+ ![ Directus conditional fields] ( https://raw.githubusercontent.com/lucasfrey/directus-conditional-fields/master/directus-conditional-fields.gif " Directus conditional fields ")
7
6
7
+ # Usage
8
8
### Type dropdown
9
- The ` type ` dropdown will host the event listener that will trigger the hide and show fields
10
-
11
- ### Fields naming convention
9
+ Add a ` type ` dropdown that will host the event listener and will trigger the hide and show fields
10
+ e.g:
11
+ Type:
12
+ - editorial
13
+ - image
14
+ - quote
15
+ - ...
16
+
17
+ ### Field naming convention
12
18
Once you have setup your type field, you need to name your fields like the above
13
-
14
- * NOTE:* currently the collection fields need to be named ` block ` , but we could easily update that in the future
19
+ (example with a collection named ` blocks ` , with ` blocks ` , you will need to start your field name with the singular ` block ` )
15
20
16
21
| collection | type | field |
17
22
| ------------| -----------| ---------|
@@ -23,10 +28,12 @@ Once you have setup your type field, you need to name your fields like the above
23
28
With that config, if you select the type ` editorial ` in the dropdown, only the ` text ` and ` intro ` fields will appear on the screen.
24
29
25
30
### Import conditional-fields into the collection
26
- Once you have setup your fields, you can then just add the conditional-fields field so the javascript can do his job on the administration page.
31
+ Once you have setup your fields, you can then just add the ` conditional-fields ` field so the javascript can do his job on the administration page.
32
+ * NOTE* : you will have to name the field ` conditional-fields `
27
33
34
+ And that's it !
28
35
29
- ## Usage
36
+ ## Build
30
37
If you update this module, don't forget to run the production build like this :
31
38
32
39
```
0 commit comments