Skip to content
Snippets Groups Projects
Commit 131fff13 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Include support for next/last years in plan select

- Show next year after 52th calendar week
- Show last year before 1th calendar week
- Disable cache in DEBUG

Close #297
parent 10bbbe90
No related branches found
No related tags found
1 merge request!86Merge school-apps
......@@ -176,13 +176,20 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
DBSETTINGS_USE_CACHE = not DEBUG
# Cache configs (only on production)
if not DEBUG:
TEST_MEMCACHE = False
if not DEBUG or TEST_MEMCACHE:
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
}
else:
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}
# PWA
PWA_APP_NAME = 'SchoolApps'
......
......@@ -3,22 +3,27 @@
<script type="text/javascript">
{% if smart %}
var week = {{ selected_week }};
function goToCalendarWeek(cw) {
window.location.href = "{% url "timetable_smart_plan" raw_type id %}/{{ selected_year }}/" + cw;
var year = {{ selected_year }};
function goToCalendarWeek(cw, year) {
window.location.href = "{% url "timetable_smart_plan" raw_type id %}/" + year + "/" + cw;
}
function onCalendarWeekChanged(where) {
goToCalendarWeek($(where).val());
goToCalendarWeek($(where).val(), year);
}
function weekBefore() {
if (week > 1) {
goToCalendarWeek(week - 1)
goToCalendarWeek(week - 1, year)
} else {
goToCalendarWeek(52, year - 1)
}
}
function weekNext() {
if (week < 52) {
goToCalendarWeek(week + 1);
goToCalendarWeek(week + 1, year);
} else {
goToCalendarWeek(1, year + 1);
}
}
......@@ -51,8 +56,9 @@
<span data-position="bottom" class="tooltipped"
data-tooltip="{{ teacher }}">
<a href="{% url "timetable_smart_plan" "teacher" teacher.id %}">
{{ teacher.shortcode }}</a></span>{% if not forloop.last %},{% endif %}
<a href="{% url "timetable_smart_plan" "teacher" teacher.id %}">
{{ teacher.shortcode }}</a>
</span>{% if not forloop.last %},{% endif %}
{% endfor %}
</h5>
{% endif %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment