wagtail-tw-blocks 0.1.0__tar.gz

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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Yousef Abu Shanab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,185 @@
1
+ Metadata-Version: 2.4
2
+ Name: wagtail-tw-blocks
3
+ Version: 0.1.0
4
+ Summary: A collection of reusable, production-ready content blocks for Wagtail CMS, styled with Tailwind CSS and daisyUI.
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Author: Yousef Abu Shanab
8
+ Author-email: josephyousef249@gmail.com
9
+ Requires-Python: >=3.10
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Requires-Dist: django (>=5.2.1)
18
+ Requires-Dist: wagtail (>=7.0)
19
+ Description-Content-Type: text/markdown
20
+
21
+ # wagtail-tw-blocks
22
+
23
+ [![CI](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/ci.yml/badge.svg)](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/ci.yml)
24
+ [![CD](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/cd.yml/badge.svg)](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/cd.yml)
25
+ [![Code Style: Black](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/black.yml/badge.svg)](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/black.yml)
26
+ [![Code Linting: Ruff](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/ruff.yml/badge.svg)](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/ruff.yml)
27
+ [![Docker Image](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/docker-image.yml/badge.svg)](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/docker-image.yml)
28
+ [![Docker Publish](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/docker-publish.yml)
29
+ [![PyPI - Version](https://img.shields.io/pypi/v/wagtail-tw-blocks?logo=pypi&logoColor=white)](https://pypi.org/project/wagtail-tw-blocks/)
30
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/wagtail-tw-blocks?logo=python&logoColor=white)](https://pypi.org/project/wagtail-tw-blocks/)
31
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/wagtail-tw-blocks?logo=pypi&logoColor=white)](https://pypi.org/project/wagtail-tw-blocks/)
32
+ [![PyPI - License](https://img.shields.io/pypi/l/wagtail-tw-blocks?logo=pypi&logoColor=white)](https://pypi.org/project/wagtail-tw-blocks/)
33
+
34
+ ## Overview
35
+
36
+ **wagtail-tw-blocks** is a collection of reusable, production-ready content blocks for Wagtail CMS, styled with Tailwind CSS and daisyUI. It provides a set of common UI components—ready to drop into your `StreamField`—so you can build rich, modern page layouts without reinventing the wheel.
37
+
38
+ ---
39
+
40
+ ## Available blocks
41
+
42
+ - **Accordion (Collapse):** Expandable/collapsible sections for FAQs or structured content.
43
+ - **Alert:** Highlight important messages or status updates.
44
+ - **Carousel:** Image or content slider with responsive design.
45
+ - **Code:** Syntax-highlighted code snippets for technical content (Requires `highlight.js` and `clipboard.js` to be included in your page).
46
+ - **Diff:** Side-by-side or inline difference highlighting for image comparisons.
47
+
48
+ ---
49
+
50
+ ## Installation
51
+
52
+ ```bash
53
+ pip install wagtail-tw-blocks
54
+ ```
55
+
56
+ ---
57
+
58
+ ## Configuration
59
+
60
+ Add `wagtail_blocks` to your `INSTALLED_APPS` **after** configuring your Wagtail settings:
61
+
62
+ ```python
63
+ # project/settings.py
64
+
65
+ INSTALLED_APPS = [
66
+ "wagtail_blocks",
67
+ # ...
68
+ ]
69
+ ```
70
+
71
+ ### Available settings
72
+
73
+ You can customize the behavior of `wagtail-tw-blocks` by adding the following settings to your Django settings file:
74
+
75
+ ```python
76
+ # project/settings.py
77
+
78
+ # Extend or override the default programming languages for the CodeBlock
79
+ WAGTAIL_BLOCKS_PROGRAMMING_LANGUAGES = [
80
+ ('python', 'Python'),
81
+ ('javascript', 'JavaScript'),
82
+ ('html', 'HTML'),
83
+ ('css', 'CSS'),
84
+ ('java', 'Java'),
85
+ ('csharp', 'C#'),
86
+ ('cpp', 'C++'),
87
+ ('ruby', 'Ruby'),
88
+ ('go', 'Go'),
89
+ ('php', 'PHP'),
90
+ # ...
91
+ ]
92
+
93
+ # Show or hide the programming language label in the CodeBlock
94
+ WAGTAIL_BLOCKS_SHOW_PROGRAMMING_LANGUAGE = True # Default is True
95
+
96
+ # Show or hide the copy button in the CodeBlock
97
+ WAGTAIL_BLOCKS_SHOW_COPY_BUTTON = True # Default is True
98
+ ---
99
+
100
+ ## Usage example
101
+
102
+ ```python
103
+ # blog/models.py
104
+
105
+ from wagtail_blocks import blocks
106
+ from wagtail.admin.panels import FieldPanel
107
+ from wagtail.fields import StreamField
108
+ from wagtail.models import Page
109
+ from django.utils.translation import gettext_lazy as _
110
+
111
+
112
+ class Article(Page):
113
+ content = StreamField(
114
+ [
115
+ ("accordion", blocks.AccordionBlock()),
116
+ ("alert", blocks.AlertBlock()),
117
+ ("carousel", blocks.CarouselBlock()),
118
+ ("code", blocks.CodeBlock()),
119
+ ("diff", blocks.DiffBlock()),
120
+ ],
121
+ help_text=_("Article content"),
122
+ )
123
+
124
+ content_panels = Page.content_panels + [
125
+ FieldPanel("content"),
126
+ # ...
127
+ ]
128
+ ```
129
+
130
+ ```html
131
+ <!-- blog/base.html -->
132
+
133
+ {% load static %}
134
+
135
+ <!doctype html>
136
+
137
+ <html data-theme="luxury">
138
+ <head>
139
+ <meta charset="UTF-8" />
140
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
141
+ <title>Wagtail Blocks Usage Example</title>
142
+ <!-- You also may want to include TailwindCSS and daisyUI -->
143
+ <link href="{% static 'wagtail_blocks/css/styles.css' %}" rel="stylesheet" type="text/css" />
144
+ </head>
145
+
146
+ <body>
147
+ <!-- ... -->
148
+ <main>
149
+ {{ article.content }}
150
+ </main>
151
+ </body>
152
+ </html>
153
+ ```
154
+
155
+ ---
156
+
157
+ ## Key features
158
+
159
+ - **Modern design:** Tailwind CSS + daisyUI styling for clean, responsive layouts.
160
+ - **Multiple themes:** All daisyUI themes included, with easy customization.
161
+ - **CI/CD:** GitHub Actions pipelines for automated testing and deployment.
162
+ - **Dependency management:** Poetry for reproducible, maintainable installs.
163
+ - **Code formatting:** Black for consistent, automatic formatting.
164
+ - **Linting:** Ruff for fast, comprehensive linting.
165
+ - **Testing:** Django test runner for unit and integration tests.
166
+ - **Starter configs:** `.gitignore`, `pyproject.toml`, and other essentials included.
167
+
168
+ ---
169
+
170
+ ## Contributing
171
+
172
+ We welcome community contributions. See the [CONTRIBUTING](CONTRIBUTING.md) guide for setup instructions, coding standards, and workflow. Opening an issue before major changes helps align on scope and direction.
173
+
174
+ ---
175
+
176
+ ## Support
177
+
178
+ For questions, bug reports, or feature requests, open an issue or join the conversation in [GitHub Discussions](https://github.com/youzarsiph/wagtail-tw-blocks/discussions).
179
+
180
+ ---
181
+
182
+ ## License
183
+
184
+ Licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
185
+
@@ -0,0 +1,164 @@
1
+ # wagtail-tw-blocks
2
+
3
+ [![CI](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/ci.yml/badge.svg)](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/ci.yml)
4
+ [![CD](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/cd.yml/badge.svg)](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/cd.yml)
5
+ [![Code Style: Black](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/black.yml/badge.svg)](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/black.yml)
6
+ [![Code Linting: Ruff](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/ruff.yml/badge.svg)](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/ruff.yml)
7
+ [![Docker Image](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/docker-image.yml/badge.svg)](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/docker-image.yml)
8
+ [![Docker Publish](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/docker-publish.yml)
9
+ [![PyPI - Version](https://img.shields.io/pypi/v/wagtail-tw-blocks?logo=pypi&logoColor=white)](https://pypi.org/project/wagtail-tw-blocks/)
10
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/wagtail-tw-blocks?logo=python&logoColor=white)](https://pypi.org/project/wagtail-tw-blocks/)
11
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/wagtail-tw-blocks?logo=pypi&logoColor=white)](https://pypi.org/project/wagtail-tw-blocks/)
12
+ [![PyPI - License](https://img.shields.io/pypi/l/wagtail-tw-blocks?logo=pypi&logoColor=white)](https://pypi.org/project/wagtail-tw-blocks/)
13
+
14
+ ## Overview
15
+
16
+ **wagtail-tw-blocks** is a collection of reusable, production-ready content blocks for Wagtail CMS, styled with Tailwind CSS and daisyUI. It provides a set of common UI components—ready to drop into your `StreamField`—so you can build rich, modern page layouts without reinventing the wheel.
17
+
18
+ ---
19
+
20
+ ## Available blocks
21
+
22
+ - **Accordion (Collapse):** Expandable/collapsible sections for FAQs or structured content.
23
+ - **Alert:** Highlight important messages or status updates.
24
+ - **Carousel:** Image or content slider with responsive design.
25
+ - **Code:** Syntax-highlighted code snippets for technical content (Requires `highlight.js` and `clipboard.js` to be included in your page).
26
+ - **Diff:** Side-by-side or inline difference highlighting for image comparisons.
27
+
28
+ ---
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ pip install wagtail-tw-blocks
34
+ ```
35
+
36
+ ---
37
+
38
+ ## Configuration
39
+
40
+ Add `wagtail_blocks` to your `INSTALLED_APPS` **after** configuring your Wagtail settings:
41
+
42
+ ```python
43
+ # project/settings.py
44
+
45
+ INSTALLED_APPS = [
46
+ "wagtail_blocks",
47
+ # ...
48
+ ]
49
+ ```
50
+
51
+ ### Available settings
52
+
53
+ You can customize the behavior of `wagtail-tw-blocks` by adding the following settings to your Django settings file:
54
+
55
+ ```python
56
+ # project/settings.py
57
+
58
+ # Extend or override the default programming languages for the CodeBlock
59
+ WAGTAIL_BLOCKS_PROGRAMMING_LANGUAGES = [
60
+ ('python', 'Python'),
61
+ ('javascript', 'JavaScript'),
62
+ ('html', 'HTML'),
63
+ ('css', 'CSS'),
64
+ ('java', 'Java'),
65
+ ('csharp', 'C#'),
66
+ ('cpp', 'C++'),
67
+ ('ruby', 'Ruby'),
68
+ ('go', 'Go'),
69
+ ('php', 'PHP'),
70
+ # ...
71
+ ]
72
+
73
+ # Show or hide the programming language label in the CodeBlock
74
+ WAGTAIL_BLOCKS_SHOW_PROGRAMMING_LANGUAGE = True # Default is True
75
+
76
+ # Show or hide the copy button in the CodeBlock
77
+ WAGTAIL_BLOCKS_SHOW_COPY_BUTTON = True # Default is True
78
+ ---
79
+
80
+ ## Usage example
81
+
82
+ ```python
83
+ # blog/models.py
84
+
85
+ from wagtail_blocks import blocks
86
+ from wagtail.admin.panels import FieldPanel
87
+ from wagtail.fields import StreamField
88
+ from wagtail.models import Page
89
+ from django.utils.translation import gettext_lazy as _
90
+
91
+
92
+ class Article(Page):
93
+ content = StreamField(
94
+ [
95
+ ("accordion", blocks.AccordionBlock()),
96
+ ("alert", blocks.AlertBlock()),
97
+ ("carousel", blocks.CarouselBlock()),
98
+ ("code", blocks.CodeBlock()),
99
+ ("diff", blocks.DiffBlock()),
100
+ ],
101
+ help_text=_("Article content"),
102
+ )
103
+
104
+ content_panels = Page.content_panels + [
105
+ FieldPanel("content"),
106
+ # ...
107
+ ]
108
+ ```
109
+
110
+ ```html
111
+ <!-- blog/base.html -->
112
+
113
+ {% load static %}
114
+
115
+ <!doctype html>
116
+
117
+ <html data-theme="luxury">
118
+ <head>
119
+ <meta charset="UTF-8" />
120
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
121
+ <title>Wagtail Blocks Usage Example</title>
122
+ <!-- You also may want to include TailwindCSS and daisyUI -->
123
+ <link href="{% static 'wagtail_blocks/css/styles.css' %}" rel="stylesheet" type="text/css" />
124
+ </head>
125
+
126
+ <body>
127
+ <!-- ... -->
128
+ <main>
129
+ {{ article.content }}
130
+ </main>
131
+ </body>
132
+ </html>
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Key features
138
+
139
+ - **Modern design:** Tailwind CSS + daisyUI styling for clean, responsive layouts.
140
+ - **Multiple themes:** All daisyUI themes included, with easy customization.
141
+ - **CI/CD:** GitHub Actions pipelines for automated testing and deployment.
142
+ - **Dependency management:** Poetry for reproducible, maintainable installs.
143
+ - **Code formatting:** Black for consistent, automatic formatting.
144
+ - **Linting:** Ruff for fast, comprehensive linting.
145
+ - **Testing:** Django test runner for unit and integration tests.
146
+ - **Starter configs:** `.gitignore`, `pyproject.toml`, and other essentials included.
147
+
148
+ ---
149
+
150
+ ## Contributing
151
+
152
+ We welcome community contributions. See the [CONTRIBUTING](CONTRIBUTING.md) guide for setup instructions, coding standards, and workflow. Opening an issue before major changes helps align on scope and direction.
153
+
154
+ ---
155
+
156
+ ## Support
157
+
158
+ For questions, bug reports, or feature requests, open an issue or join the conversation in [GitHub Discussions](https://github.com/youzarsiph/wagtail-tw-blocks/discussions).
159
+
160
+ ---
161
+
162
+ ## License
163
+
164
+ Licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,21 @@
1
+ [tool.poetry]
2
+ name = "wagtail-tw-blocks"
3
+ version = "0.1.0"
4
+ description = "A collection of reusable, production-ready content blocks for Wagtail CMS, styled with Tailwind CSS and daisyUI."
5
+ authors = ["Yousef Abu Shanab <josephyousef249@gmail.com>"]
6
+ license = "MIT"
7
+ readme = "README.md"
8
+ packages = [{ include = "wagtail_blocks" }]
9
+
10
+ [tool.poetry.dependencies]
11
+ python = ">=3.10"
12
+ django = ">=5.2.1"
13
+ wagtail = ">=7.0"
14
+
15
+ [tool.poetry.group.dev.dependencies]
16
+ black = ">=25.1.0"
17
+ ruff = ">=0.11.9"
18
+
19
+ [build-system]
20
+ requires = ["poetry-core"]
21
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,54 @@
1
+ """Wagtail Blocks"""
2
+
3
+ from django.utils.translation import gettext_lazy as _
4
+
5
+ # Constants
6
+ ACCORDION_STYLE_VARIANTS = [
7
+ ("plus", _("Plus")),
8
+ ("arrow", _("Arrow")),
9
+ ]
10
+
11
+ ALERT_STYLE_VARIANTS = [
12
+ ("soft", _("Soft")),
13
+ ("outlined", _("Outlined")),
14
+ ("dashed", _("Dashed")),
15
+ ]
16
+
17
+ ALERT_LEVELS = [
18
+ ("info", _("Info")),
19
+ ("success", _("Success")),
20
+ ("warning", _("Warning")),
21
+ ("error", _("Error")),
22
+ ]
23
+
24
+ # The popular programming languages
25
+ PROGRAMMING_LANGUAGES = [
26
+ ("auto", _("Auto")),
27
+ ("bash", "Bash"),
28
+ ("c", "C"),
29
+ ("cpp", "C++"),
30
+ ("csharp", "C#"),
31
+ ("css", "CSS"),
32
+ ("dart", "Dart"),
33
+ ("dockerfile", "Dockerfile"),
34
+ ("go", "Go"),
35
+ ("html", "HTML"),
36
+ ("java", "Java"),
37
+ ("javascript", "JavaScript"),
38
+ ("json", "JSON"),
39
+ ("kotlin", "Kotlin"),
40
+ ("lua", "Lua"),
41
+ ("markdown", "Markdown"),
42
+ ("php", "PHP"),
43
+ ("python", "Python"),
44
+ ("ruby", "Ruby"),
45
+ ("rust", "Rust"),
46
+ ("scss", "SCSS"),
47
+ ("shell", "Shell"),
48
+ ("sql", "SQL"),
49
+ ("swift", "Swift"),
50
+ ("typescript", "TypeScript"),
51
+ ("xml", "XML"),
52
+ ("yaml", "YAML"),
53
+ ("plaintext", _("Plain text")),
54
+ ]
@@ -0,0 +1,12 @@
1
+ """AppConf for wagtail_blocks"""
2
+
3
+ from django.apps import AppConfig
4
+
5
+
6
+ # Create your config here.
7
+ class WagtailBlocksConfig(AppConfig):
8
+ """App configuration for wagtail_blocks"""
9
+
10
+ name = "wagtail_blocks"
11
+ label = "wagtail_tw_blocks"
12
+ default_auto_field = "django.db.models.BigAutoField"
@@ -0,0 +1,224 @@
1
+ """Custom Wagtail CMS blocks"""
2
+
3
+ from django.conf import settings
4
+ from django.utils.translation import gettext_lazy as _
5
+ from wagtail import blocks
6
+ from wagtail.embeds.blocks import EmbedBlock
7
+ from wagtail.images.blocks import ImageBlock
8
+
9
+ from wagtail_blocks import (
10
+ ACCORDION_STYLE_VARIANTS,
11
+ ALERT_LEVELS,
12
+ ALERT_STYLE_VARIANTS,
13
+ PROGRAMMING_LANGUAGES,
14
+ )
15
+
16
+
17
+ # Settings
18
+ PROGRAMMING_LANGUAGES = getattr(
19
+ settings,
20
+ "WAGTAIL_BLOCKS_PROGRAMMING_LANGUAGES",
21
+ PROGRAMMING_LANGUAGES,
22
+ )
23
+
24
+ SHOW_PROGRAMMING_LANGUAGE = getattr(
25
+ settings,
26
+ "WAGTAIL_BLOCKS_SHOW_PROGRAMMING_LANGUAGE",
27
+ True,
28
+ )
29
+
30
+ SHOW_COPY_BUTTON = getattr(
31
+ settings,
32
+ "WAGTAIL_BLOCKS_SHOW_COPY_BUTTON",
33
+ True,
34
+ )
35
+
36
+
37
+ class ButtonBlock(blocks.StructBlock):
38
+ """Action block (link)"""
39
+
40
+ label = blocks.CharBlock(
41
+ max_length=32,
42
+ required=False,
43
+ help_text=_("Action label"),
44
+ )
45
+ page = blocks.PageChooserBlock(
46
+ required=False,
47
+ help_text=_("Action internal link"),
48
+ )
49
+ url = blocks.URLBlock(
50
+ required=False,
51
+ help_text=_("Action external link"),
52
+ )
53
+
54
+
55
+ class AccordionItemBlock(blocks.StructBlock):
56
+ """Accordion Item"""
57
+
58
+ is_expanded = blocks.BooleanBlock(
59
+ default=False,
60
+ required=False,
61
+ help_text=_("Wether to show or hide item content"),
62
+ )
63
+ title = blocks.CharBlock(
64
+ max_length=64,
65
+ required=True,
66
+ help_text=_("Item title"),
67
+ )
68
+ content = blocks.RichTextBlock(
69
+ required=True,
70
+ help_text=_("Item content"),
71
+ )
72
+
73
+
74
+ class AccordionBlock(blocks.StructBlock):
75
+ """Accordions block"""
76
+
77
+ name = blocks.CharBlock(
78
+ max_length=64,
79
+ required=True,
80
+ help_text=_("Accordion name"),
81
+ )
82
+ variant = blocks.ChoiceBlock(
83
+ choices=ACCORDION_STYLE_VARIANTS,
84
+ required=False,
85
+ help_text=_("Style variant"),
86
+ )
87
+ items = blocks.ListBlock(
88
+ AccordionItemBlock(),
89
+ required=True,
90
+ help_text=_("Accordion items"),
91
+ )
92
+
93
+ class Meta:
94
+ """Meta data"""
95
+
96
+ icon = "folder-open-inverse"
97
+ template = "wagtail_blocks/blocks/accordion.html"
98
+
99
+
100
+ class AlertBlock(blocks.StructBlock):
101
+ """Alert block"""
102
+
103
+ variant = blocks.ChoiceBlock(
104
+ choices=ALERT_STYLE_VARIANTS,
105
+ required=False,
106
+ help_text=_("Style variant"),
107
+ )
108
+ level = blocks.ChoiceBlock(
109
+ choices=ALERT_LEVELS,
110
+ required=False,
111
+ help_text=_("Alert level"),
112
+ )
113
+ message = blocks.RichTextBlock(
114
+ required=True,
115
+ help_text=_("Alert message"),
116
+ features=[
117
+ "bold",
118
+ "italic",
119
+ "link",
120
+ "document-link",
121
+ "code",
122
+ "superscript",
123
+ "subscript",
124
+ "strikethrough",
125
+ ],
126
+ )
127
+ actions = blocks.ListBlock(
128
+ ButtonBlock(
129
+ required=False,
130
+ help_text=_("Alert action"),
131
+ ),
132
+ required=False,
133
+ help_text=_("Alert actions"),
134
+ )
135
+
136
+ class Meta:
137
+ """Meta data"""
138
+
139
+ icon = "warning"
140
+ template = "wagtail_blocks/blocks/alert.html"
141
+
142
+
143
+ class CarouselItemBlock(blocks.StructBlock):
144
+ """Carousel Item block"""
145
+
146
+ image = ImageBlock(
147
+ required=False,
148
+ help_text=_("Image"),
149
+ )
150
+ video = EmbedBlock(
151
+ required=False,
152
+ help_text=_("Video"),
153
+ )
154
+
155
+
156
+ class CarouselBlock(blocks.StructBlock):
157
+ """Carousel block"""
158
+
159
+ is_vertical = blocks.BooleanBlock(
160
+ default=False,
161
+ required=False,
162
+ help_text=_("Designates if carousel is vertical or horizontal (default)"),
163
+ )
164
+ items = blocks.ListBlock(
165
+ CarouselItemBlock(),
166
+ required=True,
167
+ help_text=_("Carousel items"),
168
+ )
169
+
170
+ class Meta:
171
+ """Meta data"""
172
+
173
+ icon = "image"
174
+ template = "wagtail_blocks/blocks/carousel.html"
175
+
176
+
177
+ class CodeBlock(blocks.StructBlock):
178
+ """Code block"""
179
+
180
+ show_language = blocks.BooleanBlock(
181
+ default=SHOW_PROGRAMMING_LANGUAGE,
182
+ required=False,
183
+ help_text=_("Wether to show or hide which programming language is used"),
184
+ )
185
+ show_copy_btn = blocks.BooleanBlock(
186
+ default=SHOW_COPY_BUTTON,
187
+ required=False,
188
+ help_text=_("Wether to show or hide copy buttons"),
189
+ )
190
+ language = blocks.ChoiceBlock(
191
+ choices=PROGRAMMING_LANGUAGES,
192
+ default="auto",
193
+ required=True,
194
+ help_text=_("Programming language"),
195
+ )
196
+ code = blocks.TextBlock(
197
+ required=True,
198
+ help_text=_("Code content"),
199
+ )
200
+
201
+ class Meta:
202
+ """Meta data"""
203
+
204
+ icon = "code"
205
+ template = "wagtail_blocks/blocks/code.html"
206
+
207
+
208
+ class DiffBlock(blocks.StructBlock):
209
+ """Diff block"""
210
+
211
+ item_1 = ImageBlock(
212
+ required=True,
213
+ help_text=_("Diff Item 1"),
214
+ )
215
+ item_2 = ImageBlock(
216
+ required=True,
217
+ help_text=_("Diff Item 2"),
218
+ )
219
+
220
+ class Meta:
221
+ """Meta data"""
222
+
223
+ icon = "code"
224
+ template = "wagtail_blocks/blocks/diff.html"
@@ -0,0 +1,4 @@
1
+ {
2
+ "tailwindStylesheet": "./css/app.css",
3
+ "plugins": ["prettier-plugin-tailwindcss"]
4
+ }