Skip to content

pullmonkey/simple_calendar

Repository files navigation

SimpleCalendar
==============

This is the Simple Calendar Plugin.
You can easily add calendar items for any day and then view it in month view or day view.
Install with:
  ruby script/plugin install http://svn.pullmonkey.com/plugins/trunk/simple_calendar


Install
=======
For this pugin you will need several javascript, stylesheet, and image files.
These files should be installed automatically on installation. If not then you
can use the rake command to install them.

To install these files use:
  rake simple_calendar:install

If you want to remove these files use:
  rake simple_calendar:uninstall


Migrations
==========
To generate migrations use:
  ruby script/generate simple_calendar_migrations

This should create 2 migration files:
  - 01_create_simple_calendars.rb
  - 02_create_simple_calendar_entries.rb

Dependencies
============
This plugin only has 1 dependency which is the acts_as_taggable_on_steroids 
plugin. This plugin is only needed if you want to be able to make your entries
taggable. To install this plugin do:
  ./script/plugin install http://github.com/jviney/acts_as_taggable_on_steroids.git

Environment.rb
==============
config.time_zone = 'UTC'

Layout
======
You only need to add the color stylesheet to your layout. As of now all we have
is red and gold. Just pick one and add it to your layout.

  <%= stylesheet_link_tag 'simple_calendar_red' %>
  <%= stylesheet_link_tag 'simple_calendar_gold' %>

Example of Calendar
===================

Put this in your view wherever you want the simple calendar to show up:

  <%= render :simple_calendar => "test", :mode => params[:mode],
                                         :date => params[:date] %>

You must pass params[:mode] and params[:date] so that after entering an entry 
the mode and date of where you are will be returned back to the simple calendar
controller. However, if you don't plan on the admin to ever be true then you 
won't need to pass them at all.

The additional options you can pass to simple_calendar are:
  :admin => true/false - This decides whether you can edit the calendar or not
                       - defaults to false
  :writable => true/false - This decides whether a user can add and remove their
      own items or not. Must pass a :user for this to work properly.
                          - defaults to false
  :user => "username" - This sets the user that is making changes. A user with 
      :writable set to true can only edit or remove the entries that user created.
  :prefix => "/test" - This is whatever the prefix for you site is
                     - defaults to ""
  :return_to => "/projects/test_project" - This is the path in front of simple_calendar/
                                         - defaults to ""
  :mode => "month" - This is the starting mode you want the calendar to be in
                   - defaults to "month"
  :date => "2008-10-29".to_date - Passes the starting date
                                - defaults to Date.today
  :year => 2008 - If you don't pass a date then you can pass year seperately
  :month => 10 - If you don't pass a date then you can pass month seperately
  :day => 29 - If you don't pass a date then you can pass day seperately
  :show_wiki_entries => true/false - When set to true a "Wiki Entries" button
      will appear. Clicking on this button will pop up a modal with all the 
      entries after the current date in a format easily copied to a Wiki.
                                   - defaults to false
  :taggable => true/false - Pass true to enable taggable entries. When true you
      will be able to tag an entry and filter all entries depending on the tag.
                          - defaults to false
  :serial_only => true/false - Pass true to force entries to only be added 
      serialy (no overlapping entries).
  :entry_link_length => [integer] - The entry name will truncate at this value
      in the month view
      - defaults to 15
  :day_start_hour => [integer] - The hour you want to start at in the day view
      unless there is an entry before this time.
      - Time must be entered in military time (13 is 1pm, 14 is 2pm, etc.)
      - defaults to 0 (which will start at 12am current day)
  :day_end_hour => [integer] - The hour you want to end at in the day view
      unless there is an entry after this time.
      - Time must be entered in military time (13 is 1pm, 14 is 2pm, etc.)
      - defaults to 24 (which will end at 12am the next day)

Example of Small Calendar
=========================
This generates a small calendar with the month view and the day numbers are
links to the day view in the large simple calendar. To do this put this
anywhere in your view:

  <%= render :small_simple_calendar => "test", 
             :path => "/path/to/rendering/of/large/calendar" %>

The name of the calendar must be the same as the one you use for the large
simple calendar or else the entry data won't exist. The path is to where you 
render the simple_calendar.

Example of Upcoming Events
==========================
This generates a list of the upcoming events from todays date on.

  <%= render :simple_calendar_upcoming_events => "test",
             :path => "/path/to/rendering/of/large/calendar" %>
  
The name of the calendar must be the same as the one you use for the large
simple calendar or else the entry data won't exist. The path is to where you 
render the simple_calendar.

The additional options you can pass to simple_calendar_upcoming_events are:
  :items => 5 - This is the max number of items you want listed.
              - default is everything it finds
  :tag => 'mytag' - If you are using taggable entries then you can pass a tag
      or a string of tags (comma delimited) to find from the calendar
      - defaults to finding everything
  :entry_name_length => 20 - The entry name will truncate at this value. This
      does not include the length of the date.
      - defaults to 100 so pretty much everything

Copyright (c) 2008-2010 [Sean Naegle], released under the MIT license

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published