simple_calendar 2.2.6 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "standard"
7
+ gem "rails", "~> 6.1.0"
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,200 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ simple_calendar (2.4.2)
5
+ rails (>= 3.0)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actioncable (6.1.1)
11
+ actionpack (= 6.1.1)
12
+ activesupport (= 6.1.1)
13
+ nio4r (~> 2.0)
14
+ websocket-driver (>= 0.6.1)
15
+ actionmailbox (6.1.1)
16
+ actionpack (= 6.1.1)
17
+ activejob (= 6.1.1)
18
+ activerecord (= 6.1.1)
19
+ activestorage (= 6.1.1)
20
+ activesupport (= 6.1.1)
21
+ mail (>= 2.7.1)
22
+ actionmailer (6.1.1)
23
+ actionpack (= 6.1.1)
24
+ actionview (= 6.1.1)
25
+ activejob (= 6.1.1)
26
+ activesupport (= 6.1.1)
27
+ mail (~> 2.5, >= 2.5.4)
28
+ rails-dom-testing (~> 2.0)
29
+ actionpack (6.1.1)
30
+ actionview (= 6.1.1)
31
+ activesupport (= 6.1.1)
32
+ rack (~> 2.0, >= 2.0.9)
33
+ rack-test (>= 0.6.3)
34
+ rails-dom-testing (~> 2.0)
35
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
+ actiontext (6.1.1)
37
+ actionpack (= 6.1.1)
38
+ activerecord (= 6.1.1)
39
+ activestorage (= 6.1.1)
40
+ activesupport (= 6.1.1)
41
+ nokogiri (>= 1.8.5)
42
+ actionview (6.1.1)
43
+ activesupport (= 6.1.1)
44
+ builder (~> 3.1)
45
+ erubi (~> 1.4)
46
+ rails-dom-testing (~> 2.0)
47
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
+ activejob (6.1.1)
49
+ activesupport (= 6.1.1)
50
+ globalid (>= 0.3.6)
51
+ activemodel (6.1.1)
52
+ activesupport (= 6.1.1)
53
+ activerecord (6.1.1)
54
+ activemodel (= 6.1.1)
55
+ activesupport (= 6.1.1)
56
+ activestorage (6.1.1)
57
+ actionpack (= 6.1.1)
58
+ activejob (= 6.1.1)
59
+ activerecord (= 6.1.1)
60
+ activesupport (= 6.1.1)
61
+ marcel (~> 0.3.1)
62
+ mimemagic (~> 0.3.2)
63
+ activesupport (6.1.1)
64
+ concurrent-ruby (~> 1.0, >= 1.0.2)
65
+ i18n (>= 1.6, < 2)
66
+ minitest (>= 5.1)
67
+ tzinfo (~> 2.0)
68
+ zeitwerk (~> 2.3)
69
+ appraisal (2.3.0)
70
+ bundler
71
+ rake
72
+ thor (>= 0.14.0)
73
+ ast (2.4.2)
74
+ builder (3.2.4)
75
+ concurrent-ruby (1.1.8)
76
+ crass (1.0.6)
77
+ diff-lcs (1.4.4)
78
+ erubi (1.10.0)
79
+ globalid (0.4.2)
80
+ activesupport (>= 4.2.0)
81
+ i18n (1.8.8)
82
+ concurrent-ruby (~> 1.0)
83
+ loofah (2.9.0)
84
+ crass (~> 1.0.2)
85
+ nokogiri (>= 1.5.9)
86
+ mail (2.7.1)
87
+ mini_mime (>= 0.1.1)
88
+ marcel (0.3.3)
89
+ mimemagic (~> 0.3.2)
90
+ method_source (1.0.0)
91
+ mimemagic (0.3.6)
92
+ mini_mime (1.0.2)
93
+ mini_portile2 (2.5.0)
94
+ minitest (5.14.3)
95
+ nio4r (2.5.4)
96
+ nokogiri (1.11.1)
97
+ mini_portile2 (~> 2.5.0)
98
+ racc (~> 1.4)
99
+ nokogiri (1.11.1-x86_64-darwin)
100
+ racc (~> 1.4)
101
+ nokogiri (1.11.1-x86_64-linux)
102
+ racc (~> 1.4)
103
+ parallel (1.20.1)
104
+ parser (3.0.0.0)
105
+ ast (~> 2.4.1)
106
+ racc (1.5.2)
107
+ rack (2.2.3)
108
+ rack-test (1.1.0)
109
+ rack (>= 1.0, < 3)
110
+ rails (6.1.1)
111
+ actioncable (= 6.1.1)
112
+ actionmailbox (= 6.1.1)
113
+ actionmailer (= 6.1.1)
114
+ actionpack (= 6.1.1)
115
+ actiontext (= 6.1.1)
116
+ actionview (= 6.1.1)
117
+ activejob (= 6.1.1)
118
+ activemodel (= 6.1.1)
119
+ activerecord (= 6.1.1)
120
+ activestorage (= 6.1.1)
121
+ activesupport (= 6.1.1)
122
+ bundler (>= 1.15.0)
123
+ railties (= 6.1.1)
124
+ sprockets-rails (>= 2.0.0)
125
+ rails-dom-testing (2.0.3)
126
+ activesupport (>= 4.2.0)
127
+ nokogiri (>= 1.6)
128
+ rails-html-sanitizer (1.3.0)
129
+ loofah (~> 2.3)
130
+ railties (6.1.1)
131
+ actionpack (= 6.1.1)
132
+ activesupport (= 6.1.1)
133
+ method_source
134
+ rake (>= 0.8.7)
135
+ thor (~> 1.0)
136
+ rainbow (3.0.0)
137
+ rake (13.0.3)
138
+ regexp_parser (2.0.3)
139
+ rexml (3.2.4)
140
+ rspec (3.10.0)
141
+ rspec-core (~> 3.10.0)
142
+ rspec-expectations (~> 3.10.0)
143
+ rspec-mocks (~> 3.10.0)
144
+ rspec-core (3.10.1)
145
+ rspec-support (~> 3.10.0)
146
+ rspec-expectations (3.10.1)
147
+ diff-lcs (>= 1.2.0, < 2.0)
148
+ rspec-support (~> 3.10.0)
149
+ rspec-mocks (3.10.2)
150
+ diff-lcs (>= 1.2.0, < 2.0)
151
+ rspec-support (~> 3.10.0)
152
+ rspec-support (3.10.2)
153
+ rubocop (1.8.1)
154
+ parallel (~> 1.10)
155
+ parser (>= 3.0.0.0)
156
+ rainbow (>= 2.2.2, < 4.0)
157
+ regexp_parser (>= 1.8, < 3.0)
158
+ rexml
159
+ rubocop-ast (>= 1.2.0, < 2.0)
160
+ ruby-progressbar (~> 1.7)
161
+ unicode-display_width (>= 1.4.0, < 3.0)
162
+ rubocop-ast (1.4.1)
163
+ parser (>= 2.7.1.5)
164
+ rubocop-performance (1.9.2)
165
+ rubocop (>= 0.90.0, < 2.0)
166
+ rubocop-ast (>= 0.4.0)
167
+ ruby-progressbar (1.11.0)
168
+ sprockets (4.0.2)
169
+ concurrent-ruby (~> 1.0)
170
+ rack (> 1, < 3)
171
+ sprockets-rails (3.2.2)
172
+ actionpack (>= 4.0)
173
+ activesupport (>= 4.0)
174
+ sprockets (>= 3.0.0)
175
+ standard (0.12.0)
176
+ rubocop (= 1.8.1)
177
+ rubocop-performance (= 1.9.2)
178
+ thor (1.1.0)
179
+ tzinfo (2.0.4)
180
+ concurrent-ruby (~> 1.0)
181
+ unicode-display_width (2.0.0)
182
+ websocket-driver (0.7.3)
183
+ websocket-extensions (>= 0.1.0)
184
+ websocket-extensions (0.1.5)
185
+ zeitwerk (2.4.2)
186
+
187
+ PLATFORMS
188
+ ruby
189
+ x86_64-darwin-20
190
+ x86_64-linux
191
+
192
+ DEPENDENCIES
193
+ appraisal
194
+ rails (~> 6.1.0)
195
+ rspec
196
+ simple_calendar!
197
+ standard
198
+
199
+ BUNDLED WITH
200
+ 2.2.13
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "standard"
7
+ gem "rails", github: "rails/rails"
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,205 @@
1
+ GIT
2
+ remote: https://github.com/rails/rails.git
3
+ revision: f250208dd477e879f16a0cea51bc5c399651107d
4
+ specs:
5
+ actioncable (6.2.0.alpha)
6
+ actionpack (= 6.2.0.alpha)
7
+ activesupport (= 6.2.0.alpha)
8
+ nio4r (~> 2.0)
9
+ websocket-driver (>= 0.6.1)
10
+ actionmailbox (6.2.0.alpha)
11
+ actionpack (= 6.2.0.alpha)
12
+ activejob (= 6.2.0.alpha)
13
+ activerecord (= 6.2.0.alpha)
14
+ activestorage (= 6.2.0.alpha)
15
+ activesupport (= 6.2.0.alpha)
16
+ mail (>= 2.7.1)
17
+ actionmailer (6.2.0.alpha)
18
+ actionpack (= 6.2.0.alpha)
19
+ actionview (= 6.2.0.alpha)
20
+ activejob (= 6.2.0.alpha)
21
+ activesupport (= 6.2.0.alpha)
22
+ mail (~> 2.5, >= 2.5.4)
23
+ rails-dom-testing (~> 2.0)
24
+ actionpack (6.2.0.alpha)
25
+ actionview (= 6.2.0.alpha)
26
+ activesupport (= 6.2.0.alpha)
27
+ rack (~> 2.0, >= 2.0.9)
28
+ rack-test (>= 0.6.3)
29
+ rails-dom-testing (~> 2.0)
30
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
31
+ actiontext (6.2.0.alpha)
32
+ actionpack (= 6.2.0.alpha)
33
+ activerecord (= 6.2.0.alpha)
34
+ activestorage (= 6.2.0.alpha)
35
+ activesupport (= 6.2.0.alpha)
36
+ nokogiri (>= 1.8.5)
37
+ actionview (6.2.0.alpha)
38
+ activesupport (= 6.2.0.alpha)
39
+ builder (~> 3.1)
40
+ erubi (~> 1.4)
41
+ rails-dom-testing (~> 2.0)
42
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
43
+ activejob (6.2.0.alpha)
44
+ activesupport (= 6.2.0.alpha)
45
+ globalid (>= 0.3.6)
46
+ activemodel (6.2.0.alpha)
47
+ activesupport (= 6.2.0.alpha)
48
+ activerecord (6.2.0.alpha)
49
+ activemodel (= 6.2.0.alpha)
50
+ activesupport (= 6.2.0.alpha)
51
+ activestorage (6.2.0.alpha)
52
+ actionpack (= 6.2.0.alpha)
53
+ activejob (= 6.2.0.alpha)
54
+ activerecord (= 6.2.0.alpha)
55
+ activesupport (= 6.2.0.alpha)
56
+ marcel (~> 0.3.1)
57
+ mimemagic (~> 0.3.2)
58
+ activesupport (6.2.0.alpha)
59
+ concurrent-ruby (~> 1.0, >= 1.0.2)
60
+ i18n (>= 1.6, < 2)
61
+ minitest (>= 5.1)
62
+ tzinfo (~> 2.0)
63
+ zeitwerk (~> 2.3)
64
+ rails (6.2.0.alpha)
65
+ actioncable (= 6.2.0.alpha)
66
+ actionmailbox (= 6.2.0.alpha)
67
+ actionmailer (= 6.2.0.alpha)
68
+ actionpack (= 6.2.0.alpha)
69
+ actiontext (= 6.2.0.alpha)
70
+ actionview (= 6.2.0.alpha)
71
+ activejob (= 6.2.0.alpha)
72
+ activemodel (= 6.2.0.alpha)
73
+ activerecord (= 6.2.0.alpha)
74
+ activestorage (= 6.2.0.alpha)
75
+ activesupport (= 6.2.0.alpha)
76
+ bundler (>= 1.15.0)
77
+ railties (= 6.2.0.alpha)
78
+ sprockets-rails (>= 2.0.0)
79
+ railties (6.2.0.alpha)
80
+ actionpack (= 6.2.0.alpha)
81
+ activesupport (= 6.2.0.alpha)
82
+ method_source
83
+ rake (>= 0.8.7)
84
+ thor (~> 1.0)
85
+
86
+ PATH
87
+ remote: ..
88
+ specs:
89
+ simple_calendar (2.4.2)
90
+ rails (>= 3.0)
91
+
92
+ GEM
93
+ remote: http://rubygems.org/
94
+ specs:
95
+ appraisal (2.3.0)
96
+ bundler
97
+ rake
98
+ thor (>= 0.14.0)
99
+ ast (2.4.2)
100
+ builder (3.2.4)
101
+ concurrent-ruby (1.1.8)
102
+ crass (1.0.6)
103
+ diff-lcs (1.4.4)
104
+ erubi (1.10.0)
105
+ globalid (0.4.2)
106
+ activesupport (>= 4.2.0)
107
+ i18n (1.8.8)
108
+ concurrent-ruby (~> 1.0)
109
+ loofah (2.9.0)
110
+ crass (~> 1.0.2)
111
+ nokogiri (>= 1.5.9)
112
+ mail (2.7.1)
113
+ mini_mime (>= 0.1.1)
114
+ marcel (0.3.3)
115
+ mimemagic (~> 0.3.2)
116
+ method_source (1.0.0)
117
+ mimemagic (0.3.6)
118
+ mini_mime (1.0.2)
119
+ mini_portile2 (2.5.0)
120
+ minitest (5.14.3)
121
+ nio4r (2.5.4)
122
+ nokogiri (1.11.1)
123
+ mini_portile2 (~> 2.5.0)
124
+ racc (~> 1.4)
125
+ nokogiri (1.11.1-x86_64-darwin)
126
+ racc (~> 1.4)
127
+ nokogiri (1.11.1-x86_64-linux)
128
+ racc (~> 1.4)
129
+ parallel (1.20.1)
130
+ parser (3.0.0.0)
131
+ ast (~> 2.4.1)
132
+ racc (1.5.2)
133
+ rack (2.2.3)
134
+ rack-test (1.1.0)
135
+ rack (>= 1.0, < 3)
136
+ rails-dom-testing (2.0.3)
137
+ activesupport (>= 4.2.0)
138
+ nokogiri (>= 1.6)
139
+ rails-html-sanitizer (1.3.0)
140
+ loofah (~> 2.3)
141
+ rainbow (3.0.0)
142
+ rake (13.0.3)
143
+ regexp_parser (2.0.3)
144
+ rexml (3.2.4)
145
+ rspec (3.10.0)
146
+ rspec-core (~> 3.10.0)
147
+ rspec-expectations (~> 3.10.0)
148
+ rspec-mocks (~> 3.10.0)
149
+ rspec-core (3.10.1)
150
+ rspec-support (~> 3.10.0)
151
+ rspec-expectations (3.10.1)
152
+ diff-lcs (>= 1.2.0, < 2.0)
153
+ rspec-support (~> 3.10.0)
154
+ rspec-mocks (3.10.2)
155
+ diff-lcs (>= 1.2.0, < 2.0)
156
+ rspec-support (~> 3.10.0)
157
+ rspec-support (3.10.2)
158
+ rubocop (1.8.1)
159
+ parallel (~> 1.10)
160
+ parser (>= 3.0.0.0)
161
+ rainbow (>= 2.2.2, < 4.0)
162
+ regexp_parser (>= 1.8, < 3.0)
163
+ rexml
164
+ rubocop-ast (>= 1.2.0, < 2.0)
165
+ ruby-progressbar (~> 1.7)
166
+ unicode-display_width (>= 1.4.0, < 3.0)
167
+ rubocop-ast (1.4.1)
168
+ parser (>= 2.7.1.5)
169
+ rubocop-performance (1.9.2)
170
+ rubocop (>= 0.90.0, < 2.0)
171
+ rubocop-ast (>= 0.4.0)
172
+ ruby-progressbar (1.11.0)
173
+ sprockets (4.0.2)
174
+ concurrent-ruby (~> 1.0)
175
+ rack (> 1, < 3)
176
+ sprockets-rails (3.2.2)
177
+ actionpack (>= 4.0)
178
+ activesupport (>= 4.0)
179
+ sprockets (>= 3.0.0)
180
+ standard (0.12.0)
181
+ rubocop (= 1.8.1)
182
+ rubocop-performance (= 1.9.2)
183
+ thor (1.1.0)
184
+ tzinfo (2.0.4)
185
+ concurrent-ruby (~> 1.0)
186
+ unicode-display_width (2.0.0)
187
+ websocket-driver (0.7.3)
188
+ websocket-extensions (>= 0.1.0)
189
+ websocket-extensions (0.1.5)
190
+ zeitwerk (2.4.2)
191
+
192
+ PLATFORMS
193
+ ruby
194
+ x86_64-darwin-20
195
+ x86_64-linux
196
+
197
+ DEPENDENCIES
198
+ appraisal
199
+ rails!
200
+ rspec
201
+ simple_calendar!
202
+ standard
203
+
204
+ BUNDLED WITH
205
+ 2.2.13
@@ -1,4 +1,4 @@
1
- require 'rails/generators'
1
+ require "rails/generators"
2
2
 
