From e51cda546beab67b06025e426dcd77229ecf8115 Mon Sep 17 00:00:00 2001
From: Oleg Lavrovsky
Date: Fri, 5 May 2017 12:07:01 +0200
Subject: [PATCH 1/2] Cleaned up mockup images
---
mockup/assets/libs | 1 -
mockup/images | 1 -
.../static => mockup}/images/banner_0.jpg | Bin
.../static => mockup}/images/banner_1.jpg | Bin
.../static => mockup}/images/banner_2.jpg | Bin
.../static => mockup}/images/banner_3.jpg | Bin
.../static => mockup}/images/banner_4.jpg | Bin
{publichealth/static => mockup}/images/ipad.jpg | Bin
{publichealth/static => mockup}/images/konf.jpg | Bin
{publichealth/static => mockup}/images/lit.jpg | Bin
.../static => mockup}/images/news_1.jpg | Bin
.../images/public-health-bg.png | Bin
.../images/public-health-logo.png | Bin
{publichealth/static => mockup}/images/steth.jpg | Bin
.../static => mockup}/images/thumb_news_1.jpg | Bin
.../static => mockup}/images/thumb_news_2.jpg | Bin
publichealth/static/images/social/facebook.png | Bin 0 -> 380 bytes
publichealth/static/images/social/twitter.png | Bin 0 -> 1128 bytes
18 files changed, 2 deletions(-)
delete mode 120000 mockup/assets/libs
delete mode 120000 mockup/images
rename {publichealth/static => mockup}/images/banner_0.jpg (100%)
rename {publichealth/static => mockup}/images/banner_1.jpg (100%)
rename {publichealth/static => mockup}/images/banner_2.jpg (100%)
rename {publichealth/static => mockup}/images/banner_3.jpg (100%)
rename {publichealth/static => mockup}/images/banner_4.jpg (100%)
rename {publichealth/static => mockup}/images/ipad.jpg (100%)
rename {publichealth/static => mockup}/images/konf.jpg (100%)
rename {publichealth/static => mockup}/images/lit.jpg (100%)
rename {publichealth/static => mockup}/images/news_1.jpg (100%)
rename {publichealth/static => mockup}/images/public-health-bg.png (100%)
rename {publichealth/static => mockup}/images/public-health-logo.png (100%)
rename {publichealth/static => mockup}/images/steth.jpg (100%)
rename {publichealth/static => mockup}/images/thumb_news_1.jpg (100%)
rename {publichealth/static => mockup}/images/thumb_news_2.jpg (100%)
create mode 100644 publichealth/static/images/social/facebook.png
create mode 100644 publichealth/static/images/social/twitter.png
diff --git a/mockup/assets/libs b/mockup/assets/libs
deleted file mode 120000
index 2ce3479..0000000
--- a/mockup/assets/libs
+++ /dev/null
@@ -1 +0,0 @@
-../../../static/libs
\ No newline at end of file
diff --git a/mockup/images b/mockup/images
deleted file mode 120000
index 5e67573..0000000
--- a/mockup/images
+++ /dev/null
@@ -1 +0,0 @@
-../images
\ No newline at end of file
diff --git a/publichealth/static/images/banner_0.jpg b/mockup/images/banner_0.jpg
similarity index 100%
rename from publichealth/static/images/banner_0.jpg
rename to mockup/images/banner_0.jpg
diff --git a/publichealth/static/images/banner_1.jpg b/mockup/images/banner_1.jpg
similarity index 100%
rename from publichealth/static/images/banner_1.jpg
rename to mockup/images/banner_1.jpg
diff --git a/publichealth/static/images/banner_2.jpg b/mockup/images/banner_2.jpg
similarity index 100%
rename from publichealth/static/images/banner_2.jpg
rename to mockup/images/banner_2.jpg
diff --git a/publichealth/static/images/banner_3.jpg b/mockup/images/banner_3.jpg
similarity index 100%
rename from publichealth/static/images/banner_3.jpg
rename to mockup/images/banner_3.jpg
diff --git a/publichealth/static/images/banner_4.jpg b/mockup/images/banner_4.jpg
similarity index 100%
rename from publichealth/static/images/banner_4.jpg
rename to mockup/images/banner_4.jpg
diff --git a/publichealth/static/images/ipad.jpg b/mockup/images/ipad.jpg
similarity index 100%
rename from publichealth/static/images/ipad.jpg
rename to mockup/images/ipad.jpg
diff --git a/publichealth/static/images/konf.jpg b/mockup/images/konf.jpg
similarity index 100%
rename from publichealth/static/images/konf.jpg
rename to mockup/images/konf.jpg
diff --git a/publichealth/static/images/lit.jpg b/mockup/images/lit.jpg
similarity index 100%
rename from publichealth/static/images/lit.jpg
rename to mockup/images/lit.jpg
diff --git a/publichealth/static/images/news_1.jpg b/mockup/images/news_1.jpg
similarity index 100%
rename from publichealth/static/images/news_1.jpg
rename to mockup/images/news_1.jpg
diff --git a/publichealth/static/images/public-health-bg.png b/mockup/images/public-health-bg.png
similarity index 100%
rename from publichealth/static/images/public-health-bg.png
rename to mockup/images/public-health-bg.png
diff --git a/publichealth/static/images/public-health-logo.png b/mockup/images/public-health-logo.png
similarity index 100%
rename from publichealth/static/images/public-health-logo.png
rename to mockup/images/public-health-logo.png
diff --git a/publichealth/static/images/steth.jpg b/mockup/images/steth.jpg
similarity index 100%
rename from publichealth/static/images/steth.jpg
rename to mockup/images/steth.jpg
diff --git a/publichealth/static/images/thumb_news_1.jpg b/mockup/images/thumb_news_1.jpg
similarity index 100%
rename from publichealth/static/images/thumb_news_1.jpg
rename to mockup/images/thumb_news_1.jpg
diff --git a/publichealth/static/images/thumb_news_2.jpg b/mockup/images/thumb_news_2.jpg
similarity index 100%
rename from publichealth/static/images/thumb_news_2.jpg
rename to mockup/images/thumb_news_2.jpg
diff --git a/publichealth/static/images/social/facebook.png b/publichealth/static/images/social/facebook.png
new file mode 100644
index 0000000000000000000000000000000000000000..01837d2c1fd636835bd1490931e626a007424fba
GIT binary patch
literal 380
zcmeAS@N?(olHy`uVBq!ia0vp^3P5bn!3HE7f1TO|q&N#aB8wRq#DzeZF@63ekSfU%
z*NBqf{Irtt#G+IN$CUh}R0Yr6#Prml)Wnp^!jq{s3=E8%o-U3d6}R5ZJSf;?AmA$8
zwmYh^OhGk)eOdzNwgmPv1zC%-1)?3Y4(t(*H+l-v%yl-){hR;OeA53-oTm*wDzYqJ
zVEWTT?<8yGd5O=e*Xz_Ac8eVUhXQO5i~8oCU)$~rgOqu?
L`njxgN@xNA*Hw$3
literal 0
HcmV?d00001
diff --git a/publichealth/static/images/social/twitter.png b/publichealth/static/images/social/twitter.png
new file mode 100644
index 0000000000000000000000000000000000000000..5dfb627ba10113270c38dd797440a27383034cce
GIT binary patch
literal 1128
zcmV-u1eg1XP)|FhIn=lYR^Zb9v1SS)NPGCAg+zCo1Xf}v5LCFNc6O>L6JVEgU#uF4zKv8=n
zdaC#kNR|+}_wL1ZY$X4<-+f3YFUqon35!?hrqTfQiu0aBr73D6WmE#%1l6lFF2yCU
zG#oJArqZN--t;EdP_W3nqH??t@PZ!W5r9+t%tIS!9qzSMS0+!)-
ze!$1S{u&VDaPtnQS)kLrg!2zeJyKv$NI1bK<^_Vj<-s$euTnC!a8u+hAPfbqzDS5)
zPDOciGz_q}EQ0lEdw~nxBFDE1Ch40B7!R}|@`yoVVd|E7VaIz@)
z4Fg7w00v_xty_4YMOZ?}mK6f{im6SCV}+9Z;KgLgd9A=S;=AIp*9~>$!F13TEqeqc
zDBQt3cLi8brfNB}s_9JK2$it^~WpD|#EAwCU2&7z_;)NBGR
zow2p`0rFZ7wbX?^A1GN71q=jsl#FkU_1OiL!
zPR~2wTOJ(ZF$H^?UM!~Ojp#y!)06LK
zO96X=0V_Lw+Y%xR0Xq-fR3qYI;DNHKrXfE;LLc2?#3?)%)0cJX^Ke?$2UE&XPf
zv^1XO)n_kB>9sNlumB`BR4)`Al68@~CN$7|2Fd+yj)F;Uur#?dz{0+Of(F5*#A|tI
zU27XDDcjQOD0(ymu#-x_##ow*G&F5Na*y*;dOlSIw1Cnzm?uwgp^fe(QY&xpQJ!Jx
zLsQZks-z<#3T^j}t7sBhb)BLFZ{6PT=bV0Nde>)^fIGt*3dNbTuSsfRBK#65zOq84DV
u$ST-^
Date: Fri, 5 May 2017 12:07:50 +0200
Subject: [PATCH 2/2] Social media accounts support
---
.../home/migrations/0016_socialcontact.py | 23 ++++++++++++
publichealth/home/models/snippets.py | 36 +++++++++++++++++++
.../home/templates/tags/contact_info.html | 8 +++++
.../home/templates/tags/contact_links.html | 10 +++++-
publichealth/home/templatetags/information.py | 4 ++-
publichealth/static/css/modules/_footer.scss | 35 ++++++++++++++++++
publichealth/static/css/modules/_forms.scss | 15 --------
publichealth/templates/header.html | 4 +--
8 files changed, 116 insertions(+), 19 deletions(-)
create mode 100644 publichealth/home/migrations/0016_socialcontact.py
diff --git a/publichealth/home/migrations/0016_socialcontact.py b/publichealth/home/migrations/0016_socialcontact.py
new file mode 100644
index 0000000..ff5a64c
--- /dev/null
+++ b/publichealth/home/migrations/0016_socialcontact.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.7 on 2017-05-05 08:43
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('home', '0015_dataletssettings'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='SocialContact',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('network', models.CharField(choices=[('twitter', 'Twitter'), ('facebook', 'Facebook')], default='twitter', max_length=16)),
+ ('profile', models.CharField(default='', help_text='Name of the account, e.g. @myaccount', max_length=255)),
+ ],
+ ),
+ ]
diff --git a/publichealth/home/models/snippets.py b/publichealth/home/models/snippets.py
index f9f1255..f8b261b 100644
--- a/publichealth/home/models/snippets.py
+++ b/publichealth/home/models/snippets.py
@@ -11,8 +11,44 @@ from wagtail.wagtailadmin.edit_handlers import FieldPanel
from ..util import TranslatedField
+# List of supported social networks
+SOCIAL_NETWORK_SUPPORTED = (
+ ('twitter', 'Twitter'),
+ ('facebook', 'Facebook'),
+)
+
+@register_snippet
+class SocialContact(models.Model):
+ """
+ Adds contact options through social networks
+ """
+ network = models.CharField(max_length=16, default="twitter",
+ choices=SOCIAL_NETWORK_SUPPORTED)
+ profile = models.CharField(max_length=255, default="",
+ help_text="Name of the account, e.g. @myaccount, or full URL")
+ panels = [
+ FieldPanel('network'),
+ FieldPanel('profile'),
+ ]
+ social_networks = dict(SOCIAL_NETWORK_SUPPORTED)
+ def network_title(self):
+ return self.social_networks[self.network]
+ def network_url(self):
+ if '://' in self.profile:
+ return self.profile
+ if self.network == 'twitter':
+ return "https://twitter.com/%s" % self.profile
+ elif self.network == 'facebook':
+ return "https://facebook.com/%s" % self.profile
+ return "#"
+ def __str__(self):
+ return "%s" % self.network
+
@register_snippet
class Contact(models.Model):
+ """
+ Defines contact options for the organisation, usually shown in footer
+ """
title = models.CharField(max_length=255, default="")
title_fr = models.CharField(max_length=255, default="")
trans_title = TranslatedField(
diff --git a/publichealth/home/templates/tags/contact_info.html b/publichealth/home/templates/tags/contact_info.html
index dbecca3..48af078 100644
--- a/publichealth/home/templates/tags/contact_info.html
+++ b/publichealth/home/templates/tags/contact_info.html
@@ -6,3 +6,11 @@
{{ contact.email }}
{{ contact.www_domain }}
+
+
diff --git a/publichealth/home/templates/tags/contact_links.html b/publichealth/home/templates/tags/contact_links.html
index 1fbe73f..324ec8a 100644
--- a/publichealth/home/templates/tags/contact_links.html
+++ b/publichealth/home/templates/tags/contact_links.html
@@ -1,7 +1,15 @@
+
+{% for sc in socials %}
+
+ {{ sc.network_title }}
+{% endfor %}
+
+
{{ contact.phone }}
-
+
{{ contact.email }}
diff --git a/publichealth/home/templatetags/information.py b/publichealth/home/templatetags/information.py
index 090ce05..564a230 100644
--- a/publichealth/home/templatetags/information.py
+++ b/publichealth/home/templatetags/information.py
@@ -2,7 +2,7 @@
from django import template
from django.utils import translation
-from ..models.snippets import Contact
+from ..models.snippets import Contact, SocialContact
register = template.Library()
@@ -11,6 +11,7 @@ register = template.Library()
def contact_info():
return {
'contact': Contact.objects.last(),
+ 'socials': SocialContact.objects.all()
}
# Contact form (footer)
@@ -25,6 +26,7 @@ def contact_form():
def contact_links():
return {
'contact': Contact.objects.last(),
+ 'socials': SocialContact.objects.all()
}
# Styled contact name (header)
diff --git a/publichealth/static/css/modules/_footer.scss b/publichealth/static/css/modules/_footer.scss
index 5c8343b..ddccdce 100644
--- a/publichealth/static/css/modules/_footer.scss
+++ b/publichealth/static/css/modules/_footer.scss
@@ -19,3 +19,38 @@ footer#footer {
article footer .btn {
margin-bottom: 1em;
}
+
+// Footer search form
+#search-form {
+
+ input {
+ float: left;
+ width: auto;
+ color: white;
+ }
+ button {
+ background: none; border: none;
+ padding-top: 0.5em;
+ }
+
+}
+
+// Footer contact form
+#contact-info {
+ address {
+ margin-bottom: 0px;
+ }
+ .social-networks > a {
+ border: 2px solid white;
+ width: 32px; height: 32px;
+ }
+}
+
+.social-networks > a {
+ width: 14px; height: 14px;
+ font-size: 0px !important;
+ display: inline-block;
+ background-size: auto 70%;
+ background-repeat: no-repeat;
+ background-position: center;
+}
diff --git a/publichealth/static/css/modules/_forms.scss b/publichealth/static/css/modules/_forms.scss
index 705f234..453089d 100644
--- a/publichealth/static/css/modules/_forms.scss
+++ b/publichealth/static/css/modules/_forms.scss
@@ -31,18 +31,3 @@
}
}
-
-// Footer search form
-#search-form {
-
- input {
- float: left;
- width: auto;
- color: white;
- }
- button {
- background: none; border: none;
- padding-top: 0.5em;
- }
-
-}
diff --git a/publichealth/templates/header.html b/publichealth/templates/header.html
index bf2bb2f..ca961e5 100644
--- a/publichealth/templates/header.html
+++ b/publichealth/templates/header.html
@@ -1,4 +1,4 @@
-{% load wagtailcore_tags navigation information %}
+{% load static wagtailcore_tags navigation information %}
{% get_site_root as site_root %}