Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A Rails view helper for creating weekly calendars (horizontal scrolling), inspired by TableBuilder.
branch: master



A weekly calendar builder for ruby on rails. Although there are countless monthly calendars on Github I couldn't find any with a weekly view, so I built my own.

The calendar is horizontally scrolling with a completely fluid CSS layout and an option for business/24 hours. Weekly views are useful because the events are plotted based on time and the width is determined by how long the event is scheduled for. So there is a visual representation of when the event is, not just a list.

The code is inspired by P8s table_builder which I recommend for monthly calendars.


Live demo:


Install the plugin (rails 3):

rails plugin install git:// 

How to Use WeeklyBuilder

Add the calendar builder to your view (examples are in HAML):

= weekly_calendar(@events, :date => @date, :include_24_hours => true) do |w|
  = w.week(:business_hours => params[:business_hours], :clickable_hours => true) do |event,truncate|
    =  event.starts_at.strftime('%I:%M%p')
    =  link_to truncate(,truncate), event_path(event)

The Next/Previous week links helper:

= weekly_links(:date => @date)

In your controller:

@date = Time.parse("#{params[:start_date]} ||")
@start_date =, @date.month, 
@events = Event.find(:all, :conditions => ['starts_at between ? and ?', @start_date, @start_date + 7])

The event model only requires 2 attributes: starts_at:datetime and ends_at:datetime to calculate width and position on the calendar. In my demo app I ask the user for one date/time (starts_at) and estimated time to complete (for example 2hrs), it then calculates ends_at after it is submitted.

Include the weekly.css stylesheet:

= stylesheet_link_tag("weekly")

UPDATE: Added a truncate_width method so that long event names are truncated in proportion to the width of the event, this is passed through the week block with |truncate|.

Options available:

  • :include_24_hours Default hours are 6am-8pm, if this set as "true" then an option to switch to a 24-hour schedule appears at the bottom

2011 Dan McGrady, released under the MIT license

Thanks to P8

Something went wrong with that request. Please try again.