Newer
Older
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
Common widgets
--------------
Here is a few examples of widgets use. First, there is the HTML using Startin'blox and then, the displayed result in a webpage.
All the values from ``<solid-display>`` are displayed with and without widget.
solid-display-img
~~~~~~~~~~~~~~~~~
.. code:: html
<solid-display
data-src="data/list/user-1.jsonld"
fields="notimage, image"
value-notimage="https://images.unsplash.com/photo-1621359729423-dcbdbac348fb?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80"
value-image="https://images.unsplash.com/photo-1621359729423-dcbdbac348fb?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80"
widget-image="solid-display-img"
alt-image="pink flowers"
></solid-display>
.. figure:: ../../_static/images/import_documentation/widgets-examples/widget-img.png
:alt: Widget solid-display-img
solid-display-link
~~~~~~~~~~~~~~~~~~
.. code:: html
<solid-display
data-src="data/list/user-1.jsonld"
fields="notlink, link"
value-notlink="https://startinblox.com/fr/"
value-link="https://startinblox.com/fr/"
widget-link="solid-display-link"
></solid-display>
.. figure:: ../../_static/images/import_documentation/widgets-examples/widget-link.png
:alt: Widget solid-display-link
solid-display-link-mailto
~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: html
<solid-display
data-src="data/list/user-5.jsonld"
fields="email"
></solid-display>
<solid-display
data-src="data/list/user-5.jsonld"
fields="email"
widget-email="solid-display-link-mailto"
></solid-display>
.. figure:: ../../_static/images/import_documentation/widgets-examples/widget-mailto.png
:alt: Widget solid-display-link-mailto
solid-display-value-date
~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: html
<solid-display
data-src="data/list/event-1.jsonld"
fields="date"
></solid-display>
<solid-display
data-src="data/list/event-1.jsonld"
fields="date"
widget-date="solid-display-value-date"
></solid-display>
.. figure:: ../../_static/images/import_documentation/widgets-examples/widget-date.png
:alt: Widget solid-display-value-date
solid-form-radio
~~~~~~~~~~~~~~~~
range attribute
.. code:: html
<solid-form
data-src="data/list/event-1.jsonld"
fields="contact"
widget-contact="solid-form-radio"
range-contact="data/list/users.jsonld"
></solid-form>
.. figure:: ../../_static/images/import_documentation/widgets-examples/widget-radio.png
:alt: Widget solid-form-radio
solid-form-dropdown
~~~~~~~~~~~~~~~~~~~
enum attribute
.. code:: html
<solid-form
data-src="data/list/event-1.jsonld"
fields="personnes"
widget-personnes="solid-form-dropdown"
enum-personnes="Sacha, Camille, Charlie, Lou"
></solid-form>
.. figure:: ../../_static/images/import_documentation/widgets-examples/widget-dropdown.png
:alt: Widget solid-form-dropdown
solid-form-textarea-label
~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: html
<solid-form
data-src="data/list/event-1.jsonld"
fields="description"
widget-description="solid-form-textarea-label"
></solid-form>
.. figure:: ../../_static/images/import_documentation/widgets-examples/widget-textarea.png
:alt: Widget solid-form-textarea-label
solid-form-text-placeholder
~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code:: html
<solid-form
data-src="./data/list/users.jsonld"
fields="first_name"
widget-first_name="solid-form-text-placeholder"
placeholder-first_name="Enter your name"
></solid-form>
.. figure:: ../../_static/images/import_documentation/widgets-examples/widget-placeholder.png
:alt: Widget solid-form-text-placehoder
solid-form-text-label
~~~~~~~~~~~~~~~~~~~~~
.. code:: html
<solid-form
data-src="./data/list/users.jsonld"
fields="first_name"
widget-first_name="solid-form-text-label"
label-first_name="First name :"
></solid-form>
.. figure:: ../../_static/images/import_documentation/widgets-examples/widget-label.png
:alt: Widget solid-form-text-label
solid-set-div
~~~~~~~~~~~~~
.. code:: html
<solid-display
data-src="data/list/users.jsonld"
fields="name(first_name, ' - ' ,last_name, ' - ', username)"
widget-name="solid-set-div"
></solid-display>
.. figure:: ../../_static/images/import_documentation/widgets-examples/widget-set.png
:alt: Widget solid-set-div
*The border is applied on solid-set-div*
A classic example of solid-action use is a list of resources (users here) with only one field displayed and the possibility to access additionnal informations by clicking on "User details" :
.. code:: html
<solid-display
data-src="data/list/users.jsonld"
fields="name, details"
value-details="User details"
label-name="Name :"
widget-name="solid-display-value-label"
></solid-display>
.. figure:: ../../_static/images/import_documentation/widgets-examples/widget-action.png
:alt: Basic solid-display
This is the solid-display with action attribute and link-text-[field] attribute use to replace the basic value-[field] from above.
.. code:: html
<solid-display
data-src="data/list/users.jsonld"
fields="name, details"
label-name="Name :"
widget-name="solid-display-value-label"
action-details="user-details"
link-text-details="User details"
></solid-display>
.. figure:: ../../_static/images/import_documentation/widgets-examples/widget-action2.png
By adding a router, a route and another view, clicking on the solid-action displays the view (dotted border):
.. code:: html
<solid-router use-hash>
<solid-route
hidden
use-id
></solid-route>
</solid-router>
<solid-display
data-src="data/list/users.jsonld"
fields="name, details"
label-name="Name :"
widget-name="solid-display-value-label"
action-details="user-details"
link-text-details="User details"
fields="first_name, last_name, username, email"
.. figure:: ../../_static/images/import_documentation/widgets-examples/widget-action3.png
:alt: Widget solid-action with view
Step-by-step widget creation
----------------------------
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
Create your widget
~~~~~~~~~~~~~~~~~~
To display a field in a ``div`` tag, create your widget like this:
- ``solid-``: all the widgets of the core start with ``solid`` keyword
- ``display-``: to use the display directory of templates
- ``div``: to use the ``div`` template
Which gives us:
.. code:: html
<solid-display
bind-resource
fields="name"
widget-name="solid-display-div"
></solid-display>
This code generates:
.. code:: html
<solid-display
bind-resource
fields="name"
widget-name="solid-display-div"
>
<!-- auto generated part -->
<div>
<solid-display-div name="name" value="John Doe">
<div name="name">John Doe</div>
</solid-display-div>
</div>
<!-- /auto generated part -->
</solid-display>
Add a feature
~~~~~~~~~~~~~~~
If you want to add a label, just add ``-label`` to your widget name
.. code:: html
<solid-display
bind-resource
fields="name"
widget-name="solid-display-div-label"
>
<!-- auto generated part -->
<div>
<solid-display-div-label name="name" value="John Doe">
<label>name</label>
<div name="name">John Doe</div>
</solid-display-div-label>
</div>
<!-- /auto generated part -->
</solid-display>
Mix keyword order
~~~~~~~~~~~~~~~~~
You can mix the order of the keywords, for the same result. For example, you can replace ``solid-display-div-label`` by ``solid-label-div-display``:
.. warning::
Be careful because the generated widget will also have the name you give him. It can also have impact on CSS if you target widgets by their names.
.. code:: html
<solid-display
bind-resource
fields="name"
widget-name="solid-label-div-display"
>
<!-- auto generated part -->
<div>
<solid-label-div-display name="name" value="John Doe">
<label>name</label>
<div name="name">John Doe</div>
</solid-label-div-display>
</div>
<!-- /auto generated part -->
</solid-display>
Customize the label
~~~~~~~~~~~~~~~~~~~
To customize the label, you can set the ``label-name`` attribute on the ``solid-display``
.. code:: html
<solid-display
bind-resource
fields="name"
widget-name="solid-label-div-display"
label-name="User name:"
>
<!-- auto generated part -->
<div>
<solid-label-div-display name="name" value="John Doe">
<label>User name:</label>
<div name="name">John Doe</div>
</solid-label-div-display>
</div>
<!-- /auto generated part -->
</solid-display>
Handle multiples
~~~~~~~~~~~~~~~~
In the case of a form, you may have to handle a field where you need to add or delete values. It can be done like this:
.. code:: html
<solid-form
bind-user
fields="skills"
multiple-skills
></solid-form>
As ``skills`` is a container, you will see each line as a text input, containing the id of the resource.
You will also have the ability to add or remove lines. The default multiple widget used is ``solid-form-multiple``.
Add a dropdown
~~~~~~~~~~~~~~
If you want to limit the selection of the skills to a list, add a ``range-skills`` attribute.
.. code:: html
<solid-form
bind-user
fields="skills"
multiple-skills
range-skills="http://ldpserver/skills"
></solid-form>
Your text inputs will be replaced by dropdowns showing the available options.
Customize the multiple widget
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you need to have only one dropdown to select multiple values, you can change the multiple widget:
.. code:: html
<solid-form
bind-user
fields="skills"
multiple-skills="solid-form-multipleselect"
range-skills="http://ldpserver/skills"
></solid-form>
Like for other widgets, you can choose to add features by adding them to the widget name.
The following example will add a label before the widget, and initialize the SlimSelect plugin used for autocompletion.
.. code:: html
<solid-form
bind-user
fields="skills"
multiple-skills="solid-form-multipleselect-autocompletion-label"
range-skills="http://ldpserver/skills"
></solid-form>