Skip to content

Instantly share code, notes, and snippets.

@mikegioia
Created July 22, 2015 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikegioia/8e1ef7ca6e0770234ef1 to your computer and use it in GitHub Desktop.
Save mikegioia/8e1ef7ca6e0770234ef1 to your computer and use it in GitHub Desktop.
Example of a CLNDR template with options to show/hide weekends
<div class="clndr-controls">
<div class="clndr-previous-button">&lsaquo;</div>
<div class="month font-mono"><%= intervalStart.format( 'M/DD' ) + ' &mdash; ' + intervalEnd.format( 'M/DD' ) %></div>
<div class="clndr-next-button">&rsaquo;</div>
</div>
<div class="days-of-the-week font-mono clearfix">
<% i = 0; %>
<% _.each( daysOfTheWeek, function ( day ) { %>
<% if ( extras.show_weekends || ! ( i % 7 === 0 || i % 7 === 6 ) ) { %>
<div class="header-day"><%= day %></div>
<% } %>
<% i++ %>
<% }); %>
</div>
<div class="days clearfix">
<% i = 0; %>
<% _.each( days, function ( day ) { %>
<% if ( i % 7 === 0 ) { %>
<div class="week">
<% } %>
<% if ( extras.show_weekends || ! ( i % 7 === 0 || i % 7 === 6 ) ) { %>
<div class="<%= day.classes %>" id="<%= day.id %>">
<span class="day-number font-mono"><%= day.day %></span>
<div class="events">
<% var j = 0; %>
<% day.events = _.sortBy( day.events, 'time' ) %>
<% _.each( day.events, function ( e ) { %>
<a href="<%= e.url %>" class="event <%= e.status %>">
<span class="title"><%= e.title %></span>
</a>
<% }); %>
</div>
<% } %>
</div><!-- /day -->
<% } %>
<% if ( i % 7 == 6 ) { %>
</div><!-- /week -->
<% } %>
<% i++ %>
<% }); %>
</div><!-- /days -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment