From 8d967eef0b4a5e032a046b6f35be1829f5404526 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Je=CC=81re=CC=81my=20Fabre?= Date: Mon, 5 Sep 2016 17:42:46 +0200 Subject: [PATCH] Add the briefs, articles and custompages to the homepage --- app/static/src/sass/config/_config.scss | 7 ++ app/static/src/sass/modules/_all.scss | 1 + .../src/sass/modules/boxes/_brief-box.scss | 68 +++++++++++++++++++ app/templates/home/inc/body.html | 26 +++---- app/templates/home/inc/brief_card.html | 31 ++++++--- app/templates/home/inc/generic_card.html | 56 ++++++++++++--- .../article/includes/article_card.html | 10 +-- 7 files changed, 161 insertions(+), 38 deletions(-) create mode 100644 app/static/src/sass/modules/boxes/_brief-box.scss diff --git a/app/static/src/sass/config/_config.scss b/app/static/src/sass/config/_config.scss index 6346c5af..11d703c0 100644 --- a/app/static/src/sass/config/_config.scss +++ b/app/static/src/sass/config/_config.scss @@ -6,3 +6,10 @@ $header-height: 78px; // Home $home-slider-height: 760px; + +// Brief box + +$brief-box-background: #5F5F5E; +$brief-box-background-head: #868686; +$brief-box-color-head: #000000; +$brief-box-color: #FFFFFF; diff --git a/app/static/src/sass/modules/_all.scss b/app/static/src/sass/modules/_all.scss index 3a90e375..48d5e0d7 100755 --- a/app/static/src/sass/modules/_all.scss +++ b/app/static/src/sass/modules/_all.scss @@ -7,6 +7,7 @@ // Boxes @import 'boxes/article-box'; @import 'boxes/page-box'; +@import 'boxes/brief-box'; // Sliders @import 'sliders/slider-page'; diff --git a/app/static/src/sass/modules/boxes/_brief-box.scss b/app/static/src/sass/modules/boxes/_brief-box.scss new file mode 100644 index 00000000..635082d7 --- /dev/null +++ b/app/static/src/sass/modules/boxes/_brief-box.scss @@ -0,0 +1,68 @@ +$module: ".brief-box"; + +#{$module} { + + position: relative; + @include padding(1); + @include margin-bottom(1); + text-align: center; + + background: $brief-box-background; + + &__head { + + text-transform: uppercase; + display: inline-block; + background: $brief-box-background-head; + color: $brief-box-color-head; + + @include padding(0 1); + + @include font-size(m); + @include line-height(1.25); + @include typeface(sans-serif); + font-weight: weight(regular); + + } + + &__title { + + display: block; + margin: 0 auto; + color: $brief-box-color; + + @include margin-top(3); + @include margin-bottom(1); + + @include font-size(xl); + @include line-height(1.25); + @include typeface(serif); + font-weight: weight(heavy); + + } + + &__desc { + + display: block; + margin: 0 auto; + color: $brief-box-color; + + @include margin-bottom(1); + + @include font-size(xl); + @include line-height(1.25); + @include typeface(serif); + font-weight: weight(light); + + } + + &__button { + + @extend .button; + @extend .button--small; + + @include margin-bottom(3); + + } + +} diff --git a/app/templates/home/inc/body.html b/app/templates/home/inc/body.html index 92b41113..5bcfdfa4 100644 --- a/app/templates/home/inc/body.html +++ b/app/templates/home/inc/body.html @@ -1,13 +1,13 @@ -
-

Body

-
-{% for body in home.dynamiccontenthomebody_set.all %} - {% if body.content_type.model == "brief" %} - {% include "home/inc/brief_card.html" %} - {% else %} - {% include "home/inc/generic_card.html" %} - {% endif %} -{% endfor %} - -
-
+
+
+ {% for body in home.dynamiccontenthomebody_set.all %} +
+ {% if body.content_type.model == "brief" %} + {% include "home/inc/brief_card.html" %} + {% else %} + {% include "home/inc/generic_card.html" %} + {% endif %} +
+ {% endfor %} +
+
diff --git a/app/templates/home/inc/brief_card.html b/app/templates/home/inc/brief_card.html index 9303afb5..e9b66265 100644 --- a/app/templates/home/inc/brief_card.html +++ b/app/templates/home/inc/brief_card.html @@ -1,10 +1,21 @@ -

{{ body.content_object.title }}


-

{{ body.content_object.description|slice:":500" }}

-{% if body.content_object.external_content %} -{{ body.content_object.text_button }}
-{% elif body.content_object.content_object %} -{{ body.content_object.text_button }}
-{% endif %} -{{ body.content_object.title }}
- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+{% load i18n %} + +
+ +
+ {% trans 'Brief !' %} +
+ +

{{ body.content_object.title }}

+
+ {{ body.content_object.description|slice:":500" }} +
+ {% if body.content_object.external_content %} + {{ body.content_object.text_button }} + {% elif body.content_object.content_object %} + {{ body.content_object.text_button }} + {% else %} + {{ body.content_object.title }} + {% endif %} + +
diff --git a/app/templates/home/inc/generic_card.html b/app/templates/home/inc/generic_card.html index b74bb8f4..3594b48f 100644 --- a/app/templates/home/inc/generic_card.html +++ b/app/templates/home/inc/generic_card.html @@ -1,10 +1,46 @@ -{% load organization_tags i18n %} -

{{ body.content_object.title }}


-

{{ body.content_object.description|slice:":500" }}

-{% with body.content_object.images.all|get_type:'card' as image %} - {% if image %} -
- {% endif %} -{% endwith %} -{{ body.content_object.title }}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+{% load i18n pages_tags mezzanine_tags media_tags organization_tags %} + + +
+
+ {% with body.content_object.images.all|get_type:'card' as image %} + {% if image %} + + {% endif %} + {% endwith %} +
+ {% if body.content_type.model == 'article' %} +
+
+ {% trans 'News' %} +
+ {% if body.content_object.department %} +
+ {{ body.content_object.department.name }} +
+ {% endif %} +
+ {% elif body.content_type.model == 'event' %} + + {% endif %} +
+ +
+

{{ body.content_object.title }}

+
+ {% if body.content_type.model == 'article' %} + {{ body.content_object.publish_date|date:"DATE_FORMAT" }} + {% for category in body.content_object.categories.all %} + {% if forloop.first %} | {% endif %} + {% if not forloop.first %}, {% endif %} + {{ category }} + {% endfor %} + {% elif body.content_type.model == 'event' %} + + {% endif %} +
+
+ {{ body.content_object.description|richtext_filters|safe|truncatechars_html:200 }} +
+
+
diff --git a/app/templates/magazine/article/includes/article_card.html b/app/templates/magazine/article/includes/article_card.html index 5794e821..1e30eb5a 100644 --- a/app/templates/magazine/article/includes/article_card.html +++ b/app/templates/magazine/article/includes/article_card.html @@ -3,11 +3,11 @@
- {% with article.images.all|get_type:'card' as images %} - {% if images %} - - {% endif %} - {% endwith %} + {% with article.images.all|get_type:'card' as images %} + {% if images %} + + {% endif %} + {% endwith %}
-- 2.39.5