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
See the Rails app https://github.com/austinthecoder/cal-app for an example.
Rails example
# in the controller
- calendar = Cal::MonthlyCalendar.new((params[:date] || Date.current), :start_week_on => :monday)
# in the view
%h3
= link_to 'Previous month', url_for(:date => calendar.previous.date)
|
= "#{calendar.month} #{calendar.year}"
|
= link_to 'Next month', url_for(:date => calendar.next.date)
%table
%thead
%tr
- calendar.day_names.each do |name|
%th= name
%tbody
- calendar.weeks.each do |week|
%tr
- week.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