Compare commits

...

3 commits

5 changed files with 46 additions and 56 deletions

View file

@ -1,64 +1,54 @@
{% macro hEntry(entry, indent_width) -%} {% macro hEntry(entry, indent_width) -%}
{%- set i = ' ' * indent_width -%} {%- set i = ' ' * indent_width -%}
<article class="card h-entry"> <article class="h-entry media">
{% if entry.photo %} {{i}}<aside class="info">
{{i}}<img class="card-img-top u-photo" src="{{ entry.photo.url }}" />
{% endif %}
{{i}}<div class="card-body">
{% if entry.name %}
{{i}}<h4 class="card-title p-name">{{ entry.name }}</h4>
{% endif %}
{{i}}<div class="e-content">
{{i}}{{ entry.content | markdown }}
{{i}}</div>
{{i}}</div>
{{i}}<div class="card-footer">
{{i}}<a class="p-author h-card" href="{{ entry.author.url }}"> {{i}}<a class="p-author h-card" href="{{ entry.author.url }}">
{{i}}<img class="u-photo" src="{{ entry.author.avatar.url }}" /> {{i}}<img class="u-photo img-fluid" src="{{ entry.author.avatar.url }}" alt="{{ entry.author.name }}" />
{{i}}{{ entry.author.name }} {{i}}<span class="p-name sr-only">{{ entry.author.name }}</span>
{{i}}</a> {{i}}</a>
{{i}}<a class="u-uid u-url" href="{{ entry.url }}"> {{i}}<a class="u-uid u-url" href="{{ entry.url }}">
{{i}}<time class="dt-published" datetime="{{ entry.published.isoformat() }}"> {{i}}<time class="dt-published" datetime="{{ entry.published.isoformat() }}">
{{i}}<i class="fas fa-calendar" aria-hidden="true"></i> {{i}}<i class="fas fa-calendar" aria-hidden="true"></i>
{{i}}{{ entry.published | naturaltime }} {{i}}{{ entry.published | naturaltime }}
{{i}}</time> {{i}}</time>
{{i}}</a> {{i}}</a>
{% if entry.updated != entry.published %} {{i}}<time class="dt-updated" datetime="{{ entry.updated.isoformat() }}"{% if (entry.updated | naturaltime) == (entry.published | naturaltime) %} hidden{% endif %}>
{{i}}<time class="dt-updated" datetime="{{ entry.updated.isoformat() }}">
{{i}}<i class="fas fa-pencil-alt" aria-hidden="true"></i> {{i}}<i class="fas fa-pencil-alt" aria-hidden="true"></i>
{{i}}{{ entry.updated | naturaltime }} {{i}}{{ entry.updated | naturaltime }}
{{i}}</time> {{i}}</time>
{% endif %}
{{i}}<a class="u-url" href="{{ entry.short_url }}"> {{i}}<a class="u-url" href="{{ entry.short_url }}">
{{i}}<i class="fas fa-link" aria-hidden="true"></i> {{i}}<i class="fas fa-link" aria-hidden="true"></i>
{{i}}{{ entry.short_url | friendly_url }} {{i}}{{ entry.short_url | friendly_url }}
{{i}}</a> {{i}}</a>
{{i}}</div>
{% if entry.cats.exists() %}
{{i}}<div class="card-footer">
{% for c in entry.cats.all() %} {% for c in entry.cats.all() %}
{{i}}<a class="p-category" href="{{ c.url }}"> {{i}}<a class="p-category" href="{{ c.url }}">
{{i}}<i class="fas fa-paw" aria-hidden="true"></i> {{i}}<i class="fas fa-paw" aria-hidden="true"></i>
{{i}}{{ c.name }} {{i}}{{ c.name }}
{{i}}</a> {{i}}</a>
{% endfor %} {% endfor %}
{{i}}</div>
{% endif %}
{% if entry.syndications.exists() %}
{{i}}<div class="card-footer">
{% for s in entry.syndications.all() %} {% for s in entry.syndications.all() %}
{{i}}<a class="u-syndication" href="{{ s.url }}"> {{i}}<a class="u-syndication" href="{{ s.url }}">
{{i}}<i class="{{ s.profile.site.icon }}" aria-hidden="true"></i> {{i}}<i class="{{ s.profile.site.icon }}" aria-hidden="true"></i>
{{i}}{{ s.profile }} {{i}}{{ s.profile }}
{{i}}</a> {{i}}</a>
{% endfor %} {% endfor %}
{{i}}</aside>
{{i}}<div class="card">
{% if entry.photo %}
{{i}}<img class="card-img-top u-photo" src="{{ entry.photo.url }}" />
{% endif %}
{{i}}<div class="card-body">
{% if entry.name %}
{{i}}<h4 class="card-title p-name">{{ entry.name }}</h4>
{% endif %}
{{i}}<div class="e-content">
{{i}}{{ entry.content | markdown }}
{{i}}</div>
{{i}}</div>
{{i}}</div> {{i}}</div>
{% endif %}
{{i}}<script class="p-json-ld" type="application/ld+json">{{ entry.json_ld | tojson }}</script> {{i}}<script class="p-json-ld" type="application/ld+json">{{ entry.json_ld | tojson }}</script>
{{i}}</article> {{i}}</article>
{%- endmacro %} {%- endmacro %}

