Skip to content
calendar plugin for ruby on rails http://code.google.com/p/instantcalendar/
Ruby
Find file
Pull request Compare This branch is 1 commit ahead of unnitallman:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
assets
lib
tasks
test
MIT-LICENSE
README
Rakefile
init.rb
install.rb
uninstall.rb

README

Copyright (c) 2009 Unnikrishnan KP, released under the MIT license

Instant Calendar 
===============

Displays a simple HTML calendar. Appearance and behaviour of the calendar is fully customizable.

Usage
=====

1. ruby script/plugin install git://github.com/unni123/instantcalendar.git

2. Rails >= 2.0 
   rake instant_calendar:setup

   Rails < 2.0
   rake instant_calendar:setup_old

3. Restart your application

4. See examples below

Example
=======

1.Displays the calendar of current month & year

<%= show_calendar %>    

2. Displays the calendar of March, current year 

<%= show_calendar :month => 3 %>

3. Displays the calendar of March, 1985

<%= show_calendar :month => 3, :year => 1985 %>

4. Highlight today's date

<%= show_calendar :highlight_today => true %>

5. Highlighting selected dates

<%= show_calendar :highlight_dates => [10,15,28] %>

6. Custom text for selected dates.

<%= show_calendar :dates => { 5 => "xyz", 26 => "abc" } %>

In the calendar, date 5 will be replaced by 'xyz', and 26 by 'abc'

7. Linking specific dates to specific URLs.

<%= show_calendar :dates => { 12 => link_to("12","/events/123") } %>
<%= show_calendar :dates => { 12 => link_to("12",event_path(123)) } %>
<%= show_calendar :dates => { 12 => link_to("Twelve",event_path(123)) } %>

8. Ajax links

<%= show_calendar :dates => {22 => link_to_remote("22",:url => "/events/123",:method => :get) }   %>
<%= show_calendar :dates => {22 => link_to_remote("22",:url => event_path(123),:method => :get) } %>

9. Javascript actions

<%= show_calendar :dates => {15 => link_to_function("15","alert('Hello');") } %>
<%= show_calendar :dates => {15 => "<span onmouseover=\"alert('Hello');\" >23</span>"} %>

Appearance
==========

1. A calendar.css file is generated and used by the plugin (public/stylesheets/calendar.css). Edit this file to customize appearance of the calendar.

2. Width of the calendar is not restricted. It occupies the full width of its container. 

3. Every date (rectangle holding each date - table's TD) has a unique ID of the form 'date_1','date_12' etc. This also can be used for extra styling or may be behaviour control with UJS etc. 


===========================================================================================

  Author: Unnikrishnan KP
  Blog: http://unnionrails.blogspot.com
  Contact: unni.tallman@gmail.com
  Plugin Homepage: http://code.google.com/p/instantcalendar/

  Any feedback/comment/issue/donation is welcome!

===========================================================================================

Something went wrong with that request. Please try again.