From ff6ce538f17e0a99208aa1cc675e98ae4e22b824 Mon Sep 17 00:00:00 2001 From: Emilie Date: Thu, 29 Sep 2016 16:17:06 +0200 Subject: [PATCH] Person : detail view + refacto block heritage --- app/organization/network/views.py | 2 +- app/templates/core/inc/files.html | 6 +++ app/templates/network/person_detail.html | 69 ++++++++++++++++++++++++ app/templates/pages/page.html | 32 ++++++++++- 4 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 app/templates/core/inc/files.html diff --git a/app/organization/network/views.py b/app/organization/network/views.py index 85872c11..13a4d465 100644 --- a/app/organization/network/views.py +++ b/app/organization/network/views.py @@ -14,7 +14,7 @@ class PersonListView(ListView): class PersonDetailView(SlugMixin, DetailView): model = Person - template_name='team/person_detail.html' + template_name='network/person_detail.html' context_object_name = 'person' diff --git a/app/templates/core/inc/files.html b/app/templates/core/inc/files.html new file mode 100644 index 00000000..619df9a2 --- /dev/null +++ b/app/templates/core/inc/files.html @@ -0,0 +1,6 @@ +{% load i18n %} +{% for file in files %} +

{{ file.title }}

+

{{ file.description }}

+ {% trans "download" %} +{% endfor %} diff --git a/app/templates/network/person_detail.html b/app/templates/network/person_detail.html index e69de29b..1f5777a4 100644 --- a/app/templates/network/person_detail.html +++ b/app/templates/network/person_detail.html @@ -0,0 +1,69 @@ +{% extends "pages/page.html" %} +{% load mezzanine_tags keyword_tags i18n organization_tags pages_tags %} + +{% block meta_title %}{{ person.meta_title }}{% endblock %} + +{% block meta_keywords %}{% metablock %} +{% keywords_for person as keywords %} +{% for keyword in keywords %} + {% if not forloop.first %}, {% endif %} + {{ keyword }} +{% endfor %} +{% endmetablock %}{% endblock %} + +{% block page_class %} + person +{% endblock %} + +{% block breadcrumb_menu %} + {{ block.super }} + +{% endblock %} + +{% block page_title %} + {% editable person.title %} +

{{ person.title }}

+ {% endeditable %} +{% endblock %} + +{% block page_content %} + {% editable person.bio %} + {{ person.bio|richtext_filters|safe }} + {% endeditable %} +{% endblock %} + +{% block page_sidebar %} + {% if person.images.all %} + {% with person.images.all|get_type:'page_featured' as images %} + {% if images.first %} +
+ person +
+ {% endif %} + {% endwith %} + {% endif%} +{% endblock %} + +{% block page_link %} + {{ block.super }} +{% endblock %} + +{% block page_audio %} + {{ block.super }} +{% endblock %} + +{% block page_slider %} + {{ block.super }} +{% endblock %} + +{% block page_video %} + {{ block.super }} +{% endblock %} + +{% block page_file %} + {{ block.super }} +{% endblock %} + +{% block page_sub_content %} + {{ block.super }} +{% endblock %} diff --git a/app/templates/pages/page.html b/app/templates/pages/page.html index b2690f51..1cc12abc 100644 --- a/app/templates/pages/page.html +++ b/app/templates/pages/page.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% load i18n mezzanine_tags keyword_tags pages_tags %} +{% load i18n mezzanine_tags keyword_tags organization_tags pages_tags %} {% block meta_title %}{{ page.meta_title }}{% endblock %} @@ -56,8 +56,18 @@ {{ page.content }} {% endblock %} {% block page_link %} + {% with object.links.all as links %} + {% if links %} + {% include 'core/inc/link.html' %} + {% endif %} + {% endwith %} {% endblock %} {% block page_audio %} + {% with object.audios.all as audios %} + {% if audios %} + {% include 'core/inc/audio.html' %} + {% endif %} + {% endwith %} {% endblock %} @@ -65,14 +75,34 @@ {% block page_slider %} + {% with object.images.all|get_type:'page_slider' as slider_images %} + {% if slider_images %} + {% include 'core/inc/slider.html' %} + {% endif %} + {% endwith %} {% endblock %} {% block page_video %} + {% with object.videos.all as videos %} + {% if videos %} + {% include 'core/inc/slider_video.html' %} + {% endif %} + {% endwith %} {% endblock %} {% block page_person_list %} {% endblock %} + {% block page_file %} + {% with object.files.all as files %} + {% if files %} + {% include 'core/inc/files.html' %} + {% endif %} + {% endwith %} + {% endblock %} {% block products %} {% endblock %} {% block page_sub_content %} + {% with object.blocks.all as blocks %} + {% include "core/inc/block.html" %} + {% endwith %} {% endblock %} {% block page_related_content %} {% endblock %} -- 2.39.5