Skip to content

Instantly share code, notes, and snippets.

@excid3
Created January 26, 2015 14:31
Show Gist options
  • Save excid3/b197f1dc913def10f749 to your computer and use it in GitHub Desktop.
Save excid3/b197f1dc913def10f749 to your computer and use it in GitHub Desktop.
<%= week_calendar events: @meetings do |date, meetings| %>
<%# Print out the date at the top %>
<%= date %>
<% (0..23).each do |hour| %>
<div class="hour-of-day">
<%# Print out the current hour %>
<%= Time.parse("#{hour}:00").strftime("%l %P") %>
<%# Filter out the meetings that are scheduled for the same hour. %>
<%# You may also want to sort the resulting array to make sure they display in order %>
<% meetings.select{ |m| m.scheduled_time.hour == hour }.each do |meeting| %>
<div><%= meeting.name %></div>
<% end %>
</div>
<% end %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment