views:

9194

answers:

6

What are the current best practices in the Rails world for displaying a calendar month view with event items bound to the days in the month (like in Backpack or Google Calendar, for example)?

I don't need anything like fancy stuff like drag and drop support. I'm just looking for code to let me get a list of events in my controller and somehow expose them as entries in a monthly calendar display view (maybe with class names on the HTML elements to allow me to display different types of events differently, or maybe to display events from multiple calendars).

There's the Dynamic Calendar Helper that was created a few years ago, which very well might still work just fine for me, but I'm just wondering if I should be looking at other plugins, too.

Other possibilities I've found so far:

So, can you point me in the right direction as to what folks are using to output monthly calendars with data these days?

+1  A: 

Take a look at the calendar view in Redmine.

Cameron McCloud
+3  A: 

I don't know if this suits the constraints of your problem, but have you looked at the Google Calendar API? I don't know whether you can count on your users having their own accounts, or whether you can programmatically create all the calendars you need on one account and just pull the per-calendar data through the API, but it might be worth a look.

bradheintz
+2  A: 

I ended up going with the Dynamic Calendar Helper for now.

Gabe Hollombe
+5  A: 

Check out http://github.com/p8/table_builder/tree/master. It works more like form_for. It also doesn't require Event objects, just objects with a method that returns a date.

  <% calendar_for(@tasks, :year => @year, :month => @month) do |t| %>
    <%= t.head('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun') %>
    <% t.day(:day_method => YOUR_DATE_METHOD) do |day, tasks| %>
      <%= day.day %><br />
      <% tasks.each do |task| %>
          <%= h(task.name) %><br />
        <% end %>
      <% end %>
    <% end %>
  <% end %>
+8  A: 

Here's a Rails plugin that can display multiple, overlapping events across calendar days.

http://github.com/elevation/event_calendar

Screenshot(s) at: http://dev.elevationblog.com/2009/7/23/event-calendar-rails-plugin

Jeff Schuil
+1  A: 

If anyone's still looking for a rails calendar plugin, Topfunky's calendar_helper now works well:

http://github.com/topfunky/calendar%5Fhelper

Martin Dow