From 06ade77fceb38375f478df09524c46cce4ff5a61 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Tue, 8 Sep 2015 06:23:32 +0200 Subject: [PATCH 1/7] PoC integration --- digitalglarus/templates/glarus_blog/base.html | 13 ++++++ .../glarus_blog/includes/blog_item.html | 22 ++++++++++ .../glarus_blog/includes/blog_meta.html | 26 ++++++++++++ .../templates/glarus_blog/post_detail.html | 26 ++++++++++++ .../templates/glarus_blog/post_list.html | 41 +++++++++++++++++++ digitalglarus/urls.py | 2 + digitalglarus/views.py | 20 +++++++++ 7 files changed, 150 insertions(+) create mode 100644 digitalglarus/templates/glarus_blog/base.html create mode 100644 digitalglarus/templates/glarus_blog/includes/blog_item.html create mode 100644 digitalglarus/templates/glarus_blog/includes/blog_meta.html create mode 100644 digitalglarus/templates/glarus_blog/post_detail.html create mode 100644 digitalglarus/templates/glarus_blog/post_list.html diff --git a/digitalglarus/templates/glarus_blog/base.html b/digitalglarus/templates/glarus_blog/base.html new file mode 100644 index 00000000..69f50d5b --- /dev/null +++ b/digitalglarus/templates/glarus_blog/base.html @@ -0,0 +1,13 @@ +{% extends "digitalglarus/base.html" %} + +{% block meta %} + {% if meta %} + {% include "meta_mixin/meta.html" %} + {% endif %} +{% endblock meta %} + +{% block content %} +
+ {% block content_blog %}{% endblock %} +
+{% endblock content %} diff --git a/digitalglarus/templates/glarus_blog/includes/blog_item.html b/digitalglarus/templates/glarus_blog/includes/blog_item.html new file mode 100644 index 00000000..7340962f --- /dev/null +++ b/digitalglarus/templates/glarus_blog/includes/blog_item.html @@ -0,0 +1,22 @@ +{% load i18n thumbnail %} + +
+
+

{{ post.title }}

+ {% block blog_meta %} + {% include "glarus_blog/includes/blog_meta.html" %} + {% endblock %} +
+ {% if image and post.main_image %} +
+ {% thumbnail post.main_image post.thumbnail_options.size crop=post.thumbnail_options.crop upscale=post.thumbnail_options.upscale subject_location=post.main_image.subject_location as thumb %} + {{ post.main_image.default_alt_text }} +
+ {% endif %} +
+ {{ post.abstract| safe }} +
+ +
\ No newline at end of file diff --git a/digitalglarus/templates/glarus_blog/includes/blog_meta.html b/digitalglarus/templates/glarus_blog/includes/blog_meta.html new file mode 100644 index 00000000..24ca606a --- /dev/null +++ b/digitalglarus/templates/glarus_blog/includes/blog_meta.html @@ -0,0 +1,26 @@ +{% load i18n thumbnail %} + + + \ No newline at end of file diff --git a/digitalglarus/templates/glarus_blog/post_detail.html b/digitalglarus/templates/glarus_blog/post_detail.html new file mode 100644 index 00000000..ed71df5e --- /dev/null +++ b/digitalglarus/templates/glarus_blog/post_detail.html @@ -0,0 +1,26 @@ +{% extends "glarus_blog/base.html" %} +{% load i18n thumbnail cms_tags %} + +{% block meta_description %}{{ post.meta_description }}{% endblock meta_description %} +{% block meta_keywords %}{{ post.meta_keywords }}{% endblock meta_keywords %} +{% block canonical_url %}{% endblock canonical_url %} +{% block title %}{{ post.get_title }}{% endblock %} + +{% block content_blog %}{% spaceless %} +
+
+

{{ post.title }}

