Dmix small Dan McGrady
UX Designer & programmer from Toronto.
Follow @dmix on twitter

WeeklyBuilder: A weekly calendar plugin for Rails

I implemented a scheduling system into a rails app this month and I needed a calendar with monthly and weekly views.

15,793 views
Posted over 4 years ago in programming

WeeklyBuilder

I implemented a scheduling system into an app this month and I needed a calendar with monthly and weekly views.

There are over 80 repo’s on github for calendar + ruby. Calendars in rails are a solved problem, right? But oddly I couldn’t find one with a weekly view. All of them are either date pickers or monthly calendars.

So I decided to build my own and I’m happy to announce my first plugin: WeeklyBuilder [Github | Live Demo]

The builder creates a horizontal scrolling calendar, mapping events for each day of the week. The layout is fluid CSS and the hours can be switched from business hours to 24 hours.

The code was inspired by table_builder by Petrik de Heus which is a clean way to generate monthly calenders.

How to Use WeeklyBuilder

First install by downloading the source from github or via command line:
The weekly calendar builder:
The Next/Previous link helper:
The controller code:
Example events model:

The event model only requires 2 attributes: starts_at:datetime and ends_at:datetime to calculate width and position on the calendar. To simplify this for the user, I only ask the user for one datetime (starts_at) and how long it will take to complete, it then calculates ends_at based on those 2 attributes.

Github: http://github.com/dmix/weekly_builder/
Example: http://scheduler.integratehq.com/
Note: The demo uses table_builder for the monthly view and includes a few extra styles on the weekly. Not yet tested on IE6.

Update (03/06): 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: |event, truncate|.


comments powered by Disqus