+
+ -
+ <%= link_to 'Select Month '.html_safe, root_path, :'data-toggle' => 'dropdown', :class => 'dropdown-toggle' %>
+
+
+
<%= link_to t('simple_calendar.previous', default: 'Previous'), calendar.url_for_previous_view %>
<%= t('date.month_names')[start_date.month] %> <%= start_date.year %>
<%= link_to t('simple_calendar.next', default: 'Next'), calendar.url_for_next_view %>
@@ -20,9 +31,9 @@
<% week.each do |day| %>
<%= content_tag :td, class: calendar.td_classes_for(day) do %>
<% if defined?(Haml) && respond_to?(:block_is_haml?) && block_is_haml?(block) %>
- <% capture_haml(day, sorted_events.fetch(day, []), &block) %>
+ <% capture_haml(day.day, sorted_events.fetch(day, []), &block) %>
<% else %>
- <% block.call day, sorted_events.fetch(day, []) %>
+ <% block.call day.day, sorted_events.fetch(day, []) %>
<% end %>
<% end %>
<% end %>
diff --git a/lib/simple_calendar/calendar.rb b/lib/simple_calendar/calendar.rb
index 50043b07..45bcfb1d 100644
--- a/lib/simple_calendar/calendar.rb
+++ b/lib/simple_calendar/calendar.rb
@@ -40,11 +40,24 @@ def td_classes_for(day)
td_class << 'prev-month' if start_date.month != day.month && day < start_date
td_class << 'next-month' if start_date.month != day.month && day > start_date
td_class << 'current-month' if start_date.month == day.month
- td_class << 'has-events' if sorted_events.fetch(day, []).any?
-
+ if sorted_events.fetch(day, []).any?
+ td_class << 'has-events'
+ if sorted_events.fetch(day, []).first.type == "federal"
+ td_class << 'federal'
+ elsif sorted_events.fetch(day, []).first.type == "holiday"
+ td_class << 'holiday'
+ else
+ td_class << 'system'
+ end
+ end
td_class
end
+ def custom_month(month)
+ custom_date = month.to_date
+ view_context.url_for(@params.merge(start_date_param => custom_date))
+ end
+
def url_for_next_view
view_context.url_for(@params.merge(start_date_param => date_range.last + 1.day))
end