View file

@ -10,7 +10,23 @@ ol.entries, div.entry
&:last-child &:last-child
margin-bottom 0 margin-bottom 0
.card.h-entry .h-entry.media
> aside.info
display flex
flex-direction column
align-items center
font-size 0.8rem
margin-right 1rem
a.p-author
text-align center
img.u-photo
border-radius .25rem
height 3em
> *
margin-bottom .25rem
> .card
flex 1
.e-content .e-content
ul ul
list-style-type disc list-style-type disc
@ -26,14 +42,3 @@ ol.entries, div.entry
max-width 100% max-width 100%
> :last-child > :last-child
margin-bottom 0 margin-bottom 0
.card-footer
text-align center
> *
display inline-block
margin-right 1rem
&:last-child
margin-right 0
.h-card > img
height 1em
vertical-align baseline

View file

@ -9,6 +9,7 @@ from django_activeurl.ext.django_jinja import ActiveUrl
from entries.kinds import all as entry_kinds from entries.kinds import all as entry_kinds
from .markdown import markdown from .markdown import markdown
from ..theme import color as theme_color
from ..utils import friendly_url, load_package_json from ..utils import friendly_url, load_package_json
@ -29,6 +30,7 @@ def environment(**options):
'package': load_package_json(), 'package': load_package_json(),
'settings': settings, 'settings': settings,
'static': staticfiles_storage.url, 'static': staticfiles_storage.url,
'theme_color': theme_color,
'url': reverse, 'url': reverse,
}) })
return env return env

View file

@ -5,21 +5,24 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title class="p-name">{% if title %}{{ title }} ~ {% endif %}{{ request.site.name }}</title> <title class="p-name">{% if title %}{{ title }} ~ {% endif %}{{ request.site.name }}</title>
{% block head %}{% endblock %}
{% if atom is defined %} {% if atom is defined %}
<link rel="alternate" type="application/atom+xml" href="{{ atom }}" /> <link rel="alternate" type="application/atom+xml" href="{{ atom }}" />
{% endif %} {% endif %}
{% if rss is defined %} {% if rss is defined %}
<link rel="alternate" type="application/rss+xml" href="{{ rss }}" /> <link rel="alternate" type="application/rss+xml" href="{{ rss }}" />
{% endif %} {% endif %}
{% block head %}{% endblock %}
<base href="{{ request.build_absolute_uri(url('home:index')) }}" />
<link rel="authorization_endpoint" href="{{ url('lemonauth:indie') }}" /> <link rel="authorization_endpoint" href="{{ url('lemonauth:indie') }}" />
<link rel="canonical" href="{{ request.build_absolute_uri() }}" />
<link rel="hub" href="{{ settings.PUSH_HUB }}" />
<link rel="manifest" href="{{ url('wellknowns:manifest') }}" /> <link rel="manifest" href="{{ url('wellknowns:manifest') }}" />
<link rel="micropub" href="{{ url('micropub:micropub') }}" /> <link rel="micropub" href="{{ url('micropub:micropub') }}" />
<link rel="hub" href="{{ settings.PUSH_HUB }}" />
<link rel="token_endpoint" href="{{ url('lemonauth:token') }}" /> <link rel="token_endpoint" href="{{ url('lemonauth:token') }}" />
<meta name="generator" content="{{ package.name }} {{ package.version }}" /> <meta name="generator" content="{{ package.name }} {{ package.version }}" />
<meta name="theme-color" content="{{ theme_color(10) }}" />
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"
integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous"> integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">

View file

@ -24,17 +24,7 @@ def manifest(request):
'start_url': urljoin(base, start_url), 'start_url': urljoin(base, start_url),
'background_color': color(0), 'background_color': color(0),
'theme_color': color(2), 'theme_color': color(10),
} }
# icons = FaviconImg.objects.filter(
# faviconFK__isFavicon=True,
# rel__in=rels,
# ).order_by('size')
# app['icons'] = [{
# 'type': 'image/png',
# 'sizes': '{0}x{0}'.format(icon.size),
# 'src': urljoin(base, icon.faviconImage.url),
# } for icon in icons]
return JsonResponse(app, content_type='application/manifest+json') return JsonResponse(app, content_type='application/manifest+json')