simple_calendar 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -2
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +8 -1
- data/README.md +1 -1
- data/{lib/simple_calendar/view_helpers.rb → app/helpers/simple_calendar/calendar_helper.rb} +4 -4
- data/gemfiles/rails_6_1.gemfile +1 -0
- data/gemfiles/rails_6_1.gemfile.lock +8 -1
- data/gemfiles/rails_7_0.gemfile +1 -0
- data/gemfiles/rails_7_0.gemfile.lock +8 -1
- data/gemfiles/rails_main.gemfile +1 -0
- data/gemfiles/rails_main.gemfile.lock +8 -1
- data/lib/simple_calendar/calendar.rb +2 -1
- data/lib/simple_calendar/engine.rb +0 -5
- data/lib/simple_calendar/version.rb +1 -1
- data/lib/simple_calendar.rb +5 -11
- data/test/dummy/app/calendars/business_week_calendar.rb +9 -0
- data/test/dummy/app/controllers/meetings_controller.rb +4 -0
- data/test/dummy/app/views/meetings/_business_week_calendar.html.erb +33 -0
- data/test/dummy/app/views/meetings/business_week.html.erb +24 -0
- data/test/dummy/config/routes.rb +5 -1
- data/test/dummy/db/schema.rb +3 -3
- data/test/integrations/custom_calendar_test.rb +31 -0
- metadata +8 -10
- data/test/dummy/tmp/.keep +0 -0
- data/test/dummy/tmp/development_secret.txt +0 -1
- data/test/dummy/tmp/pids/.keep +0 -0
- data/test/dummy/tmp/pids/server.pid +0 -1
- data/test/dummy/tmp/restart.txt +0 -0
- data/test/dummy/tmp/storage/.keep +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37a9649373c34dabc95e3549b89903edea28a8b86e3c5e84defd640354390961
|
4
|
+
data.tar.gz: 561d150c797c2c350fa00501f8936556412efe0158449aa909fd22b824fbf5e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22c618117445c21407bfabd37889f83c5676143704a388670bf3f8b00ddd66d4d41fd2ccc5c4bdf9ecd2cde4b5b232407cac2d4265f2228640b51b4a65503e37
|
7
|
+
data.tar.gz: c284fe582e697f44e001c22dd0380a74c7ef60827a835f7768c058c56585534c339c4b11541ca938ad44da5a6aedad5ccd60fd5fe3e795a0dc921534dbebf105
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -10,7 +10,7 @@ GIT
|
|
10
10
|
PATH
|
11
11
|
remote: .
|
12
12
|
specs:
|
13
|
-
simple_calendar (3.0.
|
13
|
+
simple_calendar (3.0.1)
|
14
14
|
rails (>= 6.1)
|
15
15
|
|
16
16
|
GEM
|
@@ -82,6 +82,7 @@ GEM
|
|
82
82
|
minitest (>= 5.1)
|
83
83
|
tzinfo (~> 2.0)
|
84
84
|
ast (2.4.2)
|
85
|
+
bindex (0.8.1)
|
85
86
|
builder (3.2.4)
|
86
87
|
concurrent-ruby (1.2.2)
|
87
88
|
crass (1.0.6)
|
@@ -197,6 +198,11 @@ GEM
|
|
197
198
|
tzinfo (2.0.6)
|
198
199
|
concurrent-ruby (~> 1.0)
|
199
200
|
unicode-display_width (2.4.2)
|
201
|
+
web-console (4.2.0)
|
202
|
+
actionview (>= 6.0.0)
|
203
|
+
activemodel (>= 6.0.0)
|
204
|
+
bindex (>= 0.4.0)
|
205
|
+
railties (>= 6.0.0)
|
200
206
|
websocket-driver (0.7.5)
|
201
207
|
websocket-extensions (>= 0.1.0)
|
202
208
|
websocket-extensions (0.1.5)
|
@@ -213,6 +219,7 @@ DEPENDENCIES
|
|
213
219
|
simple_calendar!
|
214
220
|
sqlite3
|
215
221
|
standard
|
222
|
+
web-console (~> 4.2)
|
216
223
|
|
217
224
|
BUNDLED WITH
|
218
225
|
2.4.16
|
data/README.md
CHANGED
@@ -394,7 +394,7 @@ end
|
|
394
394
|
To render this in the view, you can do:
|
395
395
|
|
396
396
|
```erb
|
397
|
-
<%= SimpleCalendar::BusinessWeekCalendar.new(self,
|
397
|
+
<%= render SimpleCalendar::BusinessWeekCalendar.new(self, events: meetings) do |date| %>
|
398
398
|
<%= date %>
|
399
399
|
<% end %>
|
400
400
|
```
|
@@ -1,18 +1,18 @@
|
|
1
1
|
module SimpleCalendar
|
2
|
-
module
|
2
|
+
module CalendarHelper
|
3
3
|
def calendar(options = {}, &block)
|
4
4
|
raise "calendar requires a block" unless block
|
5
|
-
render SimpleCalendar::Calendar.new(self, options, &block
|
5
|
+
render SimpleCalendar::Calendar.new(self, options), &block
|
6
6
|
end
|
7
7
|
|
8
8
|
def month_calendar(options = {}, &block)
|
9
9
|
raise "month_calendar requires a block" unless block
|
10
|
-
render SimpleCalendar::MonthCalendar.new(self, options, &block
|
10
|
+
render SimpleCalendar::MonthCalendar.new(self, options), &block
|
11
11
|
end
|
12
12
|
|
13
13
|
def week_calendar(options = {}, &block)
|
14
14
|
raise "week_calendar requires a block" unless block
|
15
|
-
render SimpleCalendar::WeekCalendar.new(self, options, &block
|
15
|
+
render SimpleCalendar::WeekCalendar.new(self, options), &block
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/gemfiles/rails_6_1.gemfile
CHANGED
@@ -10,7 +10,7 @@ GIT
|
|
10
10
|
PATH
|
11
11
|
remote: ..
|
12
12
|
specs:
|
13
|
-
simple_calendar (3.0.
|
13
|
+
simple_calendar (3.0.1)
|
14
14
|
rails (>= 6.1)
|
15
15
|
|
16
16
|
GEM
|
@@ -76,6 +76,7 @@ GEM
|
|
76
76
|
tzinfo (~> 2.0)
|
77
77
|
zeitwerk (~> 2.3)
|
78
78
|
ast (2.4.2)
|
79
|
+
bindex (0.8.1)
|
79
80
|
builder (3.2.4)
|
80
81
|
concurrent-ruby (1.2.2)
|
81
82
|
crass (1.0.6)
|
@@ -204,6 +205,11 @@ GEM
|
|
204
205
|
tzinfo (2.0.6)
|
205
206
|
concurrent-ruby (~> 1.0)
|
206
207
|
unicode-display_width (2.4.2)
|
208
|
+
web-console (4.2.0)
|
209
|
+
actionview (>= 6.0.0)
|
210
|
+
activemodel (>= 6.0.0)
|
211
|
+
bindex (>= 0.4.0)
|
212
|
+
railties (>= 6.0.0)
|
207
213
|
websocket-driver (0.7.5)
|
208
214
|
websocket-extensions (>= 0.1.0)
|
209
215
|
websocket-extensions (0.1.5)
|
@@ -221,6 +227,7 @@ DEPENDENCIES
|
|
221
227
|
simple_calendar!
|
222
228
|
sqlite3
|
223
229
|
standard
|
230
|
+
web-console (~> 4.2)
|
224
231
|
|
225
232
|
BUNDLED WITH
|
226
233
|
2.4.16
|
data/gemfiles/rails_7_0.gemfile
CHANGED
@@ -10,7 +10,7 @@ GIT
|
|
10
10
|
PATH
|
11
11
|
remote: ..
|
12
12
|
specs:
|
13
|
-
simple_calendar (3.0.
|
13
|
+
simple_calendar (3.0.1)
|
14
14
|
rails (>= 6.1)
|
15
15
|
|
16
16
|
GEM
|
@@ -82,6 +82,7 @@ GEM
|
|
82
82
|
minitest (>= 5.1)
|
83
83
|
tzinfo (~> 2.0)
|
84
84
|
ast (2.4.2)
|
85
|
+
bindex (0.8.1)
|
85
86
|
builder (3.2.4)
|
86
87
|
concurrent-ruby (1.2.2)
|
87
88
|
crass (1.0.6)
|
@@ -200,6 +201,11 @@ GEM
|
|
200
201
|
tzinfo (2.0.6)
|
201
202
|
concurrent-ruby (~> 1.0)
|
202
203
|
unicode-display_width (2.4.2)
|
204
|
+
web-console (4.2.0)
|
205
|
+
actionview (>= 6.0.0)
|
206
|
+
activemodel (>= 6.0.0)
|
207
|
+
bindex (>= 0.4.0)
|
208
|
+
railties (>= 6.0.0)
|
203
209
|
websocket-driver (0.7.5)
|
204
210
|
websocket-extensions (>= 0.1.0)
|
205
211
|
websocket-extensions (0.1.5)
|
@@ -217,6 +223,7 @@ DEPENDENCIES
|
|
217
223
|
simple_calendar!
|
218
224
|
sqlite3
|
219
225
|
standard
|
226
|
+
web-console (~> 4.2)
|
220
227
|
|
221
228
|
BUNDLED WITH
|
222
229
|
2.4.16
|
data/gemfiles/rails_main.gemfile
CHANGED
@@ -106,13 +106,14 @@ GIT
|
|
106
106
|
PATH
|
107
107
|
remote: ..
|
108
108
|
specs:
|
109
|
-
simple_calendar (3.0.
|
109
|
+
simple_calendar (3.0.1)
|
110
110
|
rails (>= 6.1)
|
111
111
|
|
112
112
|
GEM
|
113
113
|
remote: http://rubygems.org/
|
114
114
|
specs:
|
115
115
|
ast (2.4.2)
|
116
|
+
bindex (0.8.1)
|
116
117
|
builder (3.2.4)
|
117
118
|
concurrent-ruby (1.2.2)
|
118
119
|
connection_pool (2.4.1)
|
@@ -223,6 +224,11 @@ GEM
|
|
223
224
|
tzinfo (2.0.6)
|
224
225
|
concurrent-ruby (~> 1.0)
|
225
226
|
unicode-display_width (2.4.2)
|
227
|
+
web-console (4.2.0)
|
228
|
+
actionview (>= 6.0.0)
|
229
|
+
activemodel (>= 6.0.0)
|
230
|
+
bindex (>= 0.4.0)
|
231
|
+
railties (>= 6.0.0)
|
226
232
|
webrick (1.8.1)
|
227
233
|
websocket-driver (0.7.5)
|
228
234
|
websocket-extensions (>= 0.1.0)
|
@@ -241,6 +247,7 @@ DEPENDENCIES
|
|
241
247
|
simple_calendar!
|
242
248
|
sqlite3
|
243
249
|
standard
|
250
|
+
web-console (~> 4.2)
|
244
251
|
|
245
252
|
BUNDLED WITH
|
246
253
|
2.4.16
|
data/lib/simple_calendar.rb
CHANGED
@@ -1,13 +1,7 @@
|
|
1
|
-
require "simple_calendar/engine"
|
2
|
-
require "simple_calendar/calendar"
|
3
|
-
require "simple_calendar/month_calendar"
|
4
|
-
require "simple_calendar/week_calendar"
|
5
|
-
require "simple_calendar/version"
|
6
|
-
require "simple_calendar/view_helpers"
|
7
|
-
|
8
1
|
module SimpleCalendar
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
2
|
+
require_relative "simple_calendar/calendar"
|
3
|
+
require_relative "simple_calendar/engine"
|
4
|
+
require_relative "simple_calendar/month_calendar"
|
5
|
+
require_relative "simple_calendar/version"
|
6
|
+
require_relative "simple_calendar/week_calendar"
|
13
7
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<div class="simple-calendar">
|
2
|
+
<div class="calendar-heading">
|
3
|
+
<span class="calendar-title"><%= t('date.month_names')[start_date.month] %> <%= start_date.year %></span>
|
4
|
+
|
5
|
+
<nav>
|
6
|
+
<%= link_to t('simple_calendar.previous', default: 'Previous'), calendar.url_for_previous_view %>
|
7
|
+
<%= link_to t('simple_calendar.today', default: 'Today'), calendar.url_for_today_view %>
|
8
|
+
<%= link_to t('simple_calendar.next', default: 'Next'), calendar.url_for_next_view %>
|
9
|
+
</nav>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<table class="table table-striped">
|
13
|
+
<thead>
|
14
|
+
<tr>
|
15
|
+
<% date_range.slice(0, 7).each do |day| %>
|
16
|
+
<th><%= t('date.abbr_day_names')[day.wday] %></th>
|
17
|
+
<% end %>
|
18
|
+
</tr>
|
19
|
+
</thead>
|
20
|
+
|
21
|
+
<tbody>
|
22
|
+
<% date_range.each_slice(7) do |week| %>
|
23
|
+
<%= content_tag :tr, class: calendar.tr_classes_for(week) do %>
|
24
|
+
<% week.each do |day| %>
|
25
|
+
<%= content_tag :td, class: calendar.td_classes_for(day) do %>
|
26
|
+
<% instance_exec(day, calendar.sorted_events_for(day), &passed_block) %>
|
27
|
+
<% end %>
|
28
|
+
<% end %>
|
29
|
+
<% end %>
|
30
|
+
<% end %>
|
31
|
+
</tbody>
|
32
|
+
</table>
|
33
|
+
</div>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<p style="color: green"><%= notice %></p>
|
2
|
+
|
3
|
+
<h1>Meetings</h1>
|
4
|
+
<%= render BusinessWeekCalendar.new(self, events: @meetings) do |date, meetings| %>
|
5
|
+
<%= date %>
|
6
|
+
|
7
|
+
<% meetings.each do |meeting| %>
|
8
|
+
<div>
|
9
|
+
<%= meeting.name %>
|
10
|
+
</div>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div id="meetings">
|
15
|
+
<% @meetings.each do |meeting| %>
|
16
|
+
<%= render meeting %>
|
17
|
+
<p>
|
18
|
+
<%= link_to "Show this meeting", meeting %>
|
19
|
+
</p>
|
20
|
+
<% end %>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<%= link_to "New meeting", new_meeting_path %>
|
24
|
+
<%= Time.current.beginning_of_month %>
|
data/test/dummy/config/routes.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
-
resources :meetings
|
2
|
+
resources :meetings do
|
3
|
+
collection do
|
4
|
+
get :business_week
|
5
|
+
end
|
6
|
+
end
|
3
7
|
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
4
8
|
|
5
9
|
# Defines the root path route ("/")
|
data/test/dummy/db/schema.rb
CHANGED
@@ -10,11 +10,11 @@
|
|
10
10
|
#
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
12
12
|
|
13
|
-
ActiveRecord::Schema.define(version: 2022_09_30_184313) do
|
13
|
+
ActiveRecord::Schema[7.0].define(version: 2022_09_30_184313) do
|
14
14
|
create_table "meetings", force: :cascade do |t|
|
15
15
|
t.string "name"
|
16
|
-
t.datetime "start_time"
|
17
|
-
t.datetime "end_time"
|
16
|
+
t.datetime "start_time", precision: nil
|
17
|
+
t.datetime "end_time", precision: nil
|
18
18
|
t.datetime "created_at", null: false
|
19
19
|
t.datetime "updated_at", null: false
|
20
20
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class CustomCalendarIntegrationTest < ActionDispatch::IntegrationTest
|
4
|
+
test "renders a custom calendar" do
|
5
|
+
get business_week_meetings_path
|
6
|
+
assert_select "div.simple-calendar"
|
7
|
+
end
|
8
|
+
|
9
|
+
test "calendar renders events" do
|
10
|
+
get business_week_meetings_path
|
11
|
+
assert_select "div.simple-calendar" do
|
12
|
+
assert_select "div", text: meetings(:one_day_event).name
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
test "calendar render two day events" do
|
17
|
+
event = meetings(:two_day_event)
|
18
|
+
get business_week_meetings_path, params: {start_date: event.start_time.to_date}
|
19
|
+
assert_select "div.simple-calendar" do
|
20
|
+
assert_select "div", text: event.name, count: 2
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
test "calendar render three day events" do
|
25
|
+
event = meetings(:three_day_event)
|
26
|
+
get business_week_meetings_path, params: {start_date: event.start_time.to_date}
|
27
|
+
assert_select "div.simple-calendar" do
|
28
|
+
assert_select "div", text: event.name, count: 3
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_calendar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Oliver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -43,6 +43,7 @@ files:
|
|
43
43
|
- README.md
|
44
44
|
- Rakefile
|
45
45
|
- app/assets/stylesheets/simple_calendar.scss
|
46
|
+
- app/helpers/simple_calendar/calendar_helper.rb
|
46
47
|
- app/views/simple_calendar/_calendar.html.erb
|
47
48
|
- app/views/simple_calendar/_month_calendar.html.erb
|
48
49
|
- app/views/simple_calendar/_week_calendar.html.erb
|
@@ -61,7 +62,6 @@ files:
|
|
61
62
|
- lib/simple_calendar/engine.rb
|
62
63
|
- lib/simple_calendar/month_calendar.rb
|
63
64
|
- lib/simple_calendar/version.rb
|
64
|
-
- lib/simple_calendar/view_helpers.rb
|
65
65
|
- lib/simple_calendar/week_calendar.rb
|
66
66
|
- simple_calendar.gemspec
|
67
67
|
- test/calendars/calendar_test.rb
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- test/dummy/app/assets/config/manifest.js
|
71
71
|
- test/dummy/app/assets/images/.keep
|
72
72
|
- test/dummy/app/assets/stylesheets/application.css
|
73
|
+
- test/dummy/app/calendars/business_week_calendar.rb
|
73
74
|
- test/dummy/app/channels/application_cable/channel.rb
|
74
75
|
- test/dummy/app/channels/application_cable/connection.rb
|
75
76
|
- test/dummy/app/controllers/application_controller.rb
|
@@ -85,8 +86,10 @@ files:
|
|
85
86
|
- test/dummy/app/views/layouts/application.html.erb
|
86
87
|
- test/dummy/app/views/layouts/mailer.html.erb
|
87
88
|
- test/dummy/app/views/layouts/mailer.text.erb
|
89
|
+
- test/dummy/app/views/meetings/_business_week_calendar.html.erb
|
88
90
|
- test/dummy/app/views/meetings/_form.html.erb
|
89
91
|
- test/dummy/app/views/meetings/_meeting.html.erb
|
92
|
+
- test/dummy/app/views/meetings/business_week.html.erb
|
90
93
|
- test/dummy/app/views/meetings/edit.html.erb
|
91
94
|
- test/dummy/app/views/meetings/index.html.erb
|
92
95
|
- test/dummy/app/views/meetings/new.html.erb
|
@@ -122,13 +125,8 @@ files:
|
|
122
125
|
- test/dummy/public/apple-touch-icon.png
|
123
126
|
- test/dummy/public/favicon.ico
|
124
127
|
- test/dummy/storage/.keep
|
125
|
-
- test/dummy/tmp/.keep
|
126
|
-
- test/dummy/tmp/development_secret.txt
|
127
|
-
- test/dummy/tmp/pids/.keep
|
128
|
-
- test/dummy/tmp/pids/server.pid
|
129
|
-
- test/dummy/tmp/restart.txt
|
130
|
-
- test/dummy/tmp/storage/.keep
|
131
128
|
- test/fixtures/meetings.yml
|
129
|
+
- test/integrations/custom_calendar_test.rb
|
132
130
|
- test/integrations/month_calendar_test.rb
|
133
131
|
- test/simple_calendar_test.rb
|
134
132
|
- test/test_helper.rb
|
@@ -151,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
149
|
- !ruby/object:Gem::Version
|
152
150
|
version: '0'
|
153
151
|
requirements: []
|
154
|
-
rubygems_version: 3.4.
|
152
|
+
rubygems_version: 3.4.17
|
155
153
|
signing_key:
|
156
154
|
specification_version: 4
|
157
155
|
summary: A simple Rails calendar
|
data/test/dummy/tmp/.keep
DELETED
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
385417154446f2326be01378c4937623ff31b03c81fa45edeb89225c92e037918243b1ed9d16713314411fb6ed3cf2962bfaafcc1996a54322180368477bca66
|
data/test/dummy/tmp/pids/.keep
DELETED
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
10208
|
data/test/dummy/tmp/restart.txt
DELETED
File without changes
|
File without changes
|