Typo Sidebar - CalendarHelper
One of the sidebar plugins I wrote needed a calendar. I decided to use Jeremy Voorhis’s calendar-helper. There are examples on his page on how to use it so I won’t go into those details here. The reason for this post is about how to get it working with Typo.
It proved fiddly because after putting the file in the ‘components’ directory made it visible in my controller class (with require 'calendar-helper' and include CalendarHelper) but not in ‘content.rhtml’. After a lot of Googling I found that the component needed to be installed as a global view helper. Those instructions aren’t the clearest, so here’s what you need to do:
- Install
calendar_helper.rbto/typo/vendor/plugins/calendar_helper/lib - In
calendar_helper.rbchangemodule CalendarHelpertomodule ActionView::Helpers::CalendarHelper - At the bottom of
calendar_helper.rb(after the last end) addActionView::Base.send(:include, ActionView::Helpers::CalendarHelper)
- Create a file: ‘
/typo/vendor/plugins/calendar_helper/init.rb‘ and put in it:require 'calendar_helper'
And after those four easy steps the ‘calendar’ function is now available in ‘content.rhtml’.

January 4th, 2008 at 7:58 pm
[…] I added the DynamicCalendarHelper plugin to my current Rails project today, only to discover that I couldn’t call it the way that I expected from a view. Eventually I found the answer at Typo Sidebar - CalendarHelper which had instructions for turning the plugin into a global view helper. I was expecting a somewhat more seamless experience. […]