Merge pull request #9 from datalets/mobile-nav-79

Mobile navigation fix
This commit is contained in:
khashashin 2017-05-16 12:12:35 +02:00 committed by GitHub
commit a008e5b1e8
19 changed files with 119 additions and 120 deletions

View file

@ -65,13 +65,10 @@ django-shell:
logs:
docker-compose logs -f --tail=500
django-backup:
backup:
docker-compose exec web ./manage.py dumpdata --natural-foreign --indent=4 -e contenttypes -e auth.Permission -e sessions -e wagtailcore.pagerevision -e wagtailcore.groupcollectionpermission > ~/publichealth.home.json
backup-archive:
gzip -1q ~/publichealth.home.json
backup: django-backup backup-archive
zip ~/publichealth.home.json.`date +"%d%m%Y-%H%M"`.zip ~/publichealth.home.json
rm ~/publichealth.home.json
django-loaddata:
gunzip ~/publichealth.home.json.gz
@ -90,10 +87,15 @@ pg-exec:
docker-compose exec postgres bash
pg-dump:
docker-compose exec postgres bash -c 'pg_dump -U postgres -d postgres -f ./dumps/latest.sql'
docker-compose exec postgres bash -c 'pg_dump -U postgres -d postgres -f ./latest.sql'
pg-backup:
docker-compose exec postgres bash -c 'pg_dump -U postgres -d postgres' > ~/pg-backup.sql
zip ~/pg-backup.sql.`date +"%d%m%Y-%H%M"`.zip ~/pg-backup.sql
rm ~/pg-backup.sql
pg-restore:
docker-compose exec postgres bash -c 'psql -U postgres -d postgres -f ./dumps/latest.sql'
docker-compose exec postgres bash -c 'psql -U postgres -d postgres -f ./latest.sql'
pg-surefire-drop-restore-db:
# drop existing database, recreate it, and then restore its content from backup.

View file

