Merge branch 'master' into social-accounts

This commit is contained in:
datalets 2017-05-05 14:50:01 +02:00 committed by GitHub
commit 2724ed6f4e
14 changed files with 82 additions and 30 deletions

1
.gitignore vendored
View file

@ -4,6 +4,7 @@
.DS_Store
*.swp
*.sqlite3
/docker-compose.yml
/env/
/venv/
/static/

View file

@ -39,10 +39,18 @@ setup:
release:
docker-compose build web
docker-compose exec web ./manage.py collectstatic --noinput
docker-compose exec web ./manage.py compress
docker-compose stop web
docker-compose kill web
docker-compose up -d web
reindex:
docker-compose exec web ./manage.py update_index
clear_index:
docker-compose exec elasticsearch curl -XDELETE localhost:9200/_all
django-exec-bash:
# execute bash in the currently running container
docker-compose exec web bash

View file

@ -72,7 +72,9 @@ Now access the admin panel with the user account you created earlier: http://loc
We use [Ansible](https://www.ansible.com) and [Docker Compose](https://docs.docker.com/compose/reference/overview/) for automated deployment.
You need to obtain SSH and vault keys, and place these in a `.keys` folder - then to deploy a site:
To use Docker Compose to deploy the site, copy `ansible/roles/web/templates/docker-compose.j2` to `/docker-compose.yml` and fill in all `{{ variables }}`. This is done automatically in Ansible.
To do production deployments, you need to obtain SSH and vault keys from your system administrator (who has followed the Ansible guide to set up a vault..), and place these in a `.keys` folder - then to deploy a site:
```
ansible-playbook -s ansible/<*.yaml> -i ansible/inventories/production

View file

@ -31,6 +31,6 @@ postgres:
ports:
- "5432:5432"
elasticsearch:
image: orchardup/elasticsearch
image: elasticsearch:2
ports:
- "9200:9200"

View file

@ -2,17 +2,16 @@
from modelcluster.fields import ParentalKey
from wagtail.wagtailadmin.edit_handlers import (
FieldPanel, FieldRowPanel,
InlinePanel, MultiFieldPanel
)
from django.db.models import CharField
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailforms.models import (
AbstractEmailForm, AbstractFormField
)
from wagtail.wagtailsearch import index
from wagtail.wagtailadmin.edit_handlers import (
FieldPanel, FieldRowPanel,
InlinePanel, MultiFieldPanel
)
from ..util import TranslatedField
@ -23,8 +22,6 @@ class ContactForm(AbstractEmailForm):
intro = RichTextField(default='', blank=True)
thanks = RichTextField(default='', blank=True)
search_fields = [ index.SearchField('intro') ]
content_panels = AbstractEmailForm.content_panels + [
FieldPanel('intro', classname="full"),
FieldPanel('thanks', classname="full"),

View file

@ -112,12 +112,12 @@ class ArticlePage(Page):
)
search_fields = Page.search_fields + [
index.SearchField('body_de'),
index.SearchField('body_fr'),
index.SearchField('title'),
index.SearchField('title_fr'),
index.SearchField('intro_de'),
index.SearchField('intro_fr'),
index.SearchField('title', partial_match=True, boost=10),
index.SearchField('title_fr', partial_match=True, boost=10),
index.SearchField('body_de', partial_match=True),
index.SearchField('body_fr', partial_match=True),
index.SearchField('intro_de', partial_match=True),
index.SearchField('intro_fr', partial_match=True),
]
content_panels = [
MultiFieldPanel([

View file

@ -40,9 +40,9 @@
</header>
{{ block.value.summary|richtext }}
{% if block.value.action %}
<footer>
<a href="{{ block.value.url }}" class="btn btn-default">{{ block.value.action }}</a>
</footer>
<footer>
<a href="{{ block.value.url }}" class="btn btn-default">{{ block.value.action }}</a>
</footer>
{% endif %}
</article>
{% endif %}

View file

@ -7,10 +7,12 @@ register = template.Library()
# Language switcher
@register.inclusion_tag('tags/language.html', takes_context=True)
def language_switcher(context):
url = context['page'].url.split('/')
if len(url) > 2 and len(url[1]) >= 2:
url[1] = '$lang$'
url = '/'.join(url)
url = '/$lang$'
if 'page' in context:
url = context['page'].url.split('/')
if len(url) > 2 and len(url[1]) >= 2:
url[1] = '$lang$'
url = '/'.join(url)
return {
'languages': [
{ 'code': 'de', 'title': 'De', 'url': url.replace('$lang$','de') },

View file

@ -10,7 +10,7 @@
<div class="container">
<center>
<form action="{% url 'search' %}" method="get">
<input type="text" name="query"{% if search_query %} value="{{ search_query }}{% endif %}">
<input type="text" name="query"{% if search_query %} value="{{ search_query }}"{% endif %}>
<button type="submit" title="Search">
<span class="glyphicon glyphicon-search" aria-hidden="false"></span>
</button>
@ -53,7 +53,7 @@
{{ search_results.next_page_number }}</a>
{% endif %}
{% elif search_query %}
<b>Leider keine Ergebnisse / Désolé, aucun résultat n'a été trouvé</b>
<center><h5><i>Leider keine Ergebnisse gefunden<br><br>Désolé, aucun résultat n'a été trouvé</i></h5></center>
{% endif %}
</div>

View file

@ -145,7 +145,7 @@ if REDIS_LOCATION is not None:
if 'ELASTICSEARCH_URL' in env:
WAGTAILSEARCH_BACKENDS = {
'default': {
'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch5',
'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch2',
'URLS': [env['ELASTICSEARCH_URL']],
'INDEX': APP_NAME,
'ATOMIC_REBUILD': True,

View file

@ -1,6 +1,7 @@
// Article sections
section {
padding: 6em 0;
padding: 3em 0;
&:nth-child(odd) {
background-color: $gray-lighter;
}
@ -20,14 +21,23 @@ section {
h5 { font-size: 22px; }
line-height: 1.5;
img.full-width {
width: 100%;
}
}
// Article content blocks
.article-body > div {
clear: both;
}
.infoblocks article:nth-child(3n+0) {
clear: both;
.infoblocks {
.image img {
width: 300px; height: 300px;
}
article:nth-child(3n+1) {
clear: left;
}
}
// Special article layout

View file

@ -7,6 +7,10 @@ footer#footer {
a {
color: lighten($brand-secondary, 25%);
}
form {
margin-bottom: 2em;
}
}
.copyright {

View file

@ -31,3 +31,31 @@
}
}
// Footer search form
#search-form {
input {
float: left;
width: auto;
color: white;
}
button {
background: none; border: none;
padding-top: 0.5em;
}
}
// Search result form
#search-page {
input[type='text'] {
font-size: 110%;
}
h4 {
margin-bottom: 0px;
}
.container > center {
margin-bottom: 3em;
}
}

View file

@ -12,7 +12,7 @@ dj-database-url==0.4.2
puput==0.8
# Search
elasticsearch>=5.0.0,<6.0.0
elasticsearch>=2.0.0,<3.0.0
# Caching
django-redis==4.8.0