Skip to content
Snippets Groups Projects
Commit e40b588f authored by Benjamin Hättasch's avatar Benjamin Hättasch Committed by Nadja Geisler
Browse files

Add graphical control for autoreload of plan

This visualizes the state and allows to turn it on and off with a click
parent 532bf8a1
No related branches found
No related tags found
1 merge request!120Autoreload of plan
Pipeline #81900 passed
...@@ -8,7 +8,7 @@ msgid "" ...@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-29 13:36+0000\n" "POT-Creation-Date: 2022-05-22 08:02+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -63,12 +63,12 @@ msgid "AK Wall" ...@@ -63,12 +63,12 @@ msgid "AK Wall"
msgstr "AK-Wall" msgstr "AK-Wall"
#: AKPlan/templates/AKPlan/plan_index.html:126 #: AKPlan/templates/AKPlan/plan_index.html:126
#: AKPlan/templates/AKPlan/plan_wall.html:81 #: AKPlan/templates/AKPlan/plan_wall.html:116
msgid "Current AKs" msgid "Current AKs"
msgstr "Aktuelle AKs" msgstr "Aktuelle AKs"
#: AKPlan/templates/AKPlan/plan_index.html:133 #: AKPlan/templates/AKPlan/plan_index.html:133
#: AKPlan/templates/AKPlan/plan_wall.html:86 #: AKPlan/templates/AKPlan/plan_wall.html:121
msgid "Next AKs" msgid "Next AKs"
msgstr "Nächste AKs" msgstr "Nächste AKs"
...@@ -99,6 +99,10 @@ msgstr "Eigenschaften" ...@@ -99,6 +99,10 @@ msgstr "Eigenschaften"
msgid "Track" msgid "Track"
msgstr "Track" msgstr "Track"
#: AKPlan/templates/AKPlan/plan_wall.html:131
msgid "Reload page automatically?"
msgstr "Seite automatisch neu laden?"
#: AKPlan/templates/AKPlan/slots_table.html:14 #: AKPlan/templates/AKPlan/slots_table.html:14
msgid "No AKs" msgid "No AKs"
msgstr "Keine AKs" msgstr "Keine AKs"
...@@ -68,7 +68,8 @@ ...@@ -68,7 +68,8 @@
if($(".fc-timeline-now-indicator-line").length) { if($(".fc-timeline-now-indicator-line").length) {
$('.fc-scroller').scrollLeft($('.fc-timeline-now-indicator-line').position().left); $('.fc-scroller').scrollLeft($('.fc-timeline-now-indicator-line').position().left);
} }
});
// == Auto Reload ==
// function from: https://stackoverflow.com/questions/5448545/how-to-retrieve-get-parameters-from-javascript/ // function from: https://stackoverflow.com/questions/5448545/how-to-retrieve-get-parameters-from-javascript/
function findGetParameter(parameterName) { function findGetParameter(parameterName) {
...@@ -84,12 +85,27 @@ ...@@ -84,12 +85,27 @@
return result; return result;
} }
// Check whether an autoreload frequency was specified and treat it as minutes // Check whether an autoreload frequency was specified and treat it as full minutes
var autoreload_frequency = findGetParameter("autoreload"); const autoreload_frequency = Math.ceil(findGetParameter("autoreload"));
const cbxAutoReload = $('#cbxAutoReload');
if(autoreload_frequency>0) { if(autoreload_frequency>0) {
window.setTimeout ( function() { window.location.reload(true); }, autoreload_frequency * 60 * 1000); window.setTimeout ( function() { window.location.reload(); }, autoreload_frequency * 60 * 1000);
console.log("Autoreload active"); console.log("Autoreload active");
cbxAutoReload.prop('checked', true);
} }
else {
cbxAutoReload.prop('checked', false);
}
cbxAutoReload.change(function () {
let url = window.location.href.split('?')[0];
if(cbxAutoReload.prop('checked')) {
url = url + "?autoreload=5";
}
window.location.replace(url);
});
});
</script> </script>
</head> </head>
<body> <body>
...@@ -112,6 +128,9 @@ ...@@ -112,6 +128,9 @@
<div id="planCalendar"></div> <div id="planCalendar"></div>
</div> </div>
</div> </div>
<div style="position: absolute;bottom: 1vh;left:1vw;background-color: #FFFFFF;padding: 1vh;">
<input type="checkbox" name="autoreload" id="cbxAutoReload"> <label for="cbxAutoReload">{% trans "Reload page automatically?" %}</label>
</div>
{% endtimezone %} {% endtimezone %}
</body> </body>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment