diff --git a/.gitignore b/.gitignore index 09cf1fb5..ec854b83 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,5 @@ semantic/dist/themes/* !semantic/dist/*.css !semantic/dist/themes/default/ wbcore/static/semantic/dist/components/ +wbcore/locale/*/LC_MESSAGES/*.mo .vscode diff --git a/wbcore/locale/de/LC_MESSAGES/django.mo b/wbcore/locale/de/LC_MESSAGES/django.mo deleted file mode 100644 index 222206da..00000000 Binary files a/wbcore/locale/de/LC_MESSAGES/django.mo and /dev/null differ diff --git a/wbcore/locale/de/LC_MESSAGES/djangojs.mo b/wbcore/locale/de/LC_MESSAGES/djangojs.mo deleted file mode 100644 index afb18036..00000000 Binary files a/wbcore/locale/de/LC_MESSAGES/djangojs.mo and /dev/null differ diff --git a/wbcore/locale/en/LC_MESSAGES/django.mo b/wbcore/locale/en/LC_MESSAGES/django.mo deleted file mode 100644 index 3d3350e5..00000000 Binary files a/wbcore/locale/en/LC_MESSAGES/django.mo and /dev/null differ diff --git a/wbcore/locale/en/LC_MESSAGES/djangojs.mo b/wbcore/locale/en/LC_MESSAGES/djangojs.mo deleted file mode 100644 index 71cbdf3e..00000000 Binary files a/wbcore/locale/en/LC_MESSAGES/djangojs.mo and /dev/null differ diff --git a/wbcore/locale/es/LC_MESSAGES/django.mo b/wbcore/locale/es/LC_MESSAGES/django.mo deleted file mode 100644 index d7e2117d..00000000 Binary files a/wbcore/locale/es/LC_MESSAGES/django.mo and /dev/null differ diff --git a/wbcore/locale/es/LC_MESSAGES/djangojs.mo b/wbcore/locale/es/LC_MESSAGES/djangojs.mo deleted file mode 100644 index 5662109a..00000000 Binary files a/wbcore/locale/es/LC_MESSAGES/djangojs.mo and /dev/null differ diff --git a/wbcore/locale/fr/LC_MESSAGES/django.mo b/wbcore/locale/fr/LC_MESSAGES/django.mo deleted file mode 100644 index ef58942b..00000000 Binary files a/wbcore/locale/fr/LC_MESSAGES/django.mo and /dev/null differ diff --git a/wbcore/locale/fr/LC_MESSAGES/djangojs.mo b/wbcore/locale/fr/LC_MESSAGES/djangojs.mo deleted file mode 100644 index 01c64384..00000000 Binary files a/wbcore/locale/fr/LC_MESSAGES/djangojs.mo and /dev/null differ diff --git a/wbcore/templates/wbcore/dot_nav.html b/wbcore/templates/wbcore/dot_nav.html index d254c2ed..b38f2117 100644 --- a/wbcore/templates/wbcore/dot_nav.html +++ b/wbcore/templates/wbcore/dot_nav.html @@ -17,58 +17,26 @@
diff --git a/wbcore/templates/wbcore/dot_nav_columns.html b/wbcore/templates/wbcore/dot_nav_columns.html index 8abad9ab..46e1dece 100644 --- a/wbcore/templates/wbcore/dot_nav_columns.html +++ b/wbcore/templates/wbcore/dot_nav_columns.html @@ -3,61 +3,38 @@ {% load humanize %}
- {% if host %} - {% trans "About" %} -
{% trans "Idea" %}
-
{% trans "History" %}
-
{% trans "Team" %}
-
{% trans "Partners" %}
-
{% trans "Donate" %}
-
{% trans "Contact" %}
- {% else %} - {% trans "About" %} -
{% trans "Idea" %}
-
{% trans "History" %}
-
{% trans "Team" %}
-
{% trans "Partners" %}
-
{% trans "Donate" %}
-
{% trans "Contact" %}
- {% endif %} + {{ dot_nav.about.name }} + {% for key, entry in dot_nav.about.entries.items %} +
{{ entry.name }}
+ {% endfor %}
- {% if host %} {% trans "News" %} - {% else %} {% trans "News" %} - {% endif %} - {% for entry in dot_nav.news %} - {% include 'wbcore/dot_nav_item.html' with image=entry.get_title_image type='news-post' id=entry.pk title=entry.title desc=entry.teaser|truncatewords:7 %} + {{ dot_nav.news.name }} + {% for item in dot_nav.news.items %} + {% include 'wbcore/dot_nav_item.html' with item=item type='news-post' %} {% endfor %}
+ {% if blog_width != 0 %}
- {% if host %} {% trans "Blog" %} - {% else %} {% trans "Blog" %} - {% endif %} - {% for entry in dot_nav.blog %} - {% include 'wbcore/dot_nav_item.html' with image=entry.get_title_image type='blog-post' id=entry.pk title=entry.title desc=entry.teaser|truncatewords:7 %} + {{ dot_nav.blog.name }} + {% for item in dot_nav.blog.items %} + {% include 'wbcore/dot_nav_item.html' with item=item type='blog-post' %} {% endfor %}
{% endif %} +
- {% if host %} - {% trans "Facts" %} -
{% trans "Transparency" %}
-
{% trans "Charter" %}
-
{% trans "Reports" %}
-
{% trans "FAQ" %}
- {% else %} - {% trans "Facts" %} -
{% trans "Transparency" %}
-
{% trans "Charter" %}
-
{% trans "Reports" %}
-
{% trans "FAQ" %}
- {% endif %} + {{ dot_nav.facts.name }} + {% for key, entry in dot_nav.facts.entries.items %} +
{{ entry.name }}
+ {% endfor %}
+
- {% if host %} {% trans "Events" %} - {% else %} {% trans "Events" %} - {% endif %} - {% include 'wbcore/dot_nav_event.html' %} + {{ dot_nav.events.name }} + {% for item in dot_nav.events.items %} + {% include 'wbcore/dot_nav_item.html' with type='event' %} + {% endfor %}
diff --git a/wbcore/templates/wbcore/dot_nav_event.html b/wbcore/templates/wbcore/dot_nav_event.html deleted file mode 100644 index 595036e6..00000000 --- a/wbcore/templates/wbcore/dot_nav_event.html +++ /dev/null @@ -1,35 +0,0 @@ -{% load static %} -{% load humanize %} - -{% for occ in dot_nav.occurrences %} -
-
-
- - {{ occ.start | naturalday:"d. M" }} {{ occ.start | time:"H:i" }} - {% if occ.recurring %} - - {% if occ.frequency_short %} {{ occ.frequency_short }} {% endif %} - {% endif %} -
- - {% if occ.location %} -
- - {{ occ.location }} -
- {% endif %} -
-
-{% endfor %} - diff --git a/wbcore/templates/wbcore/dot_nav_item.html b/wbcore/templates/wbcore/dot_nav_item.html index f61f6b94..87104d40 100644 --- a/wbcore/templates/wbcore/dot_nav_item.html +++ b/wbcore/templates/wbcore/dot_nav_item.html @@ -1,35 +1,45 @@ {% load static %} +{% load humanize %} {% load martortags %} -
- {% if image %} - {% if host %} - - {{ image.title }} - - {% else %} - - {{ image.title }} + +{% if type == 'event' %} + +
+ +
+ +{% else %} + +
+ {% if item.image %} + + {{ item.image.title }} {% endif %} - {% elif type == 'event' %} - - {% endif %} -
- {% if type == 'event'%} - {% if host %} - {{ title }} - {% else %} - {{ title }} - {% endif %} -

{{ show_date | safe }}

- {% else %} - {% if host %} - {{ title }} - {% else %} - {{ title }} +
+ {{ item.title }} + {% if not item.image %} +

{{ item.teaser | safe_markdown | striptags | truncatewords:7 }}

{% endif %} -

{{ desc | safe_markdown | striptags }}

- {% endif %} +
-
+ +{% endif %} diff --git a/wbcore/views.py b/wbcore/views.py index 5ce83972..d3d6935e 100644 --- a/wbcore/views.py +++ b/wbcore/views.py @@ -122,26 +122,107 @@ def get_main_nav(host=None, active=None): def get_dot_nav(host=None): if host: host_slug = host.slug + link_args = [host.slug] news = NewsPost.objects.filter(host=host).order_by('-published')[:3] blog = BlogPost.objects.filter(host=host).order_by('-published')[:3] events = Event.objects.filter(host=host) else: host_slug = None + link_args = [] news = NewsPost.objects.all().order_by('-published')[:3] blog = BlogPost.objects.all().order_by('-published')[:3] events = Event.objects.all() - for post in news: - if not post.teaser and post.text: - post.teaser = post.text - - for post in blog: - if not post.teaser and post.text: - post.teaser = post.text + news = item_list_from_posts(news, host_slug=host_slug, post_type='news-post') + blog = item_list_from_posts(blog, host_slug=host_slug, post_type='blog-post') occurrences = item_list_from_events(events, start=datetime.now(), host_slug=host_slug, text=False, show_only_first_occ=True, max_num_items=3) - return {'news': news, 'blog': blog, 'occurrences': occurrences} + about_entries = OrderedDict([ + ('idea', { + 'name': _('Idea'), + 'link': reverse('idea', args=link_args), + 'icon': 'lightbulb outline icon', + }), + ('history', { + 'name': _('History'), + 'link': reverse('history', args=link_args), + 'icon': 'history icon', + }), + ('teams', { + 'name': _('Team'), + 'link': reverse('teams', args=link_args), + 'icon': 'users icon', + }), + ('partners', { + 'name': _('Partners'), + 'link': reverse('partners', args=link_args), + 'icon': 'handshake icon', + }), + ('donate', { + 'name': _('Donate'), + 'link': reverse('donate', args=link_args), + 'icon': 'donate icon', + }), + ('contact', { + 'name': _('Contact'), + 'link': reverse('contact', args=link_args), + 'icon': 'address book outline icon', + }), + ]) + + facts_entries = OrderedDict([ + ('transparency', { + 'name': _('Transparency'), + 'link': reverse('transparency', args=link_args), + 'icon': 'eye outline icon', + }), + ('charter', { + 'name': _('Charter'), + 'link': reverse('charter', args=link_args), + 'icon': 'file alternate outline icon', + }), + ('reports', { + 'name': _('Reports'), + 'link': reverse('reports', args=link_args), + 'icon': 'chart line icon', + }), + ('faq', { + 'name': _('FAQ'), + 'link': reverse('faq', args=link_args), + 'icon': 'question icon', + }), + ]) + + dot_nav = OrderedDict([ + ('about', { + 'name': _('About'), + 'link': reverse('about', args=link_args), + 'entries': about_entries, + }), + ('news', { + 'name': _('News'), + 'link': reverse('news', args=link_args), + 'items': news, + }), + ('blog', { + 'name': _('Blog'), + 'link': reverse('blog', args=link_args), + 'items': blog, + }), + ('facts', { + 'name': _('Facts'), + 'link': reverse('facts', args=link_args), + 'entries': facts_entries, + }), + ('events', { + 'name': _('Events'), + 'link': reverse('events', args=link_args), + 'items': occurrences, + }), + ]) + + return dot_nav def get_meta(title=None, description=None, robots=None): meta = {