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

Use django-generated URLs for next/previous buttons in datepicker

parent f74fd4c4
No related branches found
No related tags found
1 merge request!31Biscuit merge. Closes #53.
......@@ -14,31 +14,9 @@ function loadNew() {
window.location.href = dest + formatDateForDjango(activeDate);
}
function onDateBeforeClick() {
if (activeDate.getDay() === 1) {
var minus = 3;
} else {
var minus = 1;
}
activeDate.setDate(activeDate.getDate() - minus);
update();
loadNew();
}
function onDateNextClick() {
if (activeDate.getDay() === 5) {
var plus = 3;
} else {
var plus = 1;
}
activeDate.setDate(activeDate.getDate() + plus);
update();
loadNew();
}
function onDateChanged() {
var str = $("#date").val();
var split = str.split(".")
var split = str.split(".");
activeDate = new Date(split[2], split[1] - 1, split[0]);
update();
loadNew();
......@@ -46,8 +24,6 @@ function onDateChanged() {
$(document).ready(function () {
$("#date-before").click(onDateBeforeClick);
$("#date-next").click(onDateNextClick);
$("#date").change(onDateChanged);
update();
......
......@@ -8,8 +8,8 @@
<script type="text/javascript" src="{% static "js/chronos/date_select.js" %}"></script>
<div class="col s2" style="display: initial;">
<a class="waves-effect waves-teal btn-flat btn-flat-medium left" id="date-before">
<div class="col s2 no-padding" style="display: initial;">
<a class="waves-effect waves-teal btn-flat btn-flat-medium left" href="{{ url_prev }}">
<i class="material-icons center">navigate_before</i>
</a>
......@@ -21,12 +21,12 @@
</span>
</div>
{% else %}
<div class="col s8">
<div class="col s8 no-padding">
<input type="text" class="datepicker center-align" id="date">
</div>
{% endif %}
<div class="col s2" style="display: initial;">
<a class="waves-effect waves-teal btn-flat btn-flat-medium right" id="date-next">
<div class="col s2 no-padding" style="display: initial;">
<a class="waves-effect waves-teal btn-flat btn-flat-medium right" href="{{ url_next }}">
<i class="material-icons center">navigate_next</i>
</a>
</div>
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