Improve calendar and nl-list

This commit is contained in:
Yusur 2023-04-06 23:02:07 +02:00
parent 63a2b60f1d
commit 0801e841ad
12 changed files with 210 additions and 146 deletions

View file

@ -3,30 +3,32 @@
{% block title %}Calendar {{ app_name }}{% endblock %}
{% block content %}
<h1>Calendar</h1>
<article>
<h1 id="firstHeading">{{ T('calendar') }}</h1>
<ul>
{% for year in range(till_year, from_year-1, -1) %}
<li>
<strong>{{ year }} {% if year == now.year %}(current){% endif %}:</strong>
<ul class="inline">
{% for month in range(1, 13) %}
<li><a href="/calendar/{{year}}/{{month}}">{{ year }}.{{ month }}</a></li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
<p>
Show more years:
<ul class="inline">
<ul>
{% for year in range(till_year, from_year-1, -1) %}
<li>
<a href="?till_year={{ till_year + 15 }}">in the future</a>
</li>
<li>
<a href="?from_year={{ from_year - 15 }}">in the past</a>
<strong>{{ year }} {% if year == now.year %}(current){% endif %}:</strong>
<ul class="inline">
{% for month in range(1, 13) %}
<li><a href="/calendar/{{year}}/{{month}}">{{ year }}.{{ month }}</a></li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
</p>
<p>
Show more years:
<ul class="inline">
<li>
<a href="?till_year={{ till_year + 15 }}">in the future</a>
</li>
<li>
<a href="?from_year={{ from_year - 15 }}">in the past</a>
</li>
</ul>
</p>
</article>
{% endblock %}

View file

@ -3,39 +3,43 @@
{% block title %}{{ T('homepage') }} - {{ app_name }}{% endblock %}
{% block content %}
<h1>{{ T('welcome').format(app_name) }}</h1>
<article class="homepage">
<h1 id="firstHeading">{{ T('welcome').format(app_name) }}</h1>
<div class="nl-new">
<a href="/create/"><button class="submit-primary">{{ T('new-note') }}</button></a>
</div>
<div class="nl-new">
<a href="/create/"><button class="submit-primary">{{ T('new-note') }}</button></a>
</div>
<h2>{{ T('latest-notes') }}</h2>
<h2>{{ T('latest-notes') }}</h2>
<br style="clear:both">
<ul class="nl-list">
{% for n in new_notes %}
<li>
<a href="{{ n.get_url() }}" class="nl-title">{{ n.title }}</a>
<p class="nl-desc">{{ n.short_desc() }}</p>
{% if n.tags %}
<p class="nl-tags">
<span class="material-icons">tag</span>
{{ T('tags') }}:
{% for tag in n.tags %}
{% set tn = tag.name %}
<a href="/tags/{{ tn }}/" class="nl-tag">#{{ tn }}</a>
{% endfor %}
</p>
{% endif %}
{% if n.calendar %}
<p class="nl-calendar">
<span class="material-icons">calendar_today</span>
<time datetime="{{ n.calendar.isoformat() }}">{{ n.calendar.strftime('%B %-d, %Y') }}</time>
</p>
{% endif %}
</li>
{% endfor %}
<li><a href="/p/most_recent/">{{ T('show-all') }}</a></li>
</ul>
<br style="clear:both">
<ul class="nl-list">
{% for n in new_notes %}
<li>
<a href="{{ n.get_url() }}" class="nl-title">{{ n.title }}</a>
<p class="nl-desc">{{ n.short_desc() }}</p>
{% if n.tags %}
<p class="nl-tags">
<span class="material-icons">tag</span>
{{ T('tags') }}:
{% for tag in n.tags %}
{% set tn = tag.name %}
<a href="/tags/{{ tn }}/" class="nl-tag">#{{ tn }}</a>
{% endfor %}
</p>
{% endif %}
{% if n.calendar %}
<p class="nl-calendar">
<span class="material-icons">calendar_today</span>
<a href="/calendar/{{ n.calendar.year }}/{{ n.calendar.month }}">
<time datetime="{{ n.calendar.isoformat() }}">{{ n.calendar.strftime('%B %-d, %Y') }}</time>
</a>
</p>
{% endif %}
</li>
{% endfor %}
<li><a href="/p/most_recent/">{{ T('show-all') }}</a></li>
</ul>
</article>
{% endblock %}

View file