+ {% block blog_meta %} + {% include "glarus_blog/includes/blog_meta.html" %} + {% endblock %} +
+ {% if post.main_image_id %} +
+ {% thumbnail post.main_image post.full_image_options.size crop=post.full_image_options.crop upscale=post.full_image_options.upscale subject_location=post.main_image.subject_location as thumb %} + {{ post.main_image.default_alt_text }} +
+ {% endif %} + {% endspaceless %} +
{% render_placeholder post.content %}
+
+{% endblock content_blog %} diff --git a/digitalglarus/templates/glarus_blog/post_list.html b/digitalglarus/templates/glarus_blog/post_list.html new file mode 100644 index 00000000..d640f30e --- /dev/null +++ b/digitalglarus/templates/glarus_blog/post_list.html @@ -0,0 +1,41 @@ +{% extends "glarus_blog/base.html" %} +{% load i18n thumbnail %}{% spaceless %} + +{% block canonical_url %}{% endblock canonical_url %} + +{% block content_blog %} +
+ {% block blog_title %} +
+

+ {% if author %}{% trans "Articles by" %} {{ author.get_full_name }} + {% elif archive_date %}{% trans "Archive" %} – {% if month %}{{ archive_date|date:'F' }} {% endif %}{{ year }} + {% elif tagged_entries %}{% trans "Tag" %} – {{ tagged_entries|capfirst }} + {% elif category %}{% trans "Category" %} – {{ category }}{% endif %} +

+
+ {% endblock %} + {% for post in post_list %} + {% include "glarus_blog/includes/blog_item.html" with post=post image="true" TRUNCWORDS_COUNT=TRUNCWORDS_COUNT %} + {% empty %} +

{% trans "No article found." %}

+ {% endfor %} + {% if author or archive_date or tagged_entries %} +

{% trans "Back" %}

