feat(images): diversifie les tailles d image incrustees au texte

pull/101/head
François Poulain 2019-09-11 13:50:14 +02:00 commité par François Poulain
Parent 5fa06df7f6
révision 02362ac198
2 fichiers modifiés avec 30 ajouts et 0 suppressions

Voir le fichier

@ -7,6 +7,11 @@
max-width: 33%;
height: auto;
margin-right: 2rem;
@each $width in 33, 50, 66 {
&.w-#{$width} {
max-width: percentage($width / 100);
}
}
}
.richtext-image.right {
@ -14,6 +19,11 @@
max-width: 33%;
height: auto;
margin-left: 2rem;
@each $width in 33, 50, 66 {
&.w-#{$width} {
max-width: percentage($width / 100);
}
}
}
.richtext-image.full-width {

Voir le fichier

@ -0,0 +1,20 @@
# image_formats.py
from wagtail.images.formats import (
Format,
register_image_format,
unregister_image_format,
)
unregister_image_format('left')
unregister_image_format('right')
for _sens, sens in [('left', 'gauche'), ('right', 'droite')]:
for _width, width in [('33', '1/3'), ('50', '1/2'), ('66', '2/3')]:
register_image_format(
Format(
'{}-{}'.format(_sens, _width) if _width != '33' else _sens,
'alignée à {}, largeur {}'.format(sens, width),
'richtext-image {} w-{}'.format(_sens, _width),
'width-{}'.format(1500 * int(_width) // 100),
)
)