Removed Image Text 2 Component (#2820)

This commit is contained in:
Youri 2019-03-14 13:45:54 -04:00 коммит произвёл GitHub
Родитель b9adc34955
Коммит 52dfefd1b0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 91 добавлений и 70 удалений

Просмотреть файл

@ -86,9 +86,9 @@ In addition to the standard Wagtail-supplied blocks, the `customblocks.py` files
This block sets up a button that links out to a URL, using `wagtailpages/templates/wagtailpages/blocks/link_button_block.html` as its rendering template.
#### 2. ImageTextBlock2
#### 2. ImageTextBlock
This block sets up a text-with-image (image can be placed either right or left of the text), using `wagtailpages/templates/wagtailpages/blocks/image_text_block.html` as its rendering template.
This block sets up a text-with-image (image can be placed either right or left of the text), using `wagtailpages/templates/wagtailpages/blocks/image_text.html` as its rendering template.
#### 3. VerticalSpacerBlock

Просмотреть файл

@ -88,42 +88,6 @@ class AlignedImageBlock(ImageBlock):
template = 'wagtailpages/blocks/aligned_image_block.html'
class ImageTextBlock2(ImageBlock):
text = blocks.RichTextBlock(
features=['bold', 'italic', 'h2', 'h3', 'h4', 'h5', 'h6', 'ol', 'ul', 'link']
)
url = blocks.CharBlock(
required=False,
help_text='Optional URL that this image should link out to.',
)
small = blocks.BooleanBlock(
required=False,
help_text='Use smaller, fixed image size (eg: icon)',
)
top_divider = blocks.BooleanBlock(
required=False,
help_text='Optional divider above content block.',
)
bottom_divider = blocks.BooleanBlock(
required=False,
help_text='Optional divider below content block.',
)
def get_context(self, value, parent_context=None):
context = super().get_context(value, parent_context=parent_context)
divider_styles = []
if value.get("top_divider"):
divider_styles.append('div-top')
if value.get("bottom_divider"):
divider_styles.append('div-bottom')
context['divider_styles'] = ' '.join(divider_styles)
return context
class Meta:
icon = 'doc-full'
template = 'wagtailpages/blocks/image_text_block2.html'
class ImageTextBlock(ImageBlock):
text = blocks.RichTextBlock(
features=['bold', 'italic', 'h2', 'h3', 'h4', 'h5', 'h6', 'ol', 'ul', 'link']

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -39,7 +39,6 @@ base_fields = [field for field in [
]
)),
('image', customblocks.AnnotatedImageBlock()),
('image_text2', customblocks.ImageTextBlock2()),
('image_text', customblocks.ImageTextBlock()),
('image_text_mini', customblocks.ImageTextMini()),
('figure', customblocks.FigureBlock()),

Просмотреть файл

@ -1,31 +0,0 @@
{% load wagtailcore_tags wagtailimages_tags %}
<div class="row my-4">
{% if value.small %}
<div class="col-12 d-flex flex-nowrap">
<div class="mr-3" style="width:50px; flex-shrink:0;">
{% if value.url %}<a href="{{ value.url }}">{% endif %}
{% image value.image fill-100x100-c100 format-jpeg class="w-100" %}
{% if value.url %}</a>{% endif %}
</div>
<div>
{{ value.text|richtext }}
</div>
</div>
{% else %}
<div class="col-12 image-text-img">
<div class="col-12 px-0 d-md-flex align-items-md-center {{ divider_styles }}">
<div class="col-12 col-md-3 mb-3 mb-md-0 pl-0">
{% if value.url %}<a href="{{ value.url }}">{% endif %}
{% image value.image fill-760x760-c100 format-jpeg %}
{% if value.url %}</a>{% endif %}
</div>
<div class="col-12 col-md-9 pl-0">
{{ value.text|richtext }}
</div>
</div>
</div>
{% endif %}
</div>