+ {% endif %} + {% if is_paginated %} + + {% endif %} +
+{% endblock %} +{% endspaceless %} \ No newline at end of file diff --git a/digitalglarus/urls.py b/digitalglarus/urls.py index c1ef0c5e..d08b5085 100644 --- a/digitalglarus/urls.py +++ b/digitalglarus/urls.py @@ -6,4 +6,6 @@ urlpatterns = [ url(r'^$', views.index, name='index'), url(r'about$', views.about, name='about'), url(r'contact$', views.contact, name='contact'), + url(r'blog/$', views.blog, name='blog'), + url(r'^blog/(?P\w[-\w]*)/$', views.blog_detail, name='blog-detail'), ] diff --git a/digitalglarus/views.py b/digitalglarus/views.py index c9d3feec..debfb528 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -4,6 +4,8 @@ from django.shortcuts import get_object_or_404, render from django.forms import ModelForm from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse +from django.utils.translation import get_language +from djangocms_blog.models import Post from .models import Message @@ -43,3 +45,21 @@ def contact(request): } return render(request, 'digitalglarus/contact.html', context) + + +def blog(request): + tags = ["glarus"] + posts = Post.objects.filter(tags__name__in=tags) + context = { + 'post_list': posts, + } + return render(request, 'glarus_blog/post_list.html', context) + + +def blog_detail(request, slug): + language = get_language() + post = Post.objects.translated(language, slug=slug).language(language).get() + context = { + 'post': post, + } + return render(request, 'glarus_blog/post_detail.html', context) From d97dd31fc9b9a3b2e1f842bb5eead3879fef0219 Mon Sep 17 00:00:00 2001 From: rscnt Date: Sat, 26 Sep 2015 13:03:10 -0600 Subject: [PATCH 2/7] views: digitalglarus, added digitalglarus tag on post lookup Signed-off-by: rscnt --- digitalglarus/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/digitalglarus/views.py b/digitalglarus/views.py index 5929abd0..9818060c 100644 --- a/digitalglarus/views.py +++ b/digitalglarus/views.py @@ -60,7 +60,7 @@ def contact(request): def blog(request): - tags = ["glarus"] + tags = ["digitalglarus, glarus"] posts = Post.objects.filter(tags__name__in=tags) context = { 'post_list': posts, From 111cafb41871f233d9032b388b183afeb4b0d390 Mon Sep 17 00:00:00 2001 From: rscnt Date: Sat, 26 Sep 2015 13:03:51 -0600 Subject: [PATCH 3/7] digitalglarus: templates/base.html added blog link Signed-off-by: rscnt --- digitalglarus/templates/digitalglarus/base.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/digitalglarus/templates/digitalglarus/base.html b/digitalglarus/templates/digitalglarus/base.html index 43256d2f..3aa2482d 100644 --- a/digitalglarus/templates/digitalglarus/base.html +++ b/digitalglarus/templates/digitalglarus/base.html @@ -72,11 +72,14 @@
  • Home
  • +
  • + Contact +
  • About
  • - Contact + Blog
  • @@ -94,7 +97,7 @@
    -

    Copyright © ungleich GmbH 2015

    +

    Copyright © ungleich GmbH 2015

    From 434d614d8fb67921069537310d1bad1e97c7e6a3 Mon Sep 17 00:00:00 2001 From: rscnt Date: Sat, 26 Sep 2015 13:04:14 -0600 Subject: [PATCH 4/7] digitalglarus: templates, glarus_blog styling base Signed-off-by: rscnt --- digitalglarus/templates/glarus_blog/base.html | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/digitalglarus/templates/glarus_blog/base.html b/digitalglarus/templates/glarus_blog/base.html index 69f50d5b..40ad0c65 100644 --- a/digitalglarus/templates/glarus_blog/base.html +++ b/digitalglarus/templates/glarus_blog/base.html @@ -1,13 +1,19 @@ {% extends "digitalglarus/base.html" %} {% block meta %} - {% if meta %} - {% include "meta_mixin/meta.html" %} - {% endif %} +{% if meta %} +{% include "meta_mixin/meta.html" %} +{% endif %} {% endblock meta %} -{% block content %} -
    - {% block content_blog %}{% endblock %} +
    + {% block content %} +
    +
    +
    + {% block content_blog %}{% endblock %} +
    +
    +
    + {% endblock content %}
    -{% endblock content %} From 6bc4d5a6a234c6ff2b5ae92b43408424b0fca61d Mon Sep 17 00:00:00 2001 From: rscnt Date: Sat, 26 Sep 2015 13:04:48 -0600 Subject: [PATCH 5/7] digitalglarus: blog_item, added style. Signed-off-by: rscnt --- .../glarus_blog/includes/blog_item.html | 50 +++++++++++-------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/digitalglarus/templates/glarus_blog/includes/blog_item.html b/digitalglarus/templates/glarus_blog/includes/blog_item.html index 7340962f..4565a4e7 100644 --- a/digitalglarus/templates/glarus_blog/includes/blog_item.html +++ b/digitalglarus/templates/glarus_blog/includes/blog_item.html @@ -1,22 +1,32 @@ {% load i18n thumbnail %} -
    -
    -

    {{ post.title }}

    - {% block blog_meta %} - {% include "glarus_blog/includes/blog_meta.html" %} - {% endblock %} -
    - {% if image and post.main_image %} -
    - {% thumbnail post.main_image post.thumbnail_options.size crop=post.thumbnail_options.crop upscale=post.thumbnail_options.upscale subject_location=post.main_image.subject_location as thumb %} - {{ post.main_image.default_alt_text }} -
    - {% endif %} -
    - {{ post.abstract| safe }} -
    - -
    \ No newline at end of file +
    + {% if image and post.main_image %} +
    + {% thumbnail post.main_image post.full_image_options.size crop=post.full_image_options.crop upscale=post.full_image_options.upscale subject_location=post.main_image.subject_location as thumb %} + {{ post.main_image.default_alt_text }} +
    + {% endif %} +
    + {% block blog_meta %} + {# include "glarus_blog/includes/blog_meta.html" #} + {% endblock %} +

    + + {{ post.title }} + +
    + + {{ post.date_created }} + +

    +
    +
    +

    + {{ post.abstract| safe }} +

    +
    + +
    From c10fea01694f8f3114354789c545bb0454a54500 Mon Sep 17 00:00:00 2001 From: rscnt Date: Sat, 26 Sep 2015 13:07:52 -0600 Subject: [PATCH 6/7] digitalglarus: templates. blog_meta inline metadata. Signed-off-by: rscnt --- .../glarus_blog/includes/blog_meta.html | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/digitalglarus/templates/glarus_blog/includes/blog_meta.html b/digitalglarus/templates/glarus_blog/includes/blog_meta.html index 24ca606a..b9e78570 100644 --- a/digitalglarus/templates/glarus_blog/includes/blog_meta.html +++ b/digitalglarus/templates/glarus_blog/includes/blog_meta.html @@ -1,26 +1,23 @@ {% load i18n thumbnail %} -
      + -
        +
          {% if post.categories.exists %} - {% for category in post.categories.all %} - {% if category.slug %} -
        • {{ category.name }}{% if not forloop.last %}, {% endif %}
        • - {% endif %} - {% endfor %} + {% for category in post.categories.all %} + {% if category.slug %} +
        • {{ category.name }}{% if not forloop.last %}, {% endif %}
        • + {% endif %} + {% endfor %} {% endif %} {% if post.tags.exists %} - {% for tag in post.tags.all %} -
        • {{ tag.name }}{% if not forloop.last %}, {% endif %}
        • - {% endfor %} + {% for tag in post.tags.all %} +
        • {{ tag.name }}{% if not forloop.last %}, {% endif %}
        • + {% endfor %} {% endif %} -
        \ No newline at end of file +
      From 023a58a7d7b763a6dc3f3eacb235914973fee679 Mon Sep 17 00:00:00 2001 From: rscnt Date: Sat, 26 Sep 2015 13:08:14 -0600 Subject: [PATCH 7/7] digitalglarus: styling on post details and list. Signed-off-by: rscnt --- .../templates/glarus_blog/post_detail.html | 30 ++++++++++------ .../templates/glarus_blog/post_list.html | 35 +++++++++---------- 2 files changed, 36 insertions(+), 29 deletions(-) diff --git a/digitalglarus/templates/glarus_blog/post_detail.html b/digitalglarus/templates/glarus_blog/post_detail.html index ed71df5e..ae69dc5b 100644 --- a/digitalglarus/templates/glarus_blog/post_detail.html +++ b/digitalglarus/templates/glarus_blog/post_detail.html @@ -8,18 +8,26 @@ {% block content_blog %}{% spaceless %}
      -
      -

      {{ post.title }}

      - {% block blog_meta %} - {% include "glarus_blog/includes/blog_meta.html" %} - {% endblock %} + {% if post.main_image_id %} +
      + {% thumbnail post.main_image post.full_image_options.size crop=post.full_image_options.crop upscale=post.full_image_options.upscale subject_location=post.main_image.subject_location as thumb %} + {{ post.main_image.default_alt_text }} +
      + {% endif %} +
      +

      + + {{ post.title }} + +
      + + {{ post.date_created }} + +

      + {% block blog_meta %} + {% include "glarus_blog/includes/blog_meta.html" %} + {% endblock %}
      - {% if post.main_image_id %} -
      - {% thumbnail post.main_image post.full_image_options.size crop=post.full_image_options.crop upscale=post.full_image_options.upscale subject_location=post.main_image.subject_location as thumb %} - {{ post.main_image.default_alt_text }} -
      - {% endif %} {% endspaceless %}
      {% render_placeholder post.content %}
      diff --git a/digitalglarus/templates/glarus_blog/post_list.html b/digitalglarus/templates/glarus_blog/post_list.html index d640f30e..a55a82a5 100644 --- a/digitalglarus/templates/glarus_blog/post_list.html +++ b/digitalglarus/templates/glarus_blog/post_list.html @@ -7,35 +7,34 @@
      {% block blog_title %}
      -

      - {% if author %}{% trans "Articles by" %} {{ author.get_full_name }} - {% elif archive_date %}{% trans "Archive" %} – {% if month %}{{ archive_date|date:'F' }} {% endif %}{{ year }} - {% elif tagged_entries %}{% trans "Tag" %} – {{ tagged_entries|capfirst }} - {% elif category %}{% trans "Category" %} – {{ category }}{% endif %} -

      +
      +

      + Digital Glarus Blog +

      +
      {% endblock %} {% for post in post_list %} - {% include "glarus_blog/includes/blog_item.html" with post=post image="true" TRUNCWORDS_COUNT=TRUNCWORDS_COUNT %} + {% include "glarus_blog/includes/blog_item.html" with post=post image="true" TRUNCWORDS_COUNT=TRUNCWORDS_COUNT %} {% empty %} -

      {% trans "No article found." %}

      +

      {% trans "No article found." %}

      {% endfor %} {% if author or archive_date or tagged_entries %}

      {% trans "Back" %}

      {% endif %} {% if is_paginated %} {% endif %}
      {% endblock %} -{% endspaceless %} \ No newline at end of file +{% endspaceless %}