@ -19,8 +19,7 @@ server {
gzip_vary on;
location /static/ {
access_log off;
expires 3600;
access_log off; expires 36000;
alias {{ release_dir }}/static/;
add_header Cache-Control "public";
add_header Access-Control-Allow-Origin https://{{ domain }};
@ -28,17 +27,20 @@ server {
# Set a longer expiry for CACHE/, because the filenames are unique.
location /static/CACHE/ {
access_log off;
expires 864000;
access_log off; expires 864000;
alias {{ release_dir }}/static/CACHE/;
}
location /favicon.ico {
access_log off; expires max;
alias {{ release_dir }}/static/images/favicon.ico;
}
# Only serve /media/images by default, not e.g. original_images/.
location /media/images {
alias {{ release_dir }}/media/images;
access_log off;
expires max;
add_header Cache-Control "public";
access_log off; expires max;
add_header Cache-Control "public";
}
location / {

View file

@ -1,57 +0,0 @@
# Public Health CMS stage
upstream wagtail-stage {
server localhost:5000;
}
server {
listen 80;
server_name ph-alpha.nebula1.public-health.ch;
client_max_body_size 64M;
gzip on;
gzip_types text/plain text/css application/x-javascript image/svg+xml;
gzip_comp_level 1;
gzip_disable msie6;
gzip_http_version 1.0;
gzip_proxied any;
gzip_vary on;
location /static/ {
access_log off;
expires 3600;
alias /opt/public-health-ch/static/;
}
# Set a longer expiry for CACHE/, because the filenames are unique.
location /static/CACHE/ {
access_log off;
expires 864000;
alias /opt/public-health-ch/static/CACHE/;
}
# Only server /media/images by default, not e.g. original_images/.
location /media/images {
expires 864000;
alias /opt/public-health-ch/media/images;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://wagtail-stage;
}
}
server {
listen 80; listen 443 ssl;
server_name conference.public-health.ch;
location /fr {
return 301 $scheme://sph17.organizers-congress.org/frontend/index.php?sub=89;
}
location / {
return 301 $scheme://sph17.organizers-congress.org;
}
}

View file

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-05-11 08:01
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('home', '0017_auto_20170510_1627'),
]
operations = [
migrations.AddField(
model_name='contact',
name='contact_form',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='home.ContactForm'),
),
]

View file

@ -7,8 +7,9 @@ from django.db import models
from wagtail.wagtailsnippets.models import register_snippet
from wagtail.wagtailcore.models import Page
from wagtail.wagtailadmin.edit_handlers import FieldPanel
from wagtail.wagtailadmin.edit_handlers import FieldPanel, PageChooserPanel
from .forms import ContactForm
from ..util import TranslatedField
# List of supported social networks
@ -59,11 +60,19 @@ class Contact(models.Model):
phone = models.CharField(max_length=40, default="")
email = models.EmailField(max_length=100, default="")
www = models.URLField(null=True, blank=True)
map_url = models.URLField(null=True, blank=True,
help_text="Optional link of address to mapping provider")
analytics = models.CharField(max_length=60, default="", blank=True,
help_text="Optional web analytics property code")
contact_form = models.ForeignKey(
'home.ContactForm',
null=True, blank=True,
on_delete=models.SET_NULL,
related_name='+',
)
panels = Page.content_panels + [
FieldPanel('title_fr'),
FieldPanel('address'),
@ -72,6 +81,7 @@ class Contact(models.Model):
FieldPanel('www'),
FieldPanel('map_url'),
FieldPanel('analytics'),
PageChooserPanel('contact_form', 'home.ContactForm'),
]
def phone_link(self):

View file

@ -9,7 +9,7 @@
<a href="{% pageurl entry %}">
<div class="carousel-caption">
<h3>{{ entry.trans_title }}</h3>
<p>{{ entry.trans_intro|richtext }}</p>
{{ entry.trans_intro|richtext }}
</div>
</a>
</div>

View file

@ -6,10 +6,8 @@
{% block content %}
<section id="contact-page">
<div class="container">
<h2>{{ page.title }}</h2>
<center>
<h2>{{ page.title }}</h2>
<p class="lead">{{ page.thanks|richtext }}</p>
</center>
</div>

View file

@ -1,8 +1,13 @@
{% extends "base.html" %}
{% load wagtailcore_tags %}
{% load static wagtailcore_tags %}
{% block body_class %}template-{{ self.get_verbose_name|slugify }}{% endblock %}
{% block extra_css %}
<link rel="stylesheet" type="text/x-scss" href="{% static 'libs/slick-carousel/slick/slick.scss' %}">
<link rel="stylesheet" type="text/x-scss" href="{% static 'libs/slick-carousel/slick/slick-theme.scss' %}">
{% endblock %}
{% block content %}
<!-- Banner (articles) -->

View file

@ -1,12 +0,0 @@
<form action="https://formspree.io/{{ contact.email }}" method="POST">
<div class="form-group">
<input name="name" id="name" type="text" placeholder="Name / Nom" class="form-control">
</div>
<div class="form-group">
<input name="_replyto" id="email" type="email" placeholder="E-Mail" class="form-control">
</div>
<div class="form-group">
<textarea name="message" id="message" rows="3" placeholder="Nachricht / Message" class="form-control"></textarea>
</div>
<button class="btn btn-primary" type="submit">Senden / Envoi</button>
</form>

View file

@ -1,4 +1,4 @@
<span class="social-networks">
<span class="social-networks hidden-xs">
{% for sc in socials %}
<a href="{{ sc.network_url }}" target="_blank" title="{{ sc.network_title }}"
style="background-image:url(/static/images/social/{{ sc.network }}.png)">
@ -6,10 +6,16 @@
{% endfor %}
</span>
<a href="{{ contact.phone_link }}">
<a href="{{ contact.phone_link }}" class="hidden-xs">
<span class="glyphicon glyphicon-earphone" aria-hidden="true"></span>
<span class="hidden">{{ contact.phone }}</span></a>
<a href="{{ contact.email_link }}">
<a href="{{ contact.email_link }}" class="hidden-xs">
<span class="glyphicon glyphicon-envelope" aria-hidden="true"></span>
<span class="hidden">{{ contact.email }}</span></a>
<a class="link visible-xs-inline" href="#contact-info" title="Contact">
<span class="glyphicon glyphicon-earphone" aria-hidden="true"></span></a>
<a class="link visible-xs-inline" href="#contact-info" title="Contact">
<span class="glyphicon glyphicon-envelope" aria-hidden="true"></span></a>

View file

@ -0,0 +1,16 @@
{% load wagtailcore_tags %}
{% if form %}
<form action="{% pageurl form %}" method="POST">
{% csrf_token %}
<div class="form-group">
<input name="name" id="id_name" type="text" placeholder="Name / Nom" class="form-control" required>
</div>
<div class="form-group">
<input name="email" id="id_email" type="email" placeholder="E-Mail" class="form-control" required>
</div>
<div class="form-group">
<textarea name="message" id="id_message" rows="3" placeholder="Nachricht / Message" class="form-control" required></textarea>
</div>
<button class="btn btn-primary" type="submit">Senden / Envoi</button>
</form>
{% endif %}

View file

@ -15,11 +15,12 @@ def contact_info():
}
# Contact form (footer)
@register.inclusion_tag('tags/contact_form.html')
def contact_form():
return {
'contact': Contact.objects.last(),
}
@register.inclusion_tag('tags/footer_form.html')
def footer_form():
if Contact.objects.last():
return {
'form': Contact.objects.last().contact_form,
}
# Contact links (header)
@register.inclusion_tag('tags/contact_links.html')

View file

@ -28,6 +28,11 @@
border: 1px solid $gray-light;
padding: 3px;
}
// Full width comment on mobile screens
@include max-screen($screen-xs-max) {
textarea { width: 100%; }
}
}
}

