Improved calendar view
This commit is contained in:
parent
a8b24f2765
commit
852c40d5fb
5 changed files with 34 additions and 26 deletions
|
|
@ -1,5 +1,9 @@
|
||||||
# What’s New
|
# What’s New
|
||||||
|
|
||||||
|
## 0.7.1
|
||||||
|
|
||||||
|
+ Improved calendar view. Now `/calendar` shows a list of years and months.
|
||||||
|
|
||||||
## 0.7
|
## 0.7
|
||||||
|
|
||||||
+ Schema changes:
|
+ Schema changes:
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ suitable as a community or team knowledge base.
|
||||||
+ Stored in SQLite/MySQL databases
|
+ Stored in SQLite/MySQL databases
|
||||||
+ Material Icons
|
+ Material Icons
|
||||||
+ Light/dark theme
|
+ Light/dark theme
|
||||||
|
+ Calendar
|
||||||
+ Works fine even with JavaScript disabled.
|
+ Works fine even with JavaScript disabled.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
|
||||||
8
app.py
8
app.py
|
|
@ -29,7 +29,7 @@ from configparser import ConfigParser
|
||||||
import i18n
|
import i18n
|
||||||
import gzip
|
import gzip
|
||||||
|
|
||||||
__version__ = '0.7.0'
|
__version__ = '0.7.1'
|
||||||
|
|
||||||
#### CONSTANTS ####
|
#### CONSTANTS ####
|
||||||
|
|
||||||
|
|
@ -791,7 +791,11 @@ def contributions(username):
|
||||||
|
|
||||||
@app.route('/calendar/')
|
@app.route('/calendar/')
|
||||||
def calendar_view():
|
def calendar_view():
|
||||||
return render_template('calendar.jinja2')
|
now = datetime.datetime.now()
|
||||||
|
return render_template('calendar.jinja2', now=now,
|
||||||
|
from_year=int(request.args.get('from_year', now.year - 12)),
|
||||||
|
till_year=int(request.args.get('till_year', now.year + 5))
|
||||||
|
)
|
||||||
|
|
||||||
@app.route('/calendar/<int:y>/<int:m>')
|
@app.route('/calendar/<int:y>/<int:m>')
|
||||||
def calendar_month(y, m):
|
def calendar_month(y, m):
|
||||||
|
|
|
||||||
0
migrations/0_7to0_8.py
Normal file
0
migrations/0_7to0_8.py
Normal file
|
|
@ -5,29 +5,28 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Calendar</h1>
|
<h1>Calendar</h1>
|
||||||
|
|
||||||
<form>
|
<ul>
|
||||||
<fieldset>
|
{% for year in range(till_year, from_year-1, -1) %}
|
||||||
<legend>Calendar view</legend>
|
<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>
|
||||||
|
|
||||||
<div>
|
<p>
|
||||||
<label><strong>Show as</strong>:</label>
|
Show more years:
|
||||||
<ul class="inline">
|
<ul class="inline">
|
||||||
{% set view_choices = ["month"] %}
|
<li>
|
||||||
{% for vch in view_choices %}
|
<a href="?till_year={{ till_year + 15 }}">in the future</a>
|
||||||
<li>
|
</li>
|
||||||
{% if vch == viewas %}
|
<li>
|
||||||
<strong>{{ T(vch) }}</strong>
|
<a href="?from_year={{ from_year - 15 }}">in the past</a>
|
||||||
{% else %}
|
</li>
|
||||||
<a href="/calendar/{{ vch }}">{{ T(vch) }}</a>
|
</ul>
|
||||||
{% endif %}
|
</p>
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" >
|
|
||||||
<div>
|
|
||||||
<label><strong>Show month</strong></label>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue