Cal
A low level calendar engine.
Installation
Add this line to your application's Gemfile:
gem 'cal'
And then execute:
$ bundle
Or install it yourself as:
$ gem install cal
Usage
Rails example
# in the controller
- calendar = Cal::MonthlyCalendar.new params[:date]
# in the view
%h3
= link_to 'Previous month', url_for(:date => calendar.previous.date)
|
= calendar.month
|
= link_to 'Next month', url_for(:date => calendar.next.date)
%table
%thead
%tr
%th Sunday
%th Monday
%th Tuesday
%th Wednesday
%th Thursday
%th Friday
%th Saturday
%tbody
- calendar.weeks.each do |week|
%tr
- week.days.each do |day|
%td{:class => ('today' if day.today?)}
= day.number
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request