3
3
  module SimpleCalendar
4
4
  module Generators
@@ -6,7 +6,7 @@ module SimpleCalendar
6
6
  source_root File.expand_path("../../../..", __FILE__)
7
7
 
8
8
  def copy_views
9
- directory 'app/views/simple_calendar', 'app/views/simple_calendar'
9
+ directory "app/views/simple_calendar", "app/views/simple_calendar"
10
10
  end
11
11
  end
12
12
  end
@@ -1,4 +1,4 @@
1
- require 'rails'
1
+ require "rails"
2
2
 
3
3
  module SimpleCalendar
4
4
  class Calendar
@@ -6,16 +6,16 @@ module SimpleCalendar
6
6
 
7
7
  attr_accessor :view_context, :options
8
8
 
9
- def initialize(view_context, opts={})
9
+ def initialize(view_context, opts = {})
10
10
  @view_context = view_context
11
11
  @options = opts
12
12
 
13
13
  # Next and previous view links should use the same params as the current view
14
- @params = @view_context.respond_to?(:params) ? @view_context.params : Hash.new
14
+ @params = @view_context.respond_to?(:params) ? @view_context.params : {}
15
15
  @params = @params.to_unsafe_h if @params.respond_to?(:to_unsafe_h)
16
16
  @params = @params.with_indifferent_access.except(*PARAM_KEY_BLACKLIST)
