From 6e8b62d8c38f6ca366f240ea45ad738ebfd62943 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Mon, 27 Jan 2020 20:37:10 -0500 Subject: abstracted breadcrumbs into seperate template --- app/pages/templates/pages/page_detail.html | 37 ++++++++++++++++++++++++++++++ app/pages/templates/pages/page_detail.txt | 8 +++++++ app/pages/urls.py | 13 +++++++++++ app/pages/views.py | 11 +++++---- 4 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 app/pages/templates/pages/page_detail.html create mode 100644 app/pages/templates/pages/page_detail.txt create mode 100644 app/pages/urls.py (limited to 'app/pages') diff --git a/app/pages/templates/pages/page_detail.html b/app/pages/templates/pages/page_detail.html new file mode 100644 index 0000000..4644386 --- /dev/null +++ b/app/pages/templates/pages/page_detail.html @@ -0,0 +1,37 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% load comments %} +{% block pagetitle %}Luxagraf | {{object.title}}{% endblock %} +{% block metadescription %}{{object.meta_description}}{% endblock %} +{%block htmlclass%}class="detail"{%endblock%} +{%block bodyid%}id="{{object.title|slugify}}"{%endblock%} +{% block breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{% endblock %} +{% block primary %}
+
+
+

{{object.title}}

+ {%if object.sub_title %}

{{object.sub_title}}

{%endif%} +
+
+ {{object.body_html|safe|smartypants|widont}} +
+
+ {% if object.enable_comments %} +{% get_comment_count for object as comment_count %} +{%if comment_count > 0 %} +

{{comment_count}} Comment{{ comment_count|pluralize }}

+{% render_comment_list for object %} +{%endif%} +
+{% render_comment_form for object %} +
+{%endif%} +
+{% endblock %} +{% block js %} + + +{% endblock %} + + diff --git a/app/pages/templates/pages/page_detail.txt b/app/pages/templates/pages/page_detail.txt new file mode 100644 index 0000000..547ce79 --- /dev/null +++ b/app/pages/templates/pages/page_detail.txt @@ -0,0 +1,8 @@ +{{object.title|safe}} +{% for letter in object.title %}={%endfor%} + + by Scott Gilbertson + <{{SITE_URL}}{{object.get_absolute_url}}> + {{object.pub_date|date:"l, d F Y"}} + +{{object.body_markdown|safe}} diff --git a/app/pages/urls.py b/app/pages/urls.py new file mode 100644 index 0000000..c40eee0 --- /dev/null +++ b/app/pages/urls.py @@ -0,0 +1,13 @@ +from django.urls import path, re_path + +from . import views + +app_name = "pages" + +urlpatterns = [ + path( + r'', + views.PageDetailView.as_view(), + name="detail" + ), +] diff --git a/app/pages/views.py b/app/pages/views.py index 8431bc2..bef6529 100644 --- a/app/pages/views.py +++ b/app/pages/views.py @@ -1,12 +1,15 @@ -from django.views.generic.detail import DetailView +from utils.views import LuxDetailView from .models import Page -class PageDetailView(DetailView): +class PageDetailView(LuxDetailView): model = Page - slug_field = "slug" def get_template_names(self): obj = self.get_object() - return ["details/%s.html" % obj.slug, 'details/page.html'] + return ["pages/%s.html" % obj.slug, 'pages/page_detail.html'] + +class PageDetailTXTView(LuxDetailView): + model = Page + slug_field = "slug" -- cgit v1.2.3-70-g09d2