RailsCalendar
An easy to use calendar for your rails app.
Installation
Add this line to your application's Gemfile:
gem 'rails-calendar'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rails-calendar
Usage
Use the provided helper to render the calendar in your view:
<%= rails_calendar %>
By default the calendar will show the current month, but can be easily changed passing a Date object to the helper. For example, to render the calendar for March 2000:
<%= rails_calendar(Date.new(2000, 3)) %>
Additionally, you can specify a block that will be invoked for each day to show custom information in any calendar cell:
<%
events = {
'2014-03-01' => [ 'TODO 1', 'TODO 2' ],
'2014-03-03' => [ 'TODO 3' ]
}
%>
<%= rails_calendar(Date.new(2014, 3)) do |date| %>
<% if events[date.to_s].present? %>
<ul>
<% events[date.to_s].each do |event| %>
<li><%= event %></li>
<% end %>
</ul>
<% end %>
<% end %>
Contributing
- Fork it ( https://github.com/rdiazv/rails_calendar/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request