17
17
 
18
- # Add in any additonal params the user passed in
18
+ # Add in any additional params the user passed in
19
19
  @params.merge!(@options.fetch(:params, {}))
20
20
  end
21
21
 
@@ -23,7 +23,7 @@ module SimpleCalendar
23
23
  view_context.render(
24
24
  partial: partial_name,
25
25
  locals: {
26
- block: block,
26
+ passed_block: block,
27
27
  calendar: self,
28
28
  date_range: date_range,
29
29
  start_date: start_date,
@@ -35,85 +35,93 @@ module SimpleCalendar
35
35
  def td_classes_for(day)
36
36
  today = Date.current
37
37
 
38
- td_class = ['day']
39
- td_class << "wday-#{day.wday.to_s}"
40
- td_class << 'today' if today == day
41
- td_class << 'past' if today > day
42
- td_class << 'future' if today < day
43
- td_class << 'start-date' if day.to_date == start_date.to_date
44
- td_class << 'prev-month' if start_date.month != day.month && day < start_date
45
- td_class << 'next-month' if start_date.month != day.month && day > start_date
46
- td_class << 'current-month' if start_date.month == day.month
47
- td_class << 'has-events' if sorted_events.fetch(day, []).any?
38
+ td_class = ["day"]
39
+ td_class << "wday-#{day.wday}"
40
+ td_class << "today" if today == day
41
+ td_class << "past" if today > day
42
+ td_class << "future" if today < day
43
+ td_class << "start-date" if day.to_date == start_date.to_date
44
+ td_class << "prev-month" if start_date.month != day.month && day < start_date
45
+ td_class << "next-month" if start_date.month != day.month && day > start_date
46
+ td_class << "current-month" if start_date.month == day.month
47
+ td_class << "has-events" if sorted_events.fetch(day, []).any?
48
48
 
49
49
  td_class
50
50
  end
51
51
 
52
+ def tr_classes_for(week)
53
+ today = Date.current
54
+ tr_class = ["week"]
55
+ tr_class << "current-week" if week.include?(today)
56
+
57
+ tr_class
58
+ end
59
+
52
60
  def url_for_next_view
53
- view_context.url_for(@params.merge(start_date_param => date_range.last + 1.day))
61
+ view_context.url_for(@params.merge(start_date_param => (date_range.last + 1.day).iso8601))
54
62
  end
55
63
 
56
64
  def url_for_previous_view
57
- view_context.url_for(@params.merge(start_date_param => date_range.first - 1.day))
65
+ view_context.url_for(@params.merge(start_date_param => (date_range.first - 1.day).iso8601))
66
+ end
67
+
68
+ def date_range
69
+ (start_date..(start_date + additional_days.days)).to_a
58
70
  end
59
71
 
60
72
  private
61
73
 
62
- def partial_name
63
- @options[:partial] || self.class.name.underscore
64
- end
74
+ def partial_name
75
+ @options[:partial] || self.class.name.underscore
76
+ end
65
77
 
66
- def attribute
67
- options.fetch(:attribute, :start_time).to_sym
68
- end
78
+ def attribute
79
+ options.fetch(:attribute, :start_time).to_sym
80
+ end
69
81
 
70
- def end_attribute
71
- options.fetch(:end_attribute, :end_time).to_sym
72
- end
82
+ def end_attribute
83
+ options.fetch(:end_attribute, :end_time).to_sym
84
+ end
73
85
 
74
- def start_date_param
75
- options.fetch(:start_date_param, :start_date).to_sym
76
- end
86
+ def start_date_param
87
+ options.fetch(:start_date_param, :start_date).to_sym
88
+ end
77
89
 
78
- def sorted_events
79
- @sorted_events ||= begin
80
- events = options.fetch(:events, []).reject { |e| e.send(attribute).nil? }.sort_by(&attribute)
81
- group_events_by_date(events)
82
- end
90
+ def sorted_events
91
+ @sorted_events ||= begin
92
+ events = options.fetch(:events, []).reject { |e| e.send(attribute).nil? }.sort_by(&attribute)
93
+ group_events_by_date(events)
83
94
  end
95
+ end
84
96
 
85
- def group_events_by_date(events)
86
- events_grouped_by_date = Hash.new {|h,k| h[k] = [] }
97
+ def group_events_by_date(events)
98
+ events_grouped_by_date = Hash.new { |h, k| h[k] = [] }
87
99
 
88
- events.each do |event|
89
- event_start_date = event.send(attribute).to_date
90
- event_end_date = (event.respond_to?(end_attribute) && !event.send(end_attribute).nil?) ? event.send(end_attribute).to_date : event_start_date
91
- (event_start_date..event_end_date.to_date).each do |enumerated_date|
92
- events_grouped_by_date[enumerated_date] << event
93
- end
100
+ events.each do |event|
101
+ event_start_date = event.send(attribute).to_date
102
+ event_end_date = event.respond_to?(end_attribute) && !event.send(end_attribute).nil? ? event.send(end_attribute).to_date : event_start_date
103
+ (event_start_date..event_end_date.to_date).each do |enumerated_date|
104
+ events_grouped_by_date[enumerated_date] << event
94
105
  end
95
-
96
- events_grouped_by_date
97
106
  end
98
107
 
99
- def start_date
100
- if options.has_key?(:start_date)
101
- options.fetch(:start_date).to_date
102
- else
103
- view_context.params.fetch(start_date_param, Date.current).to_date
104
- end
105
- end
108
+ events_grouped_by_date
109
+ end
106
110
 
107
- def end_date
108
- date_range.last
111
+ def start_date
112
+ if options.has_key?(:start_date)
113
+ options.fetch(:start_date).to_date
114
+ else
115
+ view_context.params.fetch(start_date_param, Date.current).to_date
109
116
  end
117
+ end
110
118
 
111
- def date_range
112
- (start_date..(start_date + additional_days.days)).to_a
113
- end
119
+ def end_date
120
+ date_range.last
121
+ end
114
122
 
115
- def additional_days
116
- options.fetch(:number_of_days, 4) - 1
117
- end
123
+ def additional_days
124
+ options.fetch(:number_of_days, 4) - 1
125
+ end
118
126
  end
119
127
  end