Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/topfunky/calendar_helper
Calendar-generating plugin for Ruby
https://github.com/topfunky/calendar_helper
Last synced: 4 days ago
JSON representation
Calendar-generating plugin for Ruby
- Host: GitHub
- URL: https://github.com/topfunky/calendar_helper
- Owner: topfunky
- License: mit
- Created: 2008-11-10T19:56:22.000Z (about 16 years ago)
- Default Branch: master
- Last Pushed: 2014-12-29T11:57:40.000Z (almost 10 years ago)
- Last Synced: 2024-04-15T14:13:24.864Z (7 months ago)
- Language: Ruby
- Homepage: http://rubyonrailsworkshops.com
- Size: 324 KB
- Stars: 369
- Watchers: 10
- Forks: 94
- Open Issues: 2
-
Metadata Files:
- Readme: README.rdoc
- Changelog: History.rdoc
- License: MIT-LICENSE
Awesome Lists containing this project
README
= CalendarHelper
{}[http://travis-ci.org/topfunky/calendar_helper]
== DESCRIPTION:
A simple helper for creating an HTML calendar. The "calendar" method will be
automatically available to your Rails view templates, or can be used with
Sinatra or other webapps.Some example stylesheets are provided via the Rails asset pipeline. Add to
your main stylesheet with one of the following:/*
*= require 'calendar_styles/grey'
* OR
*= require 'calendar_styles/red'
* OR
*= require 'calendar_styles/blue'
*/== SYNOPSIS:
# Simple
calendar(:year => 2005, :month => 6)
# Set table class
calendar({:year => 2005, :month => 6, :table_class => "calendar_helper"})
# Full featured
calendar(:year => 2005, :month => 5) do |d| # This generates a simple calendar, but gives special days
if listOfSpecialDays.include?(d) # (days that are in the array listOfSpecialDays) one CSS class,
[d.mday, {:class => "specialDay"}] # "specialDay", and gives the rest of the days another CSS class,
else # "normalDay". You can also use this highlight today differently
[d.mday, {:class => "normalDay"}] # from the rest of the days, etc.
end
endIf using with ERb (Rails), put in a printing tag.
<%= calendar(:year => @year, :month => @month, :first_day_of_week => 1) do |d|
render_calendar_cell(d)
end
%>With Haml, use a helper to set options for each cell.
= calendar(:year => @year, :month => @month, :first_day_of_week => 1) do |d|
- render_calendar_cell(d)In Sinatra, include the CalendarHelper module in your helpers:
helpers do
include CalendarHelper
end== Accessibility & 508 Compliance:
* The table tag has a summary attribute (overridable).
* Each th has an id.
* Each td as a headers attribute, containing the element id of the appropriate th.== AUTHORS:
Jeremy Voorhis -- http://jvoorhis.com
Original implementationGeoffrey Grosenbach -- http://nubyonrails.com
Test suite and conversion to a Rails plugin== Contributors:
* Jarkko Laine http://jlaine.net/
* Tom Armitage http://infovore.org
* Bryan Larsen http://larsen.st
* Eric Anderson http://saveyourcall.com== USAGE:
See the RDoc (or use "rake rdoc").
To copy the CSS files, use
./script/generate calendar_styles
CSS will be copied to subdirectories of public/stylesheets/calendar.