@ -1,38 +1,42 @@
{% extends "base.jinja2" %}
{% block content %}
<h1>Notes by date</h1>
<article>
<h1>Notes by date</h1>
<p class="nl-pagination">Showing results <strong>{{ page_n * 20 - 19 }}</strong> to <strong>{{ min(page_n * 20, total_count) }}</strong> of <strong>{{ total_count }}</strong> total.</p>
<p class="nl-pagination">Showing results <strong>{{ page_n * 20 - 19 }}</strong> to <strong>{{ min(page_n * 20, total_count) }}</strong> of <strong>{{ total_count }}</strong> total.</p>
<ul class="nl-list">
{% if page_n > 1 %}
<li class="nl-prev"><a href="/p/most_recent/{{ page_n - 1 }}">&laquo; Previous page</a></li>
{% endif %}
{% for n in notes %}
<li>
<a href="{{ n.get_url() }}" class="nl-title">{{ n.title }}</a>
<p class="nl-desc">{{ n.short_desc() }}</p>
{% if n.tags %}
<p class="nl-tags">
<span class="material-icons">tag</span>
{{ T('tags') }}:
{% for tag in n.tags %}
{% set tn = tag.name %}
<a href="/tags/{{ tn }}/" class="nl-tag">#{{ tn }}</a>
{% endfor %}
</p>
<ul class="nl-list">
{% if page_n > 1 %}
<li class="nl-prev"><a href="/p/most_recent/{{ page_n - 1 }}">&laquo; Previous page</a></li>
{% endif %}
{% if n.calendar %}
<p class="nl-calendar">
<span class="material-icons">calendar_today</span>
<time datetime="{{ n.calendar.isoformat() }}">{{ n.calendar.strftime('%B %-d, %Y') }}</time>
</p>
{% for n in notes %}
<li>
<a href="{{ n.get_url() }}" class="nl-title">{{ n.title }}</a>
<p class="nl-desc">{{ n.short_desc() }}</p>
{% if n.tags %}
<p class="nl-tags">
<span class="material-icons">tag</span>
{{ T('tags') }}:
{% for tag in n.tags %}
{% set tn = tag.name %}
<a href="/tags/{{ tn }}/" class="nl-tag">#{{ tn }}</a>
{% endfor %}
</p>
{% endif %}
{% if n.calendar %}
<p class="nl-calendar">
<span class="material-icons">calendar_today</span>
<a href="/calendar/{{ n.calendar.year }}/{{ n.calendar.month }}">
<time datetime="{{ n.calendar.isoformat() }}">{{ n.calendar.strftime('%B %-d, %Y') }}</time>
</a>
</p>
{% endif %}
</li>
{% endfor %}
{% if page_n <= total_count // 20 %}
<li class="nl-next"><a href="/p/most_recent/{{ page_n + 1 }}/">Next page &raquo;</a></li>
{% endif %}
</li>
{% endfor %}
{% if page_n <= total_count // 20 %}
<li class="nl-next"><a href="/p/most_recent/{{ page_n + 1 }}/">Next page &raquo;</a></li>
{% endif %}
</ul>
</ul>
</article>
{% endblock %}

View file

@ -3,46 +3,51 @@
{% block title %}Notes tagged #{{ tagname }} - {{ app_name }}{% endblock %}
{% block content %}
<h1>{{ T('notes-tagged') }} #{{ tagname }}</h1>
<article>
<h1 id="firstHeading">#{{ tagname }}</h1>
<div class="preview-subtitle">{{ T('notes-tagged') }}</div>
{% if total_count > 0 %}
<p class="nl-pagination">Showing results <strong>{{ page_n * 20 - 19 }}</strong> to <strong>{{ min(page_n * 20, total_count) }}</strong> of <strong>{{ total_count }}</strong> total.</p>
{% if total_count > 0 %}
<p class="nl-pagination">Showing results <strong>{{ page_n * 20 - 19 }}</strong> to <strong>{{ min(page_n * 20, total_count) }}</strong> of <strong>{{ total_count }}</strong> total.</p>
<ul class="nl-list">
{% if page_n > 1 %}
<li class="nl-prev"><a href="/tags/{{ tagname }}/{{ page_n - 1 }}/">&laquo; Previous page</a></li>
{% endif %}
{% for n in tagged_notes %}
<li>
<a href="{{ n.get_url() }}" class="nl-title">{{ n.title }}</a>
<p class="nl-desc">{{ n.short_desc() }}</p>
<p class="nl-tags">
<span class="material-icons">tag</span>
{{ T('tags') }}:
{% for tag in n.tags %}
{% set tn = tag.name %}
{% if tn == tagname %}
<strong class="nl-tag-hl">#{{ tn }}</strong>
{% else %}
<a href="/tags/{{ tn }}/" class="nl-tag">#{{ tn }}</a>
{% endif %}
{% endfor %}
{% if n.calendar %}
<p class="nl-calendar">
<span class="material-icons">calendar_today</span>
<time datetime="{{ n.calendar.isoformat() }}">{{ n.calendar.strftime('%B %-d, %Y') }}</time>
<ul class="nl-list">
{% if page_n > 1 %}
<li class="nl-prev"><a href="/tags/{{ tagname }}/{{ page_n - 1 }}/">&laquo; Previous page</a></li>
{% endif %}
{% for n in tagged_notes %}
<li>
<a href="{{ n.get_url() }}" class="nl-title">{{ n.title }}</a>
<p class="nl-desc">{{ n.short_desc() }}</p>
<p class="nl-tags">
<span class="material-icons">tag</span>
{{ T('tags') }}:
{% for tag in n.tags %}
{% set tn = tag.name %}
{% if tn == tagname %}
<strong class="nl-tag-hl">#{{ tn }}</strong>
{% else %}
<a href="/tags/{{ tn }}/" class="nl-tag">#{{ tn }}</a>
{% endif %}
{% endfor %}
{% if n.calendar %}
<p class="nl-calendar">
<span class="material-icons">calendar_today</span>
<a href="/calendar/{{ n.calendar.year }}/{{ n.calendar.month }}">
<time datetime="{{ n.calendar.isoformat() }}">{{ n.calendar.strftime('%B %-d, %Y') }}</time>
</a>
</p>
{% endif %}
</p>
{% endif %}
</p>
</li>
{% endfor %}
{% if page_n < total_count // 20 %}
<li class="nl-next"><a href="/tags/{{ tagname }}/{{ page_n + 1 }}/">Next page &raquo;</a></li>
</li>
{% endfor %}
{% if page_n < total_count // 20 %}
<li class="nl-next"><a href="/tags/{{ tagname }}/{{ page_n + 1 }}/">Next page &raquo;</a></li>
{% endif %}
</ul>
{% else %}
<p class="nl-placeholder">{{ T('notes-tagged-empty') }}</p>
{% endif %}
</ul>
{% else %}
<p class="nl-placeholder">{{ T('notes-tagged-empty') }}</p>
{% endif %}
</article>
{% endblock %}

View file

@ -3,30 +3,47 @@
{% block title %}{{ d.strftime("%B %Y") }} {{ app_name }}{% endblock %}
{% block content %}
<h1>{{ d.strftime("%B %Y") }}</h1>
<article>
<h1 id="firstHeading">{{ d.strftime("%B %Y") }}</h1>
<ul>
{% for n in notes %}
<li>
<a href="{{ n.get_url() }}" class="nl-title">{{ n.title }}</a>
<p class="nl-desc">{{ n.short_desc() }}</p>
{% if n.tags %}
<p class="nl-tags">{{ T('tags') }}:
{% for tag in n.tags %}
{% set tn = tag.name %}
<a href="/tags/{{ tn }}/" class="nl-tag">#{{ tn }}</a>
{% if total_count > 0 %}
<p class="nl-pagination">Showing results <strong>{{ page_n * 20 - 19 }}</strong> to <strong>{{ min(page_n * 20, total_count) }}</strong> of <strong>{{ total_count }}</strong> total.</p>
<ul class="nl-list">
{% for n in notes %}
<li>
<a href="{{ n.get_url() }}" class="nl-title">{{ n.title }}</a>
<p class="nl-desc">{{ n.short_desc() }}</p>
{% if n.tags %}
<p class="nl-tags">{{ T('tags') }}:
{% for tag in n.tags %}
{% set tn = tag.name %}
<a href="/tags/{{ tn }}/" class="nl-tag">#{{ tn }}</a>
{% endfor %}
</p>
{% endif %}
{% if n.calendar %}
<p class="nl-calendar">
<span class="material-icons">calendar_today</span>
{% if n.calendar.year == d.year and n.calendar.month == d.month %}
<strong>
<time datetime="{{ n.calendar.isoformat() }}">{{ n.calendar.strftime('%B %-d, %Y') }}</time>
</strong>
{% else %}
<a href="/calendar/{{ n.calendar.year }}/{{ n.calendar.month }}">
<time datetime="{{ n.calendar.isoformat() }}">{{ n.calendar.strftime('%B %-d, %Y') }}</time>
</a>
{% endif %}
</p>
{% endif %}
</li>
{% endfor %}
</p>
{% endif %}
{% if n.calendar %}
<p class="nl-calendar">
<span class="material-icons">calendar_today</span>
<time datetime="{{ n.calendar.isoformat() }}">{{ n.calendar.strftime('%B %-d, %Y') }}</time>
</p>
{% endif %}
</li>
{% endfor %}
</ul>
</ul>
{% else %}
<p class="nl-placeholder">{{ T('notes-month-empty') }}</p>
{% endif %}
<p>{{ T('back-to') }} <a href="/calendar">{{ T('calendar') }}</a></p>
</article>
{% endblock %}

View file

@ -11,5 +11,6 @@
<li>{{ T("revision-count") }}: <strong>{{ revision_count }}</strong></li>
<li>{{ T("revision-count-per-page") }}: <strong>{{ (revision_count / notes_count)|round(2) }}</strong></li>
<li>{{ T('users-count') }}: <strong>{{ users_count }}</strong></li>
<li>{{ T('groups-count') }}: <strong>{{ groups_count }}</strong></li>
</ul>
{% endblock %}

View file

@ -12,7 +12,12 @@
<h1 id="firstHeading">{{ p.title }}</h1>
{% if p.calendar %}
<p class="calendar-subtitle"><span class="material-icons">calendar_today</span>{{ p.calendar.strftime('%B %-d, %Y') }}</p>
<p class="calendar-subtitle">
<span class="material-icons">calendar_today</span>
<a href="/calendar/{{ p.calendar.year }}/{{ p.calendar.month }}">
<time datetime="{{ p.calendar.isoformat() }}">{{ p.calendar.strftime('%B %-d, %Y') }}</time>
</a>
</p>
{% endif %}
<ul class="article-actions inline">