diff options
author | luxagraf <sng@luxagraf.net> | 2023-07-28 15:24:29 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2023-07-28 15:24:29 -0500 |
commit | 571edc362652693c61c3a56496152e0e03c51918 (patch) | |
tree | 8d528f3cce6068105e5a6a7e4e92dfea6f850888 /app | |
parent | a30c790edea652494e7481f6798047a3bc1fd4ea (diff) |
links: moved templates to app
Diffstat (limited to 'app')
-rw-r--r-- | app/links/templates/links/link_detail.html | 19 | ||||
-rw-r--r-- | app/links/templates/links/link_list.html | 40 | ||||
-rw-r--r-- | app/links/views.py | 7 |
3 files changed, 63 insertions, 3 deletions
diff --git a/app/links/templates/links/link_detail.html b/app/links/templates/links/link_detail.html new file mode 100644 index 0000000..6ba0619 --- /dev/null +++ b/app/links/templates/links/link_detail.html @@ -0,0 +1,19 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{%block bodyid%}class="links"{%endblock%} +{% block primary %}<ul class="bl" id="breadcrumbs" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"> + <li><a href="/" title="luxagraf homepage" itemprop="url"><span itemprop="title">Home</span></a> → </li> + <li><a href="/links/" title="links" itemprop="url"><span itemprop="title">links</span></a> → </li> + </ul> + <main> + <h2 title="link-title">{{object.title|smartypants|widont|safe}}</h2> + <h3>{{object.url|urlize}}</h3> + <article class="h-entry hentry post--article book" itemscope itemType="http://schema.org/Article"> + {{object.render_description|amp|smartypants|safe}} + <ul>{% for tag in object.tags.all %} + <li><a href="/links/tag/{{tag.slug}}/">{{tag}}</a></li> + {%endfor%}</ul> + </article> +</main> +{% endblock %} + diff --git a/app/links/templates/links/link_list.html b/app/links/templates/links/link_list.html new file mode 100644 index 0000000..8f80a28 --- /dev/null +++ b/app/links/templates/links/link_list.html @@ -0,0 +1,40 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% load pagination_tags %} +{% block pagetitle %} Links | luxagraf {% endblock %} +{% block metadescription %} {% endblock %} +{% block extrahead %} +<style> +.tags { + display: inline-block; + margin-right: 0.25rem; +} +.edit { + float: right; + font-size: 50%; + margin-top: 1rem; +} +</style> +{% endblock %} +{%block bodyid%}class="links" id="links-archive"{%endblock%} + +{% block breadcrumbs %}{% if breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{%endif%}{% endblock %} +{% block primary %}<main class="archive-wrapper"> + {% autopaginate object_list 100 %}{% for object in object_list %} + <ul class="archive-list"> + <li class="h-entry hentry archive-list-card archive-list-card-sm" itemscope itemType="http://schema.org/Article"> + <span class="date dt-published card-smcaps">{{object.pub_date|date:"F Y"}}</span> + <h2 class="card-hed"><a href="{{object.url}}">{{object.title|safe|smartypants|widont}}</a><small class="edit"><a target="_blank" href="/admin/links/link/{{object.pk}}/change/">edit</a></small></h2> + <p class="p-summary card-lede">{% for object in object.tags.all %}<a class="tags" href="{% url 'links:list-tag' object.name %}">{{object}}</a>{%endfor%}</p> + </li>{%endfor%} + </ul> +</main> + <nav class="pagination"> + {% paginate %} + </nav> + <div class="tags"> + <ul class="tag-list">{% for object in tags %} + <li><a href="/links/tag/{{object.slug}}">{{object.name}}</a></li>{%endfor%} + </ul> + </div> +{% endblock %} diff --git a/app/links/views.py b/app/links/views.py index ebde61c..4beff5d 100644 --- a/app/links/views.py +++ b/app/links/views.py @@ -4,19 +4,20 @@ from utils.views import PaginatedListView from .models import Link from taggit.models import Tag + class LinkListView(PaginatedListView): model = Link - template_name = 'archives/links.html' def get_context_data(self, **kwargs): # Call the base implementation first to get a context context = super(LinkListView, self).get_context_data(**kwargs) context['tags'] = Link.tags.all() + context['breadcrumbs'] = ('Links',) return context + class LinkTagListView(PaginatedListView): model = Link - template_name = 'archives/links.html' def get_queryset(self): print(self.kwargs['slug']) @@ -29,9 +30,9 @@ class LinkTagListView(PaginatedListView): context['tags'] = Link.tags.all() return context + class LinkDetailView(DetailView): model = Link - template_name = "details/link.html" slug_field = "id" |