Merge branch 'master' into social-accounts
This commit is contained in:
commit
2724ed6f4e
14 changed files with 82 additions and 30 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,6 +4,7 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.swp
|
*.swp
|
||||||
*.sqlite3
|
*.sqlite3
|
||||||
|
/docker-compose.yml
|
||||||
/env/
|
/env/
|
||||||
/venv/
|
/venv/
|
||||||
/static/
|
/static/
|
||||||
|
|
8
Makefile
8
Makefile
|
@ -39,10 +39,18 @@ setup:
|
||||||
|
|
||||||
release:
|
release:
|
||||||
docker-compose build web
|
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 stop web
|
||||||
docker-compose kill web
|
docker-compose kill web
|
||||||
docker-compose up -d 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:
|
django-exec-bash:
|
||||||
# execute bash in the currently running container
|
# execute bash in the currently running container
|
||||||
docker-compose exec web bash
|
docker-compose exec web bash
|
||||||
|
|
|
@ -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.
|
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
|
ansible-playbook -s ansible/<*.yaml> -i ansible/inventories/production
|
||||||
|
|
|
@ -31,6 +31,6 @@ postgres:
|
||||||
ports:
|
ports:
|
||||||
- "5432:5432"
|
- "5432:5432"
|
||||||
elasticsearch:
|
elasticsearch:
|
||||||
image: orchardup/elasticsearch
|
image: elasticsearch:2
|
||||||
ports:
|
ports:
|
||||||
- "9200:9200"
|
- "9200:9200"
|
||||||
|
|
|
@ -2,17 +2,16 @@
|
||||||
|
|
||||||
from modelcluster.fields import ParentalKey
|
from modelcluster.fields import ParentalKey
|
||||||
|
|
||||||
from wagtail.wagtailadmin.edit_handlers import (
|
|
||||||
FieldPanel, FieldRowPanel,
|
|
||||||
InlinePanel, MultiFieldPanel
|
|
||||||
)
|
|
||||||
|
|
||||||
from django.db.models import CharField
|
from django.db.models import CharField
|
||||||
|
|
||||||
from wagtail.wagtailcore.fields import RichTextField
|
from wagtail.wagtailcore.fields import RichTextField
|
||||||
from wagtail.wagtailforms.models import (
|
from wagtail.wagtailforms.models import (
|
||||||
AbstractEmailForm, AbstractFormField
|
AbstractEmailForm, AbstractFormField
|
||||||
)
|
)
|
||||||
from wagtail.wagtailsearch import index
|
from wagtail.wagtailadmin.edit_handlers import (
|
||||||
|
FieldPanel, FieldRowPanel,
|
||||||
|
InlinePanel, MultiFieldPanel
|
||||||
|
)
|
||||||
|
|
||||||
from ..util import TranslatedField
|
from ..util import TranslatedField
|
||||||
|
|
||||||
|
@ -23,8 +22,6 @@ class ContactForm(AbstractEmailForm):
|
||||||
intro = RichTextField(default='', blank=True)
|
intro = RichTextField(default='', blank=True)
|
||||||
thanks = RichTextField(default='', blank=True)
|
thanks = RichTextField(default='', blank=True)
|
||||||
|
|
||||||
search_fields = [ index.SearchField('intro') ]
|
|
||||||
|
|
||||||
content_panels = AbstractEmailForm.content_panels + [
|
content_panels = AbstractEmailForm.content_panels + [
|
||||||
FieldPanel('intro', classname="full"),
|
FieldPanel('intro', classname="full"),
|
||||||
FieldPanel('thanks', classname="full"),
|
FieldPanel('thanks', classname="full"),
|
||||||
|
|
|
@ -112,12 +112,12 @@ class ArticlePage(Page):
|
||||||
)
|
)
|
||||||
|
|
||||||
search_fields = Page.search_fields + [
|
search_fields = Page.search_fields + [
|
||||||
index.SearchField('body_de'),
|
index.SearchField('title', partial_match=True, boost=10),
|
||||||
index.SearchField('body_fr'),
|
index.SearchField('title_fr', partial_match=True, boost=10),
|
||||||
index.SearchField('title'),
|
index.SearchField('body_de', partial_match=True),
|
||||||
index.SearchField('title_fr'),
|
index.SearchField('body_fr', partial_match=True),
|
||||||
index.SearchField('intro_de'),
|
index.SearchField('intro_de', partial_match=True),
|
||||||
index.SearchField('intro_fr'),
|
index.SearchField('intro_fr', partial_match=True),
|
||||||
]
|
]
|
||||||
content_panels = [
|
content_panels = [
|
||||||
MultiFieldPanel([
|
MultiFieldPanel([
|
||||||
|
|
|
@ -40,9 +40,9 @@
|
||||||
</header>
|
</header>
|
||||||
{{ block.value.summary|richtext }}
|
{{ block.value.summary|richtext }}
|
||||||
{% if block.value.action %}
|
{% if block.value.action %}
|
||||||
<footer>
|
<footer>
|
||||||
<a href="{{ block.value.url }}" class="btn btn-default">{{ block.value.action }}</a>
|
<a href="{{ block.value.url }}" class="btn btn-default">{{ block.value.action }}</a>
|
||||||
</footer>
|
</footer>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</article>
|
</article>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -7,10 +7,12 @@ register = template.Library()
|
||||||
# Language switcher
|
# Language switcher
|
||||||
@register.inclusion_tag('tags/language.html', takes_context=True)
|
@register.inclusion_tag('tags/language.html', takes_context=True)
|
||||||
def language_switcher(context):
|
def language_switcher(context):
|
||||||
url = context['page'].url.split('/')
|
url = '/$lang$'
|
||||||
if len(url) > 2 and len(url[1]) >= 2:
|
if 'page' in context:
|
||||||
url[1] = '$lang$'
|
url = context['page'].url.split('/')
|
||||||
url = '/'.join(url)
|
if len(url) > 2 and len(url[1]) >= 2:
|
||||||
|
url[1] = '$lang$'
|
||||||
|
url = '/'.join(url)
|
||||||
return {
|
return {
|
||||||
'languages': [
|
'languages': [
|
||||||
{ 'code': 'de', 'title': 'De', 'url': url.replace('$lang$','de') },
|
{ 'code': 'de', 'title': 'De', 'url': url.replace('$lang$','de') },
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<center>
|
<center>
|
||||||
<form action="{% url 'search' %}" method="get">
|
<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">
|
<button type="submit" title="Search">
|
||||||
<span class="glyphicon glyphicon-search" aria-hidden="false"></span>
|
<span class="glyphicon glyphicon-search" aria-hidden="false"></span>
|
||||||
</button>
|
</button>
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
{{ search_results.next_page_number }}</a>
|
{{ search_results.next_page_number }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% elif search_query %}
|
{% 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 %}
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -145,7 +145,7 @@ if REDIS_LOCATION is not None:
|
||||||
if 'ELASTICSEARCH_URL' in env:
|
if 'ELASTICSEARCH_URL' in env:
|
||||||
WAGTAILSEARCH_BACKENDS = {
|
WAGTAILSEARCH_BACKENDS = {
|
||||||
'default': {
|
'default': {
|
||||||
'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch5',
|
'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch2',
|
||||||
'URLS': [env['ELASTICSEARCH_URL']],
|
'URLS': [env['ELASTICSEARCH_URL']],
|
||||||
'INDEX': APP_NAME,
|
'INDEX': APP_NAME,
|
||||||
'ATOMIC_REBUILD': True,
|
'ATOMIC_REBUILD': True,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Article sections
|
// Article sections
|
||||||
section {
|
section {
|
||||||
padding: 6em 0;
|
padding: 3em 0;
|
||||||
|
|
||||||
&:nth-child(odd) {
|
&:nth-child(odd) {
|
||||||
background-color: $gray-lighter;
|
background-color: $gray-lighter;
|
||||||
}
|
}
|
||||||
|
@ -20,14 +21,23 @@ section {
|
||||||
h5 { font-size: 22px; }
|
h5 { font-size: 22px; }
|
||||||
|
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
|
|
||||||
|
img.full-width {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Article content blocks
|
// Article content blocks
|
||||||
.article-body > div {
|
.article-body > div {
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
.infoblocks article:nth-child(3n+0) {
|
.infoblocks {
|
||||||
clear: both;
|
.image img {
|
||||||
|
width: 300px; height: 300px;
|
||||||
|
}
|
||||||
|
article:nth-child(3n+1) {
|
||||||
|
clear: left;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special article layout
|
// Special article layout
|
||||||
|
|
|
@ -7,6 +7,10 @@ footer#footer {
|
||||||
a {
|
a {
|
||||||
color: lighten($brand-secondary, 25%);
|
color: lighten($brand-secondary, 25%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
margin-bottom: 2em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.copyright {
|
.copyright {
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ dj-database-url==0.4.2
|
||||||
puput==0.8
|
puput==0.8
|
||||||
|
|
||||||
# Search
|
# Search
|
||||||
elasticsearch>=5.0.0,<6.0.0
|
elasticsearch>=2.0.0,<3.0.0
|
||||||
|
|
||||||
# Caching
|
# Caching
|
||||||
django-redis==4.8.0
|
django-redis==4.8.0
|
||||||
|
|
Loading…
Reference in a new issue