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 | |
parent | a30c790edea652494e7481f6798047a3bc1fd4ea (diff) |
links: moved templates to app
-rw-r--r-- | app/links/templates/links/link_detail.html (renamed from templates/details/link.html) | 0 | ||||
-rw-r--r-- | app/links/templates/links/link_list.html | 40 | ||||
-rw-r--r-- | app/links/views.py | 7 | ||||
-rw-r--r-- | templates/archives/links.html | 29 |
4 files changed, 44 insertions, 32 deletions
diff --git a/templates/details/link.html b/app/links/templates/links/link_detail.html index 6ba0619..6ba0619 100644 --- a/templates/details/link.html +++ b/app/links/templates/links/link_detail.html 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" diff --git a/templates/archives/links.html b/templates/archives/links.html deleted file mode 100644 index 9e1336f..0000000 --- a/templates/archives/links.html +++ /dev/null @@ -1,29 +0,0 @@ -{% extends 'base.html' %} -{% load typogrify_tags %} -{% load pagination_tags %} -{% block pagetitle %} Links | luxagraf {% endblock %} -{% block metadescription %} {% endblock %} -{%block bodyid%}class="links" id="links-archive"{%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> - {% if tag %}<li><a href="/links/" title="all links" itemprop="url"><span itemprop="title">Links</span></a> → </li><li>{{tag}}</li>{%else%}<li>Links</li>{% endif%} - </ul> - <main role="main"> - <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> - {% autopaginate object_list 100 %}{% for object in object_list %} - <article> - <h3 class="link-title"><a href="{{object.get_absolute_url}}">{{object.title|smartypants|safe}}</a> <span><a href="{{object.url}}">→</a></h3> - - </article> - {% endfor %} - </main> - <nav class="pagination"> - {% paginate %} - </nav> -{% endblock %} |