DISQUS

CuppaDev: Making a Real Calendar in Rails

  • tundal45 · 10 months ago
    This is good. What about going the extra step and exporting it to iCal, Google Calendar, etc? Do you know of any plugins/gems/tutorials on how to go about tacking that?

    Thanks
  • James Urquhart · 10 months ago
    For exporting to iCal, i suggest using the iCalendar gem - http://icalendar.rubyforge.org/ - which is pretty simple and straight forward to use (using an ics mime handler), especially if you use an event schema as suggested by the gist.
  • Tom Dickie · 10 months ago
    I'm a complete newbie, so my apologies. Do I install calendar_plugin (topfunky's) and then copy and paste the code from the gist over the top? Specificially I'd love to know how to integrate this into my Rails app.
  • James Urquhart · 10 months ago
    For this particular implementation, i started off with http://github.com/febuiles/cute_calendar/tree/m.... Then ended up merging most of it to my application helpers.
  • pimpmaster · 9 months ago
    I just followed your GIST to the letter and got a nasty MySQL error :(

    http://pastie.textmate.org/404595
  • James Urquhart · 9 months ago
    Apologies. I have posted a GIST which contains all the code i used in an example app, if that helps with your implementation..

    http://gist.github.com/74325
  • Mike · 6 months ago
    Did you think in write a new plugin with your changes?

    Thanks
  • kevin · 5 months ago
    I appreciate you efforts here but you said that your gist contains all the code that you used for an example app but where is the migrations data?
  • James Urquhart · 5 months ago
    Kevin,

    Good point. I don't have the schema off hand, but it went something like...

    Events:
    id(int), calendar_id(int), name(string), created_by_id(int), updated_by_id(int), start_date(datetime), end_date(datetime), repeat_id(int)
    Calendar
    id(int), name(string), created_by_id(int), updated_by_id(int)

    The key bits being the Calendar and the calendar_id, start_date, end_date, and name on the Event.

    Obviously modify to suit your needs :)

    Hope that helps! :)
  • Jeff Schuil · 5 months ago
    I took your example from gist, adapted it for my needs, and just extracted it to a plugin on github.

    http://dev.elevationblog.com/2009/7/23/event-ca...

    Thanks for the help!
  • James Urquhart · 5 months ago
    Neat. Linked to from the post! :D
  • John · 5 months ago
    That's really neat and thank you for creating the plugin! However, is there a way to create links on the event strips to link to other pages? Like clicking on a strip would redirect you to another page where it listed more detailed event information?
  • James Urquhart · 4 months ago
    Regarding the plugin, as with my original code you can customise the event view by passing a block to the calendar helper (along with the configuration options). i.e.:

    calendar event_calendar_options do |event|
    "<div>#{h(event.name)}</div>"
    end