View file

@ -18,6 +18,13 @@
&.link {
text-transform: uppercase;
}
&:hover {
text-decoration: none;
}
}
.social-networks {
top: -1px; position: relative;
a { margin: 0 10px; }
}
}
.language-nav {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,022 B

View file

@ -1,8 +1,5 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

View file

@ -1,11 +1,6 @@
{% load compress static wagtailuserbar %}
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<!-- TODO: aad html lang="de-CH" attribute -->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
@ -14,14 +9,15 @@
<meta name="description" content="{% block description %}{% endblock %}">
{% compress css %}
<link rel="stylesheet" type="text/x-scss" href="{% static 'libs/slick-carousel/slick/slick.scss' %}">
<link rel="stylesheet" type="text/x-scss" href="{% static 'libs/slick-carousel/slick/slick-theme.scss' %}">
{% block extra_css %}{% endblock %}
<link rel="stylesheet" type="text/x-scss" href="{% static 'css/main.scss' %}">
{% endcompress %}
{% block extra_css %}
{% endblock %}
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="{% block body_class %}{% endblock %}">

View file

@ -17,14 +17,14 @@
</button>
</form>
</div>
<div class="col-md-8" id="contact-info">
<a name="contact-info"></a>
<div class="col-md-4" id="contact-info">
{% contact_info %}
</div>
<!--
<div class="col-md-4" id="contact-form">
{# contact_form #}
{% footer_form %}
</div>
-->
</div><!-- /row -->
</div><!-- /container -->
</footer>

View file

@ -5,7 +5,10 @@
<div class="container">
<div class="nav">
<span class="contact-nav">
<a class="link" href="#contact-info">Kontakt</a>
<a class="link" href="#contact-info" title="Contact">
<span class="glyphicon glyphicon-user" aria-hidden="true"></span>
<span class="sr-only">Contact</span>
</a>
{% contact_links %}
</span>
<span class="language-nav">
@ -16,10 +19,9 @@
</nav>
<nav class="navbar navbar-default navbar-main navbar-fixed-top">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="sr-only">Navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>