Last active
October 2, 2015 19:48
-
-
Save jasonvarga/823c05bc6231350fab73 to your computer and use it in GitHub Desktop.
Creating a single page dynamic URL calendar. This assumes a URL scheme like /calendar/month/2015/01
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ calendar:set_month folder="calendar" year="{ segment_3 }" month="{ segment_4 }" }} | |
<h1>{{ calendar:month_name }} {{ segment_3 }}</h1> | |
{{ calendar:prev_month }} | |
<a href="/calendar/month/{{ year }}/{{ month }}" title="{{ month_name }} {{ year }}">← Prev</a> | |
{{ /calendar:prev_month }} | |
{{ calendar:date_select attr="id:month-select" }} | |
{{ calendar:next_month }} | |
<a href="/calendar/month/{{ year }}/{{ month }}" title="{{ month_name }} {{ year }}">Next →</a> | |
{{ /calendar:next_month }} | |
{{ calendar:month folder="calendar" inherit="true" }} | |
<table> | |
<thead> | |
<tr> | |
{{ days_of_week }} | |
<th>{{ day_name }}</th> | |
{{ /days_of_week }} | |
</tr> | |
</thead> | |
<tbody> | |
{{ weeks }} | |
<tr> | |
{{ days }} | |
<td class="{{ if other_month }}other-month{{ endif }} {{ if today }}today{{ endif }}"> | |
<small>{{ day }}</small> | |
{{ entries }} | |
<div class="event {{ if all_day }}all-day{{ endif }}"> | |
{{ unless all_day }} | |
<b>{{ start_time }}{{ if end_time }} - {{ end_time }}{{ endif }}:</b> | |
{{ endif }} | |
{{ title }} | |
</div> | |
{{ /entries }} | |
</td> | |
{{ /days }} | |
</tr> | |
{{ /weeks }} | |
</tbody> | |
</table> | |
{{ /calendar:month }} | |
<script src="jquery.js"></script> | |
<script> | |
$('#month-select').on('change', function() { | |
window.location = '/calendar/month/' + $(this).val(); | |
}); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
routes: | |
/calendar/month/*: calendar_month |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment