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/src/templates/src/srcpost_detail.html | 112 ++++++++++++++++++++++++++++++ app/src/templates/src/srcpost_list.html | 30 ++++++++ app/src/templates/src/topic_list.html | 35 ++++++++++ app/src/urls.py | 12 +++- app/src/views.py | 5 +- 5 files changed, 189 insertions(+), 5 deletions(-) create mode 100644 app/src/templates/src/srcpost_detail.html create mode 100644 app/src/templates/src/srcpost_list.html create mode 100644 app/src/templates/src/topic_list.html (limited to 'app/src') diff --git a/app/src/templates/src/srcpost_detail.html b/app/src/templates/src/srcpost_detail.html new file mode 100644 index 0000000..2ad4e26 --- /dev/null +++ b/app/src/templates/src/srcpost_detail.html @@ -0,0 +1,112 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% load comments %} +{% block pagetitle %}{{object.title|striptags}} - by Scott Gilbertson{% endblock %} +{% block metadescription %}{% autoescape on %}{{object.meta_description|striptags|safe}}{% endautoescape %}{% endblock %} +{%block extrahead%} + + + + + + + + + + + + + + +{%endblock%} + +{% block bodyid %}class="src detail single"{% endblock %} +{%block sitesubtitle %}Code Slowly{% endblock%} +{% block breadcrumbs %}{% endblock %} +{% block primary %}
+
+
+

{%if object.template_name == 1 or object.template_name == 3 %}{{object.title|safe|smartypants}}{%else%}{{object.title|safe|smartypants|widont}}{%endif%}

+

{{object.meta_description|smartypants|safe}}

+
+ {% if object.originally_published_by %}

Originally Published By: {{object.originally_published_by}}

{%endif%} + {% if object.topics.all %}

Topics: {% for topic in object.topics.all%} {{topic.name}}{%if forloop.last%}{%else%}, {%endif%}{%endfor%}

{%endif%} + + +
+
+ + +
+ {{object.body_html|safe|smartypants|widont}} +
+
+ {% if object.slug != 'about' %} + {% with object.get_next_published as next %} + {% with object.get_previous_published as prev %} + {%endwith%}{%endwith%} + {%endif%} +
+ {% if object.slug != 'about' %} + {% 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 %} +
+{% else %} +

Sorry, comments have been disabled for this post.

+{%endif%} +{%endif%} +{% endblock %} +{% block js %} + +{% if object.has_code %} +{%endif %} +{% endblock %} diff --git a/app/src/templates/src/srcpost_list.html b/app/src/templates/src/srcpost_list.html new file mode 100644 index 0000000..dd5d410 --- /dev/null +++ b/app/src/templates/src/srcpost_list.html @@ -0,0 +1,30 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% load comments %} + +{% block pagetitle %}Tutorials and tools for building great things{% endblock %} +{% block metadescription %}Tutorials and tools for building great things on the web - by Scott Gilbertson.{% endblock %} +{%block sitesubtitle %}Code Slowly{% endblock%} +{% block breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{% endblock %} +{% block primary %}
+
+

Tutorials and tools for building great things on the web.

+

The indie web is an amazing democratic publishing platform unlike anything in history. The catch is, to avoid serving at the pleasure of the corporate king, you need to know how to publish. That's what these articles are here for, to help you learn how to use independent, community supported open source tools. The web won't last forever, let's build something cool while we can.

+

Topics include HTML, CSS, Django, Linux, Nginx, Python, Postgresql, free software, and, once, the evil that is Google AMP.

+

A few of the articles below were previously published in: Ars Technica, Wired, and The Register

+
+

Articles

+ + + + +
+{%endblock%} diff --git a/app/src/templates/src/topic_list.html b/app/src/templates/src/topic_list.html new file mode 100644 index 0000000..7149823 --- /dev/null +++ b/app/src/templates/src/topic_list.html @@ -0,0 +1,35 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% load comments %} + +{% block pagetitle %}Tutorials and tools for building great things{% endblock %} + +{% block metadescription %}Tutorials about {{topic}} - by Scott Gilbertson.{% endblock %} +{%block sitesubtitle %}Code Slowly{% endblock%} +{% block primary %} +
+
+

Tutorials and tools for building great things on the web.

+

The indie web is an amazing democratic publishing platform unlike anything in history. The catch is, to avoid serving at the pleasure of the corporate king, you need to know how to publish. That's what these articles are here for, to help you learn how to use independent, community supported open source tools. The web won't last forever, let's build something cool while we can.

+

A few of the articles below were previously published in: Ars Technica, Wired, and The Register

+
+

Tutorials about {{topic}}

+ + + + +
+{%endblock%} diff --git a/app/src/urls.py b/app/src/urls.py index 1e1488a..0ac6897 100644 --- a/app/src/urls.py +++ b/app/src/urls.py @@ -26,18 +26,24 @@ urlpatterns = [ name='list_books' ), path( - r'.txt', + r'.txt', views.EntryDetailViewTXT.as_view(), name="detail-txt" ), path( - r'', + r'', views.EntryDetailView.as_view(), name="detail" ), + re_path( + r'', + views.SrcListView.as_view(), + name="list" + ), path( r'', views.SrcListView.as_view(), - name="list", + {'page':1}, + name="list" ), ] diff --git a/app/src/views.py b/app/src/views.py index f929949..7540e02 100644 --- a/app/src/views.py +++ b/app/src/views.py @@ -5,7 +5,7 @@ from django.urls import reverse from django.conf import settings #from paypal.standard.forms import PayPalPaymentsForm - +from utils.views import PaginatedListView from .models import SrcPost, Topic, Book @@ -44,7 +44,8 @@ class BookDetailView(DetailView): return context -class SrcListView(ListView): +class SrcListView(PaginatedListView): + model = SrcPost def get_queryset(self): return SrcPost.objects.filter(status__exact=1) -- cgit v1.2.3-70-g09d2