Implemented calendar

This commit is contained in:
Yusur 2023-02-10 14:15:21 +01:00
parent d2cef14c38
commit 6f53cd3836
15 changed files with 145 additions and 182 deletions

33
templates/calendar.html Normal file
View file

@ -0,0 +1,33 @@
{% extends "base.html" %}
{% block title %}Calendar {{ app_name }}{% endblock %}
{% block content %}
<h1>Calendar</h1>
<form>
<fieldset>
<legend>Calendar view</legend>
<div>
<label><strong>Show as</strong>:</label>
<ul class="inline">
{% set view_choices = ["month"] %}
{% for vch in view_choices %}
<li>
{% if vch == viewas %}
<strong>{{ T(vch) }}</strong>
{% else %}
<a href="/calendar/{{ vch }}">{{ T(vch) }}</a>
{% endif %}
</li>
{% endfor %}
</ul>
</div>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" >
<div>
<label><strong>Show month</strong></label>
</div>
</fieldset>
</form>
{% endblock %}

View file

@ -77,6 +77,11 @@
<label for="CB__lockpage">Lock page for editing by other users</label>
</div>
{% endif %}
<div>
<input type="checkbox" id="CB__usecalendar" name="usecalendar" {% if pl_calendar %}checked=""{% endif %}>
<label for="CB__usecalendar">Use calendar:</label>
<input type="date" name="calendar" {% if pl_calendar %}value="{{ pl_calendar }}"{% endif %}>
</div>
{% endif %}
</form>

View file

@ -25,6 +25,12 @@
{% 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>

View file

@ -12,3 +12,9 @@
{% endif %}
{% endfor %}
</p>
{% 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 %}

View file

@ -13,11 +13,20 @@
<li>
<a href="{{ n.get_url() }}" class="nl-title">{{ n.title }}</a>
<p class="nl-desc">{{ n.short_desc() }}</p>
<p class="nl-tags">Tags:
{% if n.tags %}
<p class="nl-tags">{{ T('tags') }}:
{% for tag in n.tags %}
<a href="/tags/{{ tag.name }}/" class="nl-tag">#{{ tag.name }}</a>
{% 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 %}
{% if page_n <= total_count // 20 %}

View file

@ -25,6 +25,12 @@
<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>
</p>
{% endif %}
</p>
</li>
{% endfor %}

32
templates/month.html Normal file
View file

@ -0,0 +1,32 @@
{% extends "base.html" %}
{% block title %}{{ d.strftime("%B %Y") }} {{ app_name }}{% endblock %}
{% block content %}
<h1>{{ 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>
{% 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>
{% endblock %}

View file

@ -27,6 +27,8 @@
</ul>
{% elif q %}
<h2>{{ T('search-no-results') }} <em>{{ q }}</em></h2>
{% else %}
<p>Please note that search queries do not search for page text.</p>
{% endif %}
{% endblock %}

View file

@ -7,6 +7,10 @@
{% block content %}
<article>
<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') }}</div>
{% endif %}
<div class="jump-to-actions">
<span>{{ T('last-changed') }} {{ rev.human_pub_date() }}</span> ·