Skip to content
Snippets Groups Projects
Commit 50be5c48 authored by Benjamin Hättasch's avatar Benjamin Hättasch
Browse files

Fix now indicator in fullcalendar views (AKPlan) for users from other timezones

This is done by generating the "now" timestamp from python instead of JavaScript using a newly created templatetag
The new "now" function is used in all AKPlan calendar views as well as in AKScheduling's scheduler view
parent f478e92b
No related branches found
No related tags found
No related merge requests found
{% load static %} {% load static %}
{% load tz %} {% load tz %}
{% load i18n %} {% load i18n %}
{% load tags_AKPlan %}
{% include "AKPlan/load_fullcalendar.html" %} {% include "AKPlan/load_fullcalendar.html" %}
...@@ -27,6 +28,7 @@ ...@@ -27,6 +28,7 @@
scrollTime: '08:00:00', scrollTime: '08:00:00',
allDaySlot: false, allDaySlot: false,
nowIndicator: true, nowIndicator: true,
now: "{% timestamp_now event.timezone %}",
eventTextColor: '#fff', eventTextColor: '#fff',
eventColor: '#127ba3', eventColor: '#127ba3',
// Create entries for all scheduled slots // Create entries for all scheduled slots
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
{% load i18n %} {% load i18n %}
{% load static %} {% load static %}
{% load tz %} {% load tz %}
{% load tags_AKPlan %}
{% block fullcalendar %} {% block fullcalendar %}
...@@ -36,6 +37,7 @@ ...@@ -36,6 +37,7 @@
scrollTime: '08:00:00', scrollTime: '08:00:00',
allDaySlot: false, allDaySlot: false,
nowIndicator: true, nowIndicator: true,
now: "{% timestamp_now event.timezone %}",
eventTextColor: '#fff', eventTextColor: '#fff',
eventColor: '#127ba3', eventColor: '#127ba3',
// Create entries for all scheduled slots // Create entries for all scheduled slots
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
{% load i18n %} {% load i18n %}
{% load static %} {% load static %}
{% load tz %} {% load tz %}
{% load tags_AKPlan %}
{% block fullcalendar %} {% block fullcalendar %}
...@@ -47,6 +48,7 @@ ...@@ -47,6 +48,7 @@
editable: false, editable: false,
allDaySlot: false, allDaySlot: false,
nowIndicator: true, nowIndicator: true,
now: "{% timestamp_now event.timezone %}",
eventTextColor: '#fff', eventTextColor: '#fff',
eventColor: '#127ba3', eventColor: '#127ba3',
resourceAreaWidth: '15%', resourceAreaWidth: '15%',
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
{% load bootstrap4 %} {% load bootstrap4 %}
{% load fontawesome_5 %} {% load fontawesome_5 %}
{% load tags_AKModel %} {% load tags_AKModel %}
{% load tags_AKPlan %}
{% load tz %} {% load tz %}
...@@ -43,6 +44,7 @@ ...@@ -43,6 +44,7 @@
editable: false, editable: false,
allDaySlot: false, allDaySlot: false,
nowIndicator: true, nowIndicator: true,
now: "{% timestamp_now event.timezone %}",
eventTextColor: '#fff', eventTextColor: '#fff',
eventColor: '#127ba3', eventColor: '#127ba3',
height: '90%', height: '90%',
......
from datetime import datetime
from django import template from django import template
from django.utils.formats import date_format
from AKPlan.templatetags.color_gradients import darken from AKPlan.templatetags.color_gradients import darken
from AKPlanning import settings from AKPlanning import settings
...@@ -18,3 +21,8 @@ def highlight_change_colors(akslot): ...@@ -18,3 +21,8 @@ def highlight_change_colors(akslot):
recentness = seconds_since_update / settings.PLAN_MAX_HIGHLIGHT_UPDATE_SECONDS recentness = seconds_since_update / settings.PLAN_MAX_HIGHLIGHT_UPDATE_SECONDS
return darken("#b71540", recentness) return darken("#b71540", recentness)
# return linear_blend("#b71540", "#000000", recentness) # return linear_blend("#b71540", "#000000", recentness)
@register.simple_tag
def timestamp_now(tz):
return date_format(datetime.now().astimezone(tz), "c")
...@@ -138,6 +138,7 @@ ...@@ -138,6 +138,7 @@
}, },
allDaySlot: false, allDaySlot: false,
nowIndicator: true, nowIndicator: true,
now: "{% timestamp_now event.timezone %}",
eventTextColor: '#fff', eventTextColor: '#fff',
eventColor: '#127ba3', eventColor: '#127ba3',
eventBackgroundColor: '#28B62C', eventBackgroundColor: '#28B62C',
......
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