richie 2.32.0__py2.py3-none-any.whl → 2.32.1.dev4__py2.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.
Potentially problematic release.
This version of richie might be problematic. Click here for more details.
- frontend/package.json +1 -1
- frontend/scss/colors/_theme.scss +6 -0
- frontend/scss/components/_index.scss +1 -0
- frontend/scss/components/templates/richie/slider/_slider.scss +142 -0
- frontend/scss/settings/_variables.scss +3 -0
- frontend/yarn.lock +22 -109
- richie/apps/courses/settings/__init__.py +1 -1
- richie/plugins/slider/__init__.py +0 -0
- richie/plugins/slider/cms_plugins.py +85 -0
- richie/plugins/slider/factories.py +33 -0
- richie/plugins/slider/forms.py +40 -0
- richie/plugins/slider/migrations/0001_initial.py +102 -0
- richie/plugins/slider/migrations/__init__.py +0 -0
- richie/plugins/slider/models.py +111 -0
- richie/plugins/slider/templates/richie/slider/slider.html +4 -0
- richie/static/richie/css/main.css +1 -1
- {richie-2.32.0.dist-info → richie-2.32.1.dev4.dist-info}/METADATA +1 -1
- {richie-2.32.0.dist-info → richie-2.32.1.dev4.dist-info}/RECORD +22 -13
- {richie-2.32.0.dist-info → richie-2.32.1.dev4.dist-info}/LICENSE +0 -0
- {richie-2.32.0.dist-info → richie-2.32.1.dev4.dist-info}/WHEEL +0 -0
- {richie-2.32.0.dist-info → richie-2.32.1.dev4.dist-info}/top_level.txt +0 -0
- {richie-2.32.0.dist-info → richie-2.32.1.dev4.dist-info}/zip-safe +0 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Slider plugin models
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from django.db import models
|
|
6
|
+
from django.utils.translation import gettext_lazy as _
|
|
7
|
+
|
|
8
|
+
from cms.models.pluginmodel import CMSPlugin
|
|
9
|
+
from filer.fields.image import FilerImageField
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Slider(CMSPlugin):
|
|
13
|
+
"""
|
|
14
|
+
Slide container plugin for Slide item plugins.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
title = models.CharField(_("title"), max_length=255)
|
|
18
|
+
|
|
19
|
+
class Meta:
|
|
20
|
+
verbose_name = _("Slider")
|
|
21
|
+
verbose_name_plural = _("Sliders")
|
|
22
|
+
|
|
23
|
+
def __str__(self):
|
|
24
|
+
return self.title
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def front_identifier(self):
|
|
28
|
+
"""
|
|
29
|
+
Return standardized identifier for the slider container.
|
|
30
|
+
"""
|
|
31
|
+
return f"slider-{self.id}"
|
|
32
|
+
|
|
33
|
+
@property
|
|
34
|
+
def payload_identifier(self):
|
|
35
|
+
"""
|
|
36
|
+
Return standardized identifier for the slider payload.
|
|
37
|
+
"""
|
|
38
|
+
return f"{self.front_identifier}-data"
|
|
39
|
+
|
|
40
|
+
def get_slider_payload(self):
|
|
41
|
+
"""
|
|
42
|
+
Serializer a slider object and its slide items to Python object.
|
|
43
|
+
|
|
44
|
+
Arguments:
|
|
45
|
+
instance (richie.plugins.slider.models.SlideItem): Instance of a Slider
|
|
46
|
+
object.
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
dict: Dictionnary of slider data.
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
slides = self.child_plugin_instances or []
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
"pk": self.id,
|
|
56
|
+
"title": self.title,
|
|
57
|
+
"slides": [
|
|
58
|
+
{
|
|
59
|
+
"pk": plugin.id,
|
|
60
|
+
"title": plugin.title,
|
|
61
|
+
"image": plugin.image.url,
|
|
62
|
+
"content": plugin.content,
|
|
63
|
+
"link_url": plugin.link_url,
|
|
64
|
+
"link_open_blank": plugin.link_open_blank,
|
|
65
|
+
}
|
|
66
|
+
for plugin in slides
|
|
67
|
+
],
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class SlideItem(CMSPlugin):
|
|
72
|
+
"""
|
|
73
|
+
Slide item plugin to include in a Slider plugin.
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
title = models.CharField(
|
|
77
|
+
_("title"),
|
|
78
|
+
max_length=150,
|
|
79
|
+
default="",
|
|
80
|
+
)
|
|
81
|
+
image = FilerImageField(
|
|
82
|
+
related_name="slide_image",
|
|
83
|
+
verbose_name=_("image"),
|
|
84
|
+
on_delete=models.SET_NULL,
|
|
85
|
+
null=True,
|
|
86
|
+
default=None,
|
|
87
|
+
)
|
|
88
|
+
content = models.TextField(
|
|
89
|
+
_("content"),
|
|
90
|
+
blank=True,
|
|
91
|
+
default="",
|
|
92
|
+
)
|
|
93
|
+
link_url = models.URLField(
|
|
94
|
+
verbose_name=_("link URL"),
|
|
95
|
+
blank=True,
|
|
96
|
+
null=True,
|
|
97
|
+
max_length=255,
|
|
98
|
+
help_text=_("Make the slide as a link with an URL."),
|
|
99
|
+
)
|
|
100
|
+
link_open_blank = models.BooleanField(
|
|
101
|
+
_("open new window"),
|
|
102
|
+
default=False,
|
|
103
|
+
help_text=_("If checked the link will be open in a new window"),
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
class Meta:
|
|
107
|
+
verbose_name = _("Slide item")
|
|
108
|
+
verbose_name_plural = _("Slide items")
|
|
109
|
+
|
|
110
|
+
def __str__(self):
|
|
111
|
+
return self.title
|