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

Commit

Permalink
Merge branch 'develop' of https://github.com/ic-labs/icekit-events in…
Browse files Browse the repository at this point in the history
…to develop
  • Loading branch information
Greg Turner committed May 11, 2017
2 parents 8090353 + e43ef31 commit 1e867d4
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 7 deletions.
13 changes: 7 additions & 6 deletions icekit_events/migrations/0002_recurrence_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@


RULES = [
('Daily', 'RRULE:FREQ=DAILY'),
('Daily, Weekdays', 'RRULE:FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR'),
('Daily, Weekends', 'RRULE:FREQ=DAILY;BYDAY=SA,SU'),
('Weekly', 'RRULE:FREQ=WEEKLY'),
('Monthly', 'RRULE:FREQ=MONTHLY'),
('Yearly', 'RRULE:FREQ=YEARLY'),
('Daily, except Xmas day', 'RRULE:FREQ=DAILY;\nEXRULE:FREQ=YEARLY;BYMONTH=12;BYMONTHDAY=25'),
('Daily, Weekdays, except Xmas day',
'RRULE:FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR;\nEXRULE:FREQ=YEARLY;BYMONTH=12;BYMONTHDAY=25'),
('Daily, Weekends, except Xmas day', 'RRULE:FREQ=DAILY;BYDAY=SA,SU;\nEXRULE:FREQ=YEARLY;BYMONTH=12;BYMONTHDAY=25'),
('Weekly, except Xmas day', 'RRULE:FREQ=WEEKLY;\nEXRULE:FREQ=YEARLY;BYMONTH=12;BYMONTHDAY=25'),
('Monthly, except Xmas day', 'RRULE:FREQ=MONTHLY;\nEXRULE:FREQ=YEARLY;BYMONTH=12;BYMONTHDAY=25'),
('Yearly, except Xmas day', 'RRULE:FREQ=YEARLY;\nEXRULE:FREQ=YEARLY;BYMONTH=12;BYMONTHDAY=25'),
]


Expand Down
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');
});
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
var error = $('#{{ id }}_recurrence-rule-widget div.error');

// Bind click events to toggle links.
$('div.recurrence-rule-widget a[class^=toggle]').click(function(e) {
$(document).on('click', 'div.recurrence-rule-widget a[class^=toggle]', function(e) {
e.preventDefault();
var link = $(e.target);
link.closest('div.recurrence-rule-widget').find('div.' + link.data('target')).toggle();
Expand Down

0 comments on commit 1e867d4

Please sign in to comment.