From afbfb16a3571bd631993cf911042e9dca1a544eb Mon Sep 17 00:00:00 2001
From: Oleg Lavrovsky
Date: Mon, 4 Sep 2017 23:22:38 +0200
Subject: [PATCH 1/6] Revert feed layout styles
---
feedler/templates/feedler/feed_page.html | 4 ++--
publichealth/home/templates/news.html | 3 ++-
publichealth/static/css/modules/_news.scss | 10 ++++++++--
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/feedler/templates/feedler/feed_page.html b/feedler/templates/feedler/feed_page.html
index df5c33e..2792e81 100644
--- a/feedler/templates/feedler/feed_page.html
+++ b/feedler/templates/feedler/feed_page.html
@@ -34,8 +34,8 @@
{{ entry.title|striptags|truncatewords_html:10 }}
- {{ entry.author }}
- {{ entry.content|striptags|truncatewords_html:25 }}
+ {{ entry.content|striptags|truncatewords_html:25 }}
+ {{ entry.author }}
diff --git a/publichealth/home/templates/news.html b/publichealth/home/templates/news.html
index e31f305..6ebb419 100644
--- a/publichealth/home/templates/news.html
+++ b/publichealth/home/templates/news.html
@@ -41,7 +41,8 @@
{{ entry.title|striptags|truncatewords_html:10 }}
- {{ entry.author }}
+ {{ entry.content|striptags|truncatewords_html:25 }}
+ {{ entry.author }}
diff --git a/publichealth/static/css/modules/_news.scss b/publichealth/static/css/modules/_news.scss
index 418cec4..f823a59 100644
--- a/publichealth/static/css/modules/_news.scss
+++ b/publichealth/static/css/modules/_news.scss
@@ -46,6 +46,12 @@
margin: 10px 0 0 15px;
text-align: center;
}
+ em {
+ display: block;
+ font-size: 95%;
+ margin: 0.5em 0;
+ font-weight: 500;
+ }
}
// expand link over the thumbnail
@@ -77,14 +83,14 @@
}
.news-entry {
- height: 8em;
+ // height: 8em;
.panel {
background: none;
box-shadow: none;
border: none;
}
.panel-body {
- height: 50%;
+ // height: 50%;
background-color: #f0f0f0;
border-radius: 4px;
border-top: 3px solid $brand-primary;
From b332697aba9230a9f795cb000616633dc4a326b2 Mon Sep 17 00:00:00 2001
From: Oleg Lavrovsky
Date: Tue, 5 Sep 2017 10:54:43 +0200
Subject: [PATCH 2/6] Pagination
---
feedler/models/models.py | 18 +++++++++++++-----
feedler/templates/feedler/feed_page.html | 20 ++++++++++++++++++++
publichealth/home/models/models.py | 2 +-
publichealth/home/templates/news.html | 7 ++++---
publichealth/static/css/modules/_news.scss | 2 +-
5 files changed, 39 insertions(+), 10 deletions(-)
diff --git a/feedler/models/models.py b/feedler/models/models.py
index 83e9240..b47fc14 100644
--- a/feedler/models/models.py
+++ b/feedler/models/models.py
@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
from django.db import models
+from django.utils import translation
+from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from wagtail.wagtailcore.models import Page, Orderable
from wagtail.wagtailadmin.edit_handlers import FieldPanel
from wagtail.wagtailcore.fields import RichTextField
-from django.utils import translation
-
class Stream(models.Model):
title = models.CharField(max_length=255)
ident = models.CharField(max_length=255)
@@ -70,13 +70,21 @@ class FeedPage(Page):
elif curlang in ['fr']:
entries = entries.exclude(lang='de')
# Order by most recent date first
- entries = entries.order_by('-published')
- return entries[:10]
+ return entries.order_by('-published')
def get_context(self, request):
# Update template context
context = super(FeedPage, self).get_context(request)
- context['feedentries'] = self.feedentries
+
+ # Wrap with pagination
+ paginator = Paginator(self.feedentries, 9)
+ page = request.GET.get('page')
+ try:
+ feedentries = paginator.page(page)
+ except (PageNotAnInteger, EmptyPage):
+ feedentries = paginator.page(1)
+
+ context['feedentries'] = feedentries
return context
class Meta:
diff --git a/feedler/templates/feedler/feed_page.html b/feedler/templates/feedler/feed_page.html
index 2792e81..3a6eab6 100644
--- a/feedler/templates/feedler/feed_page.html
+++ b/feedler/templates/feedler/feed_page.html
@@ -19,9 +19,29 @@
+
+
+
+
+
+
+
{% for entry in feedentries %}
diff --git a/publichealth/home/models/models.py b/publichealth/home/models/models.py
index 5354862..6fd1eb1 100644
--- a/publichealth/home/models/models.py
+++ b/publichealth/home/models/models.py
@@ -239,7 +239,7 @@ class HomePage(Page):
entries = entries.exclude(lang='fr')
elif curlang in ['fr']:
entries = entries.exclude(lang='de')
- return entries[:6]
+ return entries[:3]
def get_context(self, request):
# Update template context
diff --git a/publichealth/home/templates/news.html b/publichealth/home/templates/news.html
index 6ebb419..168393f 100644
--- a/publichealth/home/templates/news.html
+++ b/publichealth/home/templates/news.html
@@ -20,7 +20,7 @@
{{ entry.body|striptags|truncatewords_html:40 }}
{% endif %}
-
...
+
🡆
@@ -28,7 +28,7 @@
{% empty %}
{% endfor %}
-
+
{% for entry in newsentries %}
@@ -45,7 +45,8 @@
{{ entry.author }}
-
+
+
{% empty %}
diff --git a/publichealth/static/css/modules/_news.scss b/publichealth/static/css/modules/_news.scss
index f823a59..0fd3bd7 100644
--- a/publichealth/static/css/modules/_news.scss
+++ b/publichealth/static/css/modules/_news.scss
@@ -91,7 +91,7 @@
}
.panel-body {
// height: 50%;
- background-color: #f0f0f0;
+ background-color: #ffffff;
border-radius: 4px;
border-top: 3px solid $brand-primary;
// border: 2px solid rgba(38, 67, 169, 0.8);
From 671768700a8d5eff87b25f2943ad4872387aa3bc Mon Sep 17 00:00:00 2001
From: Oleg Lavrovsky
Date: Tue, 5 Sep 2017 10:57:33 +0200
Subject: [PATCH 3/6] Max 8 pages of results
---
feedler/models/models.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/feedler/models/models.py b/feedler/models/models.py
index b47fc14..3b77c6c 100644
--- a/feedler/models/models.py
+++ b/feedler/models/models.py
@@ -70,7 +70,7 @@ class FeedPage(Page):
elif curlang in ['fr']:
entries = entries.exclude(lang='de')
# Order by most recent date first
- return entries.order_by('-published')
+ return entries.order_by('-published')[:72]
def get_context(self, request):
# Update template context
From ef3cca5218c3cdcab318bc65a3efb2ec243b0d2c Mon Sep 17 00:00:00 2001
From: Oleg Lavrovsky
Date: Tue, 5 Sep 2017 11:02:54 +0200
Subject: [PATCH 4/6] Home page container sections
---
publichealth/home/templates/home/home_page.html | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/publichealth/home/templates/home/home_page.html b/publichealth/home/templates/home/home_page.html
index 4c5e3ff..df0d537 100644
--- a/publichealth/home/templates/home/home_page.html
+++ b/publichealth/home/templates/home/home_page.html
@@ -13,6 +13,8 @@
{% include 'banner.html' %}
+
+
{% include 'news.html' %}
@@ -28,4 +30,6 @@
{% include 'infos.html' %}
+
+
{% endblock %}
From 05f7349ed702744032f333a42d1e9a37f5e8507c Mon Sep 17 00:00:00 2001
From: Oleg Lavrovsky
Date: Tue, 5 Sep 2017 11:08:18 +0200
Subject: [PATCH 5/6] Front page colors
---
publichealth/home/templates/news.html | 2 +-
publichealth/static/css/modules/_banner.scss | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/publichealth/home/templates/news.html b/publichealth/home/templates/news.html
index 168393f..c4fe148 100644
--- a/publichealth/home/templates/news.html
+++ b/publichealth/home/templates/news.html
@@ -45,7 +45,7 @@
{{ entry.author }}
-
+
diff --git a/publichealth/static/css/modules/_banner.scss b/publichealth/static/css/modules/_banner.scss
index 38b279a..19f4f20 100644
--- a/publichealth/static/css/modules/_banner.scss
+++ b/publichealth/static/css/modules/_banner.scss
@@ -80,8 +80,11 @@
}
}
-
-
+/* Home page banner background */
+body.template-frontpage {
+ background: $gray-lighter;
+ .home_page section:nth-child(even) { background: white; }
+}
/* Page header */
$banner-height: 700px;
From dd9691524f5851732a1133d6883661cdc4a8aac9 Mon Sep 17 00:00:00 2001
From: Oleg Lavrovsky
Date: Tue, 5 Sep 2017 11:14:12 +0200
Subject: [PATCH 6/6] Disable pastel colors and raw data
---
feedler/templates/feedler/feed_page.html | 3 +--
publichealth/static/js/main.js | 12 ++++++------
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/feedler/templates/feedler/feed_page.html b/feedler/templates/feedler/feed_page.html
index 3a6eab6..34ed625 100644
--- a/feedler/templates/feedler/feed_page.html
+++ b/feedler/templates/feedler/feed_page.html
@@ -44,7 +44,7 @@
{% for entry in feedentries %}
-
+
{% if entry.visual %}
@@ -61,7 +61,6 @@
-
{% empty %}
{% endfor %}
diff --git a/publichealth/static/js/main.js b/publichealth/static/js/main.js
index 3c51033..982e842 100644
--- a/publichealth/static/js/main.js
+++ b/publichealth/static/js/main.js
@@ -18,11 +18,11 @@ $(document).ready(function() {
nextArrow: '
Next',
});
- // Formatting of live news
- $('.feedpage-body .panel').each(function() {
- var hue = Math.floor(Math.random() * 360);
- var pastel = 'hsl(' + hue + ', 100%, 87.5%)';
- $(this).css('border-top', '3px solid ' + pastel);
- });
+ // Pastel colors on live news
+ // $('.feedpage-body .panel').each(function() {
+ // var hue = Math.floor(Math.random() * 360);
+ // var pastel = 'hsl(' + hue + ', 100%, 87.5%)';
+ // $(this).css('border-top', '3px solid ' + pastel);
+ // });
});