Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Back-ported events listing calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
markfinger committed May 8, 2017
1 parent cd99e4e commit e43ef31
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

{% block title %}{{ page.get_title }} {{ start|date }}{% endblock %}

{% block css %}
<link rel="stylesheet" href="{% static 'icekit_events/css/events_datepicker.css' %}">
{% endblock %}

{% block content %}
<div class="container">
<h1>{{ page.get_title }}</h1>
Expand All @@ -28,3 +32,11 @@ <h2>{{ start|date }}</h2>
<div class="events-datepicker" id="datepicker" data-period="{{ days }}" data-start="{{ start|date:'Y-m-d' }}"></div>
</div>
{% endblock %}

{% block js %}
{{ block.super }}
<script src="{% static 'icekit_events/js/jquery-querystring.js' %}"></script>
<script src="{% static 'icekit_events/bower_components/jquery-ui/jquery-ui.min.js' %}"></script>
<script src="{% static 'icekit_events/js/events_datepicker.js' %}"></script>
{% endblock %}

17 changes: 17 additions & 0 deletions icekit_events/static/icekit_events/css/events_datepicker.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.events-datepicker {
max-width: 272px;
margin-top: 14px;
text-align: center;
}
.events-datepicker .ui-datepicker-next {
margin-left: 10px;
}
.events-datepicker td,
.events-datepicker th {
padding: 10px;
text-align: center;
}
.events-datepicker .ui-datepicker-title {
font-size: 2em;
font-weight: bold;
}
19 changes: 19 additions & 0 deletions icekit_events/static/icekit_events/js/events_datepicker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
$(function() {
var datepicker = $('#datepicker');

datepicker.datepicker({
dateFormat: 'yy-mm-dd',
onSelect: function(date) {
var queryParams = $.querystring(window.location.toString());
queryParams.date = date;
window.location = window.location.pathname + '?' + $.querystring(queryParams);
}
});

datepicker.datepicker('setDate', datepicker.data('start'));

// Hack this a little to get the date range selected
var datepickerCells = $('.ui-datepicker-calendar td');
var index = datepickerCells.index($('.ui-datepicker-current-day'));
datepickerCells.slice(index, index + parseInt(datepicker.data("period"))).addClass('active');
});

0 comments on commit e43ef31

Please sign in to comment.