wagtail-tw-blocks 0.1.2__py3-none-any.whl → 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wagtail_blocks/__init__.py +18 -2
- wagtail_blocks/blocks.py +339 -27
- wagtail_blocks/static/wagtail_blocks/css/styles.css +1 -1
- wagtail_blocks/templates/wagtail_blocks/blocks/accordion.html +9 -4
- wagtail_blocks/templates/wagtail_blocks/blocks/alert.html +3 -3
- wagtail_blocks/templates/wagtail_blocks/blocks/carousel.html +3 -3
- wagtail_blocks/templates/wagtail_blocks/blocks/code.html +36 -23
- wagtail_blocks/templates/wagtail_blocks/blocks/diff.html +4 -7
- wagtail_blocks/templates/wagtail_blocks/blocks/fab.html +43 -0
- wagtail_blocks/templates/wagtail_blocks/blocks/hover_gallery.html +18 -0
- wagtail_blocks/templates/wagtail_blocks/blocks/list.html +55 -0
- wagtail_blocks/templates/wagtail_blocks/blocks/steps.html +12 -0
- wagtail_blocks/templates/wagtail_blocks/blocks/tabs.html +24 -0
- wagtail_blocks/templates/wagtail_blocks/blocks/timeline.html +30 -0
- wagtail_blocks/templates/wagtail_blocks/blocks/toast.html +9 -0
- {wagtail_tw_blocks-0.1.2.dist-info → wagtail_tw_blocks-0.2.0.dist-info}/METADATA +26 -2
- wagtail_tw_blocks-0.2.0.dist-info/RECORD +25 -0
- wagtail_blocks/templates/wagtail_blocks/styles.html +0 -20
- wagtail_tw_blocks-0.1.2.dist-info/RECORD +0 -19
- {wagtail_tw_blocks-0.1.2.dist-info → wagtail_tw_blocks-0.2.0.dist-info}/WHEEL +0 -0
- {wagtail_tw_blocks-0.1.2.dist-info → wagtail_tw_blocks-0.2.0.dist-info}/licenses/LICENSE +0 -0
wagtail_blocks/__init__.py
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
from django.utils.translation import gettext_lazy as _
|
|
4
4
|
|
|
5
5
|
# Constants
|
|
6
|
-
|
|
6
|
+
ACCORDION_STYLES = [
|
|
7
7
|
("plus", _("Plus")),
|
|
8
8
|
("arrow", _("Arrow")),
|
|
9
9
|
]
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
ALERT_STYLES = [
|
|
12
12
|
("soft", _("Soft")),
|
|
13
13
|
("outline", _("Outline")),
|
|
14
14
|
]
|
|
@@ -20,6 +20,22 @@ ALERT_LEVELS = [
|
|
|
20
20
|
("error", _("Error")),
|
|
21
21
|
]
|
|
22
22
|
|
|
23
|
+
COLOR_CHOICES = [
|
|
24
|
+
("primary", _("Primary")),
|
|
25
|
+
("secondary", _("Secondary")),
|
|
26
|
+
("accent", _("Accent")),
|
|
27
|
+
("success", _("Success")),
|
|
28
|
+
("info", _("Info")),
|
|
29
|
+
("warning", _("Warning")),
|
|
30
|
+
("error", _("Error")),
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
TAB_STYLES = [
|
|
34
|
+
("border", _("Border")),
|
|
35
|
+
("box", _("Box")),
|
|
36
|
+
("lift", _("Lift")),
|
|
37
|
+
]
|
|
38
|
+
|
|
23
39
|
# The popular programming languages
|
|
24
40
|
PROGRAMMING_LANGUAGES = [
|
|
25
41
|
("auto", _("Auto")),
|
wagtail_blocks/blocks.py
CHANGED
|
@@ -7,13 +7,14 @@ from wagtail.embeds.blocks import EmbedBlock
|
|
|
7
7
|
from wagtail.images.blocks import ImageBlock
|
|
8
8
|
|
|
9
9
|
from wagtail_blocks import (
|
|
10
|
-
|
|
10
|
+
ACCORDION_STYLES,
|
|
11
11
|
ALERT_LEVELS,
|
|
12
|
-
|
|
12
|
+
ALERT_STYLES,
|
|
13
|
+
COLOR_CHOICES,
|
|
13
14
|
PROGRAMMING_LANGUAGES,
|
|
15
|
+
TAB_STYLES,
|
|
14
16
|
)
|
|
15
17
|
|
|
16
|
-
|
|
17
18
|
# Settings
|
|
18
19
|
PROGRAMMING_LANGUAGES = getattr(
|
|
19
20
|
settings,
|
|
@@ -43,6 +44,12 @@ SHOW_WINDOW_CONTROLS = getattr(
|
|
|
43
44
|
class ButtonBlock(blocks.StructBlock):
|
|
44
45
|
"""Action block (link)"""
|
|
45
46
|
|
|
47
|
+
icon = blocks.CharBlock(
|
|
48
|
+
max_length=32,
|
|
49
|
+
required=False,
|
|
50
|
+
default="check-circle2",
|
|
51
|
+
help_text=_("Icon name (lucide icons)"),
|
|
52
|
+
)
|
|
46
53
|
label = blocks.CharBlock(
|
|
47
54
|
max_length=32,
|
|
48
55
|
required=False,
|
|
@@ -56,11 +63,22 @@ class ButtonBlock(blocks.StructBlock):
|
|
|
56
63
|
required=False,
|
|
57
64
|
help_text=_("Action external link"),
|
|
58
65
|
)
|
|
66
|
+
color = blocks.ChoiceBlock(
|
|
67
|
+
choices=COLOR_CHOICES,
|
|
68
|
+
required=False,
|
|
69
|
+
help_text=_("Action button color"),
|
|
70
|
+
)
|
|
59
71
|
|
|
60
72
|
|
|
61
|
-
class
|
|
73
|
+
class AccordionItem(blocks.StructBlock):
|
|
62
74
|
"""Accordion Item"""
|
|
63
75
|
|
|
76
|
+
icon = blocks.CharBlock(
|
|
77
|
+
max_length=32,
|
|
78
|
+
required=False,
|
|
79
|
+
default="check-circle2",
|
|
80
|
+
help_text=_("Icon name (lucide icons)"),
|
|
81
|
+
)
|
|
64
82
|
is_expanded = blocks.BooleanBlock(
|
|
65
83
|
default=False,
|
|
66
84
|
required=False,
|
|
@@ -78,20 +96,23 @@ class AccordionItemBlock(blocks.StructBlock):
|
|
|
78
96
|
|
|
79
97
|
|
|
80
98
|
class AccordionBlock(blocks.StructBlock):
|
|
81
|
-
"""
|
|
99
|
+
"""
|
|
100
|
+
Accordion is used for showing and hiding content
|
|
101
|
+
but only one item can stay open at a time.
|
|
102
|
+
"""
|
|
82
103
|
|
|
83
104
|
name = blocks.CharBlock(
|
|
84
105
|
max_length=64,
|
|
85
106
|
required=True,
|
|
86
107
|
help_text=_("Accordion name"),
|
|
87
108
|
)
|
|
88
|
-
|
|
89
|
-
choices=
|
|
109
|
+
style = blocks.ChoiceBlock(
|
|
110
|
+
choices=ACCORDION_STYLES,
|
|
90
111
|
required=False,
|
|
91
|
-
help_text=_("
|
|
112
|
+
help_text=_("Accordion style"),
|
|
92
113
|
)
|
|
93
114
|
items = blocks.ListBlock(
|
|
94
|
-
|
|
115
|
+
AccordionItem(),
|
|
95
116
|
required=True,
|
|
96
117
|
help_text=_("Accordion items"),
|
|
97
118
|
)
|
|
@@ -99,12 +120,12 @@ class AccordionBlock(blocks.StructBlock):
|
|
|
99
120
|
class Meta:
|
|
100
121
|
"""Meta data"""
|
|
101
122
|
|
|
102
|
-
icon = "
|
|
123
|
+
icon = "collapse-down"
|
|
103
124
|
template = "wagtail_blocks/blocks/accordion.html"
|
|
104
125
|
|
|
105
126
|
|
|
106
127
|
class AlertBlock(blocks.StructBlock):
|
|
107
|
-
"""Alert
|
|
128
|
+
"""Alert informs users about important events."""
|
|
108
129
|
|
|
109
130
|
icon = blocks.CharBlock(
|
|
110
131
|
max_length=32,
|
|
@@ -115,12 +136,12 @@ class AlertBlock(blocks.StructBlock):
|
|
|
115
136
|
is_vertical = blocks.BooleanBlock(
|
|
116
137
|
default=False,
|
|
117
138
|
required=False,
|
|
118
|
-
help_text=_("Designates if
|
|
139
|
+
help_text=_("Designates if alert is vertical or horizontal (default)"),
|
|
119
140
|
)
|
|
120
|
-
|
|
121
|
-
choices=
|
|
141
|
+
style = blocks.ChoiceBlock(
|
|
142
|
+
choices=ALERT_STYLES,
|
|
122
143
|
required=False,
|
|
123
|
-
help_text=_("
|
|
144
|
+
help_text=_("Alert style"),
|
|
124
145
|
)
|
|
125
146
|
level = blocks.ChoiceBlock(
|
|
126
147
|
choices=ALERT_LEVELS,
|
|
@@ -142,10 +163,7 @@ class AlertBlock(blocks.StructBlock):
|
|
|
142
163
|
],
|
|
143
164
|
)
|
|
144
165
|
actions = blocks.ListBlock(
|
|
145
|
-
ButtonBlock(
|
|
146
|
-
required=False,
|
|
147
|
-
help_text=_("Alert action"),
|
|
148
|
-
),
|
|
166
|
+
ButtonBlock(),
|
|
149
167
|
required=False,
|
|
150
168
|
help_text=_("Alert actions"),
|
|
151
169
|
)
|
|
@@ -157,8 +175,8 @@ class AlertBlock(blocks.StructBlock):
|
|
|
157
175
|
template = "wagtail_blocks/blocks/alert.html"
|
|
158
176
|
|
|
159
177
|
|
|
160
|
-
class
|
|
161
|
-
"""Carousel
|
|
178
|
+
class CarouselItem(blocks.StructBlock):
|
|
179
|
+
"""Carousel Items"""
|
|
162
180
|
|
|
163
181
|
image = ImageBlock(
|
|
164
182
|
required=False,
|
|
@@ -176,7 +194,7 @@ class CarouselItemBlock(blocks.StructBlock):
|
|
|
176
194
|
|
|
177
195
|
|
|
178
196
|
class CarouselBlock(blocks.StructBlock):
|
|
179
|
-
"""Carousel
|
|
197
|
+
"""Carousel show images or content in a scrollable area."""
|
|
180
198
|
|
|
181
199
|
is_vertical = blocks.BooleanBlock(
|
|
182
200
|
default=False,
|
|
@@ -184,7 +202,7 @@ class CarouselBlock(blocks.StructBlock):
|
|
|
184
202
|
help_text=_("Designates if carousel is vertical or horizontal (default)"),
|
|
185
203
|
)
|
|
186
204
|
items = blocks.ListBlock(
|
|
187
|
-
|
|
205
|
+
CarouselItem(),
|
|
188
206
|
required=True,
|
|
189
207
|
help_text=_("Carousel items"),
|
|
190
208
|
)
|
|
@@ -192,12 +210,12 @@ class CarouselBlock(blocks.StructBlock):
|
|
|
192
210
|
class Meta:
|
|
193
211
|
"""Meta data"""
|
|
194
212
|
|
|
195
|
-
icon = "
|
|
213
|
+
icon = "media"
|
|
196
214
|
template = "wagtail_blocks/blocks/carousel.html"
|
|
197
215
|
|
|
198
216
|
|
|
199
217
|
class CodeBlock(blocks.StructBlock):
|
|
200
|
-
"""Code block"""
|
|
218
|
+
"""Code block is used to show a block of code in a box that looks like a code editor."""
|
|
201
219
|
|
|
202
220
|
show_language = blocks.BooleanBlock(
|
|
203
221
|
default=SHOW_PROGRAMMING_LANGUAGE,
|
|
@@ -214,6 +232,12 @@ class CodeBlock(blocks.StructBlock):
|
|
|
214
232
|
required=False,
|
|
215
233
|
help_text=_("Wether to show or hide window buttons"),
|
|
216
234
|
)
|
|
235
|
+
file_name = blocks.CharBlock(
|
|
236
|
+
max_length=64,
|
|
237
|
+
default="Untitled",
|
|
238
|
+
required=True,
|
|
239
|
+
help_text=_("File name"),
|
|
240
|
+
)
|
|
217
241
|
language = blocks.ChoiceBlock(
|
|
218
242
|
choices=PROGRAMMING_LANGUAGES,
|
|
219
243
|
default="auto",
|
|
@@ -233,7 +257,7 @@ class CodeBlock(blocks.StructBlock):
|
|
|
233
257
|
|
|
234
258
|
|
|
235
259
|
class DiffBlock(blocks.StructBlock):
|
|
236
|
-
"""Diff
|
|
260
|
+
"""Diff component shows a side-by-side comparison of two items."""
|
|
237
261
|
|
|
238
262
|
item_1 = ImageBlock(
|
|
239
263
|
required=True,
|
|
@@ -247,5 +271,293 @@ class DiffBlock(blocks.StructBlock):
|
|
|
247
271
|
class Meta:
|
|
248
272
|
"""Meta data"""
|
|
249
273
|
|
|
250
|
-
icon = "
|
|
274
|
+
icon = "image"
|
|
251
275
|
template = "wagtail_blocks/blocks/diff.html"
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
class FABBlock(blocks.StructBlock):
|
|
279
|
+
"""
|
|
280
|
+
FAB (Floating Action Button) stays in the bottom corner of screen. It includes a
|
|
281
|
+
focusable and accessible element with button role. Clicking or focusing it shows
|
|
282
|
+
additional buttons (known as Speed Dial buttons) in a vertical arrangement or a
|
|
283
|
+
flower shape (quarter circle).
|
|
284
|
+
"""
|
|
285
|
+
|
|
286
|
+
is_flower = blocks.BooleanBlock(
|
|
287
|
+
default=False,
|
|
288
|
+
required=False,
|
|
289
|
+
help_text=_("Designates if FAB is vertical or flower shaped (quarter circle)"),
|
|
290
|
+
)
|
|
291
|
+
toggle = ButtonBlock(
|
|
292
|
+
required=True,
|
|
293
|
+
help_text=_("FAB toggle btn"),
|
|
294
|
+
)
|
|
295
|
+
main = ButtonBlock(
|
|
296
|
+
required=False,
|
|
297
|
+
help_text=_("FAB main action"),
|
|
298
|
+
)
|
|
299
|
+
items = blocks.ListBlock(
|
|
300
|
+
ButtonBlock(),
|
|
301
|
+
required=True,
|
|
302
|
+
help_text=_("FAB items"),
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
class Meta:
|
|
306
|
+
"""Meta data"""
|
|
307
|
+
|
|
308
|
+
icon = "grip"
|
|
309
|
+
template = "wagtail_blocks/blocks/fab.html"
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
class HoverGalleryItem(blocks.StructBlock):
|
|
313
|
+
"""Hover gallery items"""
|
|
314
|
+
|
|
315
|
+
image = ImageBlock(
|
|
316
|
+
required=True,
|
|
317
|
+
help_text=_("Image"),
|
|
318
|
+
)
|
|
319
|
+
caption = blocks.CharBlock(
|
|
320
|
+
max_length=128,
|
|
321
|
+
required=False,
|
|
322
|
+
help_text=_("Caption"),
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
class HoverGalleryBlock(blocks.StructBlock):
|
|
327
|
+
"""
|
|
328
|
+
Hover Gallery is container of images.
|
|
329
|
+
The first image is visible be default and when we hover it horizontally,
|
|
330
|
+
other images show up. Hover Gallery is useful for product cards in ecommerce sites,
|
|
331
|
+
portfoilios or in image galleries. Hover Gallery can include up to 10 images.
|
|
332
|
+
"""
|
|
333
|
+
|
|
334
|
+
items = blocks.ListBlock(
|
|
335
|
+
HoverGalleryItem(),
|
|
336
|
+
required=True,
|
|
337
|
+
help_text=_("Gallery items"),
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
class Meta:
|
|
341
|
+
"""Meta data"""
|
|
342
|
+
|
|
343
|
+
icon = "image"
|
|
344
|
+
template = "wagtail_blocks/blocks/hover_gallery.html"
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
class TimelineItem(blocks.StructBlock):
|
|
348
|
+
"""Timeline item"""
|
|
349
|
+
|
|
350
|
+
date = blocks.DateBlock(
|
|
351
|
+
required=True,
|
|
352
|
+
help_text=_("Item date"),
|
|
353
|
+
)
|
|
354
|
+
icon = blocks.CharBlock(
|
|
355
|
+
max_length=32,
|
|
356
|
+
required=False,
|
|
357
|
+
default="check-circle2",
|
|
358
|
+
help_text=_("Icon name (lucide icons)"),
|
|
359
|
+
)
|
|
360
|
+
content = blocks.CharBlock(
|
|
361
|
+
max_length=128,
|
|
362
|
+
required=True,
|
|
363
|
+
help_text=_("Item content"),
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
class TimelineBlock(blocks.StructBlock):
|
|
368
|
+
"""Timeline component shows a list of events in chronological order."""
|
|
369
|
+
|
|
370
|
+
is_compact = blocks.BooleanBlock(
|
|
371
|
+
default=False,
|
|
372
|
+
required=False,
|
|
373
|
+
help_text=_("Designates if timeline is compact"),
|
|
374
|
+
)
|
|
375
|
+
is_vertical = blocks.BooleanBlock(
|
|
376
|
+
default=False,
|
|
377
|
+
required=False,
|
|
378
|
+
help_text=_("Designates if timeline is vertical or horizontal (default)"),
|
|
379
|
+
)
|
|
380
|
+
snap_to_icon = blocks.BooleanBlock(
|
|
381
|
+
default=False,
|
|
382
|
+
required=False,
|
|
383
|
+
help_text=_("Designates if dates should snap to icons"),
|
|
384
|
+
)
|
|
385
|
+
items = blocks.ListBlock(
|
|
386
|
+
TimelineItem(),
|
|
387
|
+
required=True,
|
|
388
|
+
help_text=_("Timeline items"),
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
class Meta:
|
|
392
|
+
"""Meta data"""
|
|
393
|
+
|
|
394
|
+
icon = "calendar-alt"
|
|
395
|
+
template = "wagtail_blocks/blocks/timeline.html"
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
class StepItem(blocks.StructBlock):
|
|
399
|
+
"""Step item"""
|
|
400
|
+
|
|
401
|
+
name = blocks.CharBlock(
|
|
402
|
+
max_length=64,
|
|
403
|
+
required=True,
|
|
404
|
+
help_text=_("Item name"),
|
|
405
|
+
)
|
|
406
|
+
icon = blocks.CharBlock(
|
|
407
|
+
max_length=32,
|
|
408
|
+
required=False,
|
|
409
|
+
default="check-circle2",
|
|
410
|
+
help_text=_("Icon name (lucide icons)"),
|
|
411
|
+
)
|
|
412
|
+
color = blocks.ChoiceBlock(
|
|
413
|
+
choices=COLOR_CHOICES,
|
|
414
|
+
required=False,
|
|
415
|
+
help_text=_("Item color"),
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
class StepsBlock(blocks.StructBlock):
|
|
420
|
+
"""Steps can be used to show a list of steps in a process."""
|
|
421
|
+
|
|
422
|
+
is_vertical = blocks.BooleanBlock(
|
|
423
|
+
default=False,
|
|
424
|
+
required=False,
|
|
425
|
+
help_text=_("Designates if Steps is vertical or horizontal (default)"),
|
|
426
|
+
)
|
|
427
|
+
items = blocks.ListBlock(
|
|
428
|
+
StepItem(),
|
|
429
|
+
required=True,
|
|
430
|
+
help_text=_("Steps items"),
|
|
431
|
+
)
|
|
432
|
+
|
|
433
|
+
class Meta:
|
|
434
|
+
"""Meta data"""
|
|
435
|
+
|
|
436
|
+
icon = "breadcrumb-expand"
|
|
437
|
+
template = "wagtail_blocks/blocks/steps.html"
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
class TabItem(blocks.StructBlock):
|
|
441
|
+
"""Tab items"""
|
|
442
|
+
|
|
443
|
+
title = blocks.CharBlock(
|
|
444
|
+
max_length=64,
|
|
445
|
+
required=True,
|
|
446
|
+
help_text=_("Item title"),
|
|
447
|
+
)
|
|
448
|
+
is_selected = blocks.BooleanBlock(
|
|
449
|
+
default=False,
|
|
450
|
+
required=False,
|
|
451
|
+
help_text=_("Designates if tab is selected"),
|
|
452
|
+
)
|
|
453
|
+
content = blocks.StreamBlock(
|
|
454
|
+
[
|
|
455
|
+
("alert", AlertBlock(required=True, help_text=_("Alert"))),
|
|
456
|
+
("code", CodeBlock(required=True, help_text=_("Code"))),
|
|
457
|
+
("image", ImageBlock(required=True, help_text=_("Image"))),
|
|
458
|
+
("video", EmbedBlock(required=True, help_text=_("Video"))),
|
|
459
|
+
("text", blocks.RichTextBlock(required=True, help_text=_("Rich text"))),
|
|
460
|
+
],
|
|
461
|
+
required=True,
|
|
462
|
+
help_text=_("Tab Content"),
|
|
463
|
+
)
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
class TabsBlock(blocks.StructBlock):
|
|
467
|
+
"""Tabs can be used to show a list of links in a tabbed format."""
|
|
468
|
+
|
|
469
|
+
name = blocks.CharBlock(
|
|
470
|
+
max_length=64,
|
|
471
|
+
required=True,
|
|
472
|
+
help_text=_("Tab name"),
|
|
473
|
+
)
|
|
474
|
+
is_reversed = blocks.BooleanBlock(
|
|
475
|
+
default=False,
|
|
476
|
+
required=False,
|
|
477
|
+
help_text=_("Designates if tab buttons position is reversed"),
|
|
478
|
+
)
|
|
479
|
+
style = blocks.ChoiceBlock(
|
|
480
|
+
choices=TAB_STYLES,
|
|
481
|
+
required=False,
|
|
482
|
+
help_text=_("Tab style"),
|
|
483
|
+
)
|
|
484
|
+
items = blocks.ListBlock(
|
|
485
|
+
TabItem(),
|
|
486
|
+
required=True,
|
|
487
|
+
help_text=_("Tab items"),
|
|
488
|
+
)
|
|
489
|
+
|
|
490
|
+
class Meta:
|
|
491
|
+
"""Meta data"""
|
|
492
|
+
|
|
493
|
+
icon = "dots-horizontal"
|
|
494
|
+
template = "wagtail_blocks/blocks/tabs.html"
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
class ToastBlock(blocks.StructBlock):
|
|
498
|
+
"""Toast is a wrapper to stack elements, positioned on the corner of page."""
|
|
499
|
+
|
|
500
|
+
items = blocks.ListBlock(
|
|
501
|
+
AlertBlock(),
|
|
502
|
+
required=True,
|
|
503
|
+
help_text=_("Toast items"),
|
|
504
|
+
)
|
|
505
|
+
|
|
506
|
+
class Meta:
|
|
507
|
+
"""Meta data"""
|
|
508
|
+
|
|
509
|
+
icon = "mail"
|
|
510
|
+
template = "wagtail_blocks/blocks/toast.html"
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
class ListItem(blocks.StructBlock):
|
|
514
|
+
"""List item"""
|
|
515
|
+
|
|
516
|
+
image = ImageBlock(
|
|
517
|
+
required=False,
|
|
518
|
+
help_text=_("Item image"),
|
|
519
|
+
)
|
|
520
|
+
title = blocks.CharBlock(
|
|
521
|
+
max_length=64,
|
|
522
|
+
required=True,
|
|
523
|
+
help_text=_("Item title"),
|
|
524
|
+
)
|
|
525
|
+
description = blocks.CharBlock(
|
|
526
|
+
max_length=128,
|
|
527
|
+
required=False,
|
|
528
|
+
help_text=_("Item description"),
|
|
529
|
+
)
|
|
530
|
+
page = blocks.PageChooserBlock(
|
|
531
|
+
required=False,
|
|
532
|
+
help_text=_("Item internal link"),
|
|
533
|
+
)
|
|
534
|
+
url = blocks.URLBlock(
|
|
535
|
+
required=False,
|
|
536
|
+
help_text=_("Item external link"),
|
|
537
|
+
)
|
|
538
|
+
actions = blocks.ListBlock(
|
|
539
|
+
ButtonBlock(),
|
|
540
|
+
required=False,
|
|
541
|
+
help_text=_("Actions"),
|
|
542
|
+
)
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
class ListBlock(blocks.StructBlock):
|
|
546
|
+
"""List is a vertical layout to display information in rows."""
|
|
547
|
+
|
|
548
|
+
title = blocks.CharBlock(
|
|
549
|
+
max_length=64,
|
|
550
|
+
required=True,
|
|
551
|
+
help_text=_("List title"),
|
|
552
|
+
)
|
|
553
|
+
items = blocks.ListBlock(
|
|
554
|
+
ListItem(),
|
|
555
|
+
required=True,
|
|
556
|
+
help_text=_("List items"),
|
|
557
|
+
)
|
|
558
|
+
|
|
559
|
+
class Meta:
|
|
560
|
+
"""Meta data"""
|
|
561
|
+
|
|
562
|
+
icon = "list-ol"
|
|
563
|
+
template = "wagtail_blocks/blocks/list.html"
|