README.md in simple_calendar-0.1.1 vs README.md in simple_calendar-0.1.2
- old
+ new
@@ -22,10 +22,21 @@
SimpleCalendar will look for a method on your model called `start_time`.
This is used to determine the day and time of the event. This should be
a `DateTime` object or at least respond similarly.
+The simplest way to use SimpleCalendar is to have an attribute on your
+model called `start_time` and you won't need to make any changes to your
+model at all. For example, I used `rails g model Event name:string
+start_time:datetime` to generate this class:
+
+```ruby
+class Event < ActiveRecord::Base
+ attr_accessible :name, :start_time
+end
+```
+
If you don't have an attribute called `start_time` on your model, you
can simply delegate like so:
```ruby
class Event < ActiveRecord::Base
@@ -70,19 +81,35 @@
<%= calendar @events, {:prev_text=>"prev", :next_text=>"next"} do |event| %>
<div><%= link_to event.title, event %></div>
<% end %>
-This time calendar will use prev and next as labels for previous and next month links (which are normally set to &laquo; («) and &raquo; (»)
+This time calendar will use prev and next as labels for previous and next month
+links (which are normally set to &laquo; («) and &raquo; (»)
Possible options:
:year # current year, default: from params or current year
:month # current month, default: from params or current month
:prev_text # previous month link text, default: «
:next_text # next month link text, default: »
+ :start_day # starting day of week, default: :sunday
+If you wish to have Monday as the first day of the week, you'll need to
+change a couple things. First, when rendering the calendar, use the
+`:start_day => :monday` option like so:
+
+```ruby
+<%= calendar @events, :start_day => :monday do |event| %>
+ <%= link_to event.title, event %>
+<% end %>
+```
+
+And the second step is to make sure you've set your `I18n.locale` to the
+correct one. There is a lot of information here regarding use of locales in Rails:
+https://github.com/svenfuchs/rails-i18n
+
CSS
---
You will probably want to customize the height of the calendar so that
all the rows are the same heights and widths. You can do this by adding
@@ -90,10 +117,5 @@
.calendar td { height: 100px; width: 14.28%; }
By default simple_calendar will set the calendar to use .bordered-table
and .calendar classes.
-
-TODO
-====
-
-* Customizable starting day of week