News page template

This commit is contained in:
Oleg Lavrovsky 2017-03-13 23:13:45 +01:00
parent 118603a760
commit 51e3a70922
4 changed files with 35 additions and 30 deletions

View file

@ -13,8 +13,6 @@ from wagtail.wagtailimages.blocks import ImageChooserBlock
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
from wagtail.wagtailsearch import index
from puput.models import EntryPage, BlogPage
from .util import TranslatedField
class ArticleIndexPage(Page):
@ -104,9 +102,9 @@ class ArticlePage(Page):
FieldPanel('intro_fr'),
StreamFieldPanel('body_fr'),
], heading="Français"),
ImageChooserPanel('feed_image'),
]
promote_panels = [
ImageChooserPanel('feed_image'),
FieldPanel('date'),
InlinePanel('related_links', label="Links"),
MultiFieldPanel(Page.promote_panels, "Common page configuration"),
@ -125,15 +123,6 @@ class ArticleRelatedLink(Orderable):
FieldPanel('url'),
]
class NewsEntryPage(EntryPage):
video_url = models.URLField()
content_panels = EntryPage.content_panels + [
FieldPanel('video_url')
]
class Meta:
verbose_name = "News"
BlogPage.subpage_types = NewsEntryPage
class InfoBlock(blocks.StructBlock):
title = blocks.CharBlock(required=True)
photo = ImageChooserBlock()

View file

@ -7,9 +7,11 @@
<section id="news-details">
<div class="container">
{% if page.feed_image %}
<div class="image">
{% image page.feed_image fill-940x400 class="img-responsive" %}
</div>
{% endif %}
<h2>{{ page.trans_title }}</h2>
@ -21,7 +23,6 @@
<!-- Main content -->
<div class="article-body" role="main">
{% for block in page.trans_body %}
{% if block.block_type == 'heading' %}
<h3>{{ block.value }}</h3>
@ -31,7 +32,6 @@
</p>
{% endif %}
{% endfor %}
</div>
</div>
</section>

View file

@ -24,24 +24,26 @@
{% endblock social_share %}
{% block content %}
<div class="container">
<article class="box page-content"
<section id="news-details">
<article class="container"
{%if self.id %}data-entry-page-update-comments-url="{% url 'entry_page_update_comments' self.id %}{% endif %}">
{% include 'puput/entry_page_header.html' with entry=self %}
{% if self.header_image %}
<section>
<span class="image featured">
{% image self.header_image fill-800x450 as header_image %}
<img alt="{{ self.header_image.title }}" src="{{ header_image.url }}">
</span>
</section>
{% endif %}
<section>
{{ self.body|richtext}}
</section>
{% show_comments %}
{% if self.header_image %}
<div class="image">
{% image self.header_image fill-940x300 as header_image %}
<img alt="{{ self.header_image.title }}" src="{{ header_image.url }}" class="img-responsive">
</div>
{% endif %}
{% include 'puput/entry_page_header.html' with entry=self %}
<div class="article-body" role="main">
{{ self.body|richtext}}
</div>
{% show_comments %}
</article>
</div>
</section>
{% endblock content %}
{% block extra_content %}

View file

@ -108,4 +108,18 @@
.backlink {
margin-top: 3em;
}
.img-responsive {
width: 100%;
}
.links {
display: inline-block;
border-bottom: 1px solid #999;
padding: 1em;
margin: 0em;
list-style-type: none;
li:first-child { display: none; }
}
}