Search styling
This commit is contained in:
parent
8d777f545d
commit
6fdae0efd8
5 changed files with 32 additions and 6 deletions
3
Makefile
3
Makefile
|
@ -48,6 +48,9 @@ release:
|
|||
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
|
||||
|
|
|
@ -11,6 +11,7 @@ from wagtail.wagtailcore.fields import StreamField, RichTextField
|
|||
from wagtail.wagtailadmin.edit_handlers import FieldPanel, StreamFieldPanel, InlinePanel, MultiFieldPanel
|
||||
from wagtail.wagtailimages.blocks import ImageChooserBlock
|
||||
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
|
||||
from wagtail.wagtailsearch import index
|
||||
|
||||
from puput.models import EntryPage
|
||||
|
||||
|
@ -110,6 +111,14 @@ class ArticlePage(Page):
|
|||
related_name='+'
|
||||
)
|
||||
|
||||
search_fields = Page.search_fields + [
|
||||
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([
|
||||
FieldPanel('title'),
|
||||
|
|
|
@ -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') },
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -46,3 +46,15 @@
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
#search-page {
|
||||
input[type='text'] {
|
||||
font-size: 110%;
|
||||
}
|
||||
h4 {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
.container > center {
|
||||
margin-bottom: 3em;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue