simple_calendar 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/simple_calendar/version.rb +1 -1
- data/lib/simple_calendar/view_helpers.rb +11 -8
- metadata +2 -2
@@ -2,8 +2,8 @@ module SimpleCalendar
|
|
2
2
|
module ViewHelpers
|
3
3
|
|
4
4
|
def calendar(events, options={}, &block)
|
5
|
-
opts = {
|
6
|
-
:year => (params[:year] || Time.zone.now.year).to_i,
|
5
|
+
opts = {
|
6
|
+
:year => (params[:year] || Time.zone.now.year).to_i,
|
7
7
|
:month => (params[:month] || Time.zone.now.month).to_i,
|
8
8
|
:prev_text => raw("«"),
|
9
9
|
:next_text => raw("»")
|
@@ -51,7 +51,7 @@ module SimpleCalendar
|
|
51
51
|
# Renders the calendar table
|
52
52
|
def draw_calendar(selected_month, month, current_date, events, options, block)
|
53
53
|
tags = []
|
54
|
-
|
54
|
+
today = Date.today
|
55
55
|
content_tag(:table, :class => "table table-bordered table-striped calendar") do
|
56
56
|
tags << month_header(selected_month, options)
|
57
57
|
tags << content_tag(:thead, content_tag(:tr, I18n.t("date.abbr_day_names").collect { |name| content_tag :th, name, :class => (selected_month.month == Date.today.month && Date.today.strftime("%a") == name ? "current-day" : nil)}.join.html_safe))
|
@@ -61,11 +61,14 @@ module SimpleCalendar
|
|
61
61
|
content_tag(:tr, :class => (week.include?(Date.today) ? "current-week week" : "week")) do
|
62
62
|
|
63
63
|
week.collect do |date|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
td_class = ["day"]
|
65
|
+
td_class << "today" if today == date
|
66
|
+
td_class << "not-current-month" if selected_month.month != date.month
|
67
|
+
td_class << "past" if today > date
|
68
|
+
td_class << "future" if today < date
|
69
|
+
td_class << "wday-#{date.wday.to_s}" # <- to enable different styles for weekend, etc
|
70
|
+
|
71
|
+
content_tag(:td, :class => td_class.join(" "), :'data-date-iso'=>date.to_s, 'data-date'=>date.to_s.gsub('-', '/')) do
|
69
72
|
content_tag(:div) do
|
70
73
|
divs = []
|
71
74
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_calendar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08
|
12
|
+
date: 2012-09-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|