public
Fork of nakajima/calendar-maker
Description: Rails plugin to build a simple calendar scaffold, with events signified by class names added to the day.
Homepage: http://devthatweb.com/view/another-calendar-helper-for-rails
Clone URL: git://github.com/jherdman/calendar-maker.git
Search Repo:
name age message
folder .autotest Mon May 19 17:56:46 -0700 2008 Convert to RSpec [jherdman]
folder MIT-LICENSE Tue May 27 05:50:00 -0700 2008 added proper names to README and Licenes [nakajima]
folder README Tue May 27 05:50:00 -0700 2008 added proper names to README and Licenes [nakajima]
folder Rakefile Wed Feb 20 01:06:40 -0800 2008 initial commit, added files [nakajima]
folder init.rb Wed Feb 20 01:06:40 -0800 2008 initial commit, added files [nakajima]
folder install.rb Wed Feb 20 01:06:40 -0800 2008 initial commit, added files [nakajima]
folder lib/ Mon May 26 21:46:24 -0700 2008 A note and cleanup [jherdman]
folder spec/ Thu May 22 21:58:37 -0700 2008 Leverage Facets/Date [jherdman]
folder tasks/ Wed Feb 20 01:06:40 -0800 2008 initial commit, added files [nakajima]
folder uninstall.rb Wed Feb 20 01:06:40 -0800 2008 initial commit, added files [nakajima]
README
Calendar Maker
==============

Putting a calendar on a web page is easy now. Also, you can add events to a 
calendar, which are denoted by adding a custom class name to that day, allowing
you to style it differently, or even define behavior for that day via unobtrusive
Javascript.


Usage
=====

You can create a new calendar object by simply running "Calendar.new" from either
your controller or your view. You can specify the month and year of your calendar
like so:

  @calendar = Calendar.new(:month => 'oct', :year => 2001)
  
If you'd like to add events to the calendar object, you can simply pass it an
array of objects via its #add method, then designating an attribute to signify the
event date using the :schedule_for option. This option is not optional. If you don't
include it, an ArgumentError exception will be raised.

You can also specify which class should be added to days that have certain events
by using the :html_class option. If you don't provide one, then the plugin will just
add the :schedule_for value as a class name.

Finally, use the #generate method to actually render the HTML code for your calendar.

Example
=======

In your controller...

  class PartyController < ApplicationController
    def index
      @parties  = Party.find(:all)
      @calendar = Calendar.new
      @calendar.add @parties, :schedule_for => :party_date, :html_class => "party_time"
      render :action => :index
    end
  end

In your view...

  <%= @calendar.generate %>

Todo
====

- Clean it up. Big time.
- Finish documentation.

Copyright (c) 2007 Pat Nakajima, James Herdman, released under the MIT license