simple_calendar 2.4.3 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +5 -4
  3. data/.gitignore +4 -0
  4. data/Appraisals +5 -5
  5. data/CHANGELOG.md +11 -0
  6. data/Gemfile +6 -1
  7. data/Gemfile.lock +164 -136
  8. data/README.md +23 -16
  9. data/Rakefile +29 -5
  10. data/app/assets/stylesheets/simple_calendar.scss +4 -0
  11. data/{lib/simple_calendar/view_helpers.rb → app/helpers/simple_calendar/calendar_helper.rb} +4 -4
  12. data/app/views/simple_calendar/_calendar.html.erb +7 -7
  13. data/app/views/simple_calendar/_month_calendar.html.erb +8 -8
  14. data/app/views/simple_calendar/_week_calendar.html.erb +14 -12
  15. data/bin/rails +16 -0
  16. data/gemfiles/rails_6_1.gemfile +4 -1
  17. data/gemfiles/rails_6_1.gemfile.lock +166 -131
  18. data/gemfiles/rails_7_0.gemfile +12 -0
  19. data/gemfiles/rails_7_0.gemfile.lock +229 -0
  20. data/gemfiles/{rails_master.gemfile → rails_main.gemfile} +4 -1
  21. data/gemfiles/rails_main.gemfile.lock +253 -0
  22. data/lib/simple_calendar/calendar.rb +27 -14
  23. data/lib/simple_calendar/engine.rb +4 -0
  24. data/lib/simple_calendar/month_calendar.rb +4 -0
  25. data/lib/simple_calendar/version.rb +1 -1
  26. data/lib/simple_calendar/week_calendar.rb +5 -1
  27. data/lib/simple_calendar.rb +7 -6
  28. data/simple_calendar.gemspec +1 -3
  29. data/test/calendars/calendar_test.rb +154 -0
  30. data/test/calendars/month_calendar_test.rb +16 -0
  31. data/test/dummy/Rakefile +6 -0
  32. data/test/dummy/app/assets/config/manifest.js +1 -0
  33. data/test/dummy/app/assets/images/.keep +0 -0
  34. data/test/dummy/app/assets/stylesheets/application.css +1 -0
  35. data/test/dummy/app/calendars/business_week_calendar.rb +9 -0
  36. data/test/dummy/app/channels/application_cable/channel.rb +4 -0
  37. data/test/dummy/app/channels/application_cable/connection.rb +4 -0
  38. data/test/dummy/app/controllers/application_controller.rb +2 -0
  39. data/test/dummy/app/controllers/concerns/.keep +0 -0
  40. data/test/dummy/app/controllers/meetings_controller.rb +63 -0
  41. data/test/dummy/app/helpers/application_helper.rb +2 -0
  42. data/test/dummy/app/helpers/meetings_helper.rb +2 -0
  43. data/test/dummy/app/jobs/application_job.rb +7 -0
  44. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  45. data/test/dummy/app/models/application_record.rb +7 -0
  46. data/test/dummy/app/models/concerns/.keep +0 -0
  47. data/test/dummy/app/models/meeting.rb +2 -0
  48. data/test/dummy/app/views/layouts/application.html.erb +15 -0
  49. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  50. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  51. data/test/dummy/app/views/meetings/_business_week_calendar.html.erb +33 -0
  52. data/test/dummy/app/views/meetings/_form.html.erb +32 -0
  53. data/test/dummy/app/views/meetings/_meeting.html.erb +17 -0
  54. data/test/dummy/app/views/meetings/business_week.html.erb +24 -0
  55. data/test/dummy/app/views/meetings/edit.html.erb +10 -0
  56. data/test/dummy/app/views/meetings/index.html.erb +24 -0
  57. data/test/dummy/app/views/meetings/new.html.erb +9 -0
  58. data/test/dummy/app/views/meetings/show.html.erb +10 -0
  59. data/test/dummy/bin/rails +4 -0
  60. data/test/dummy/bin/rake +4 -0
  61. data/test/dummy/bin/setup +33 -0
  62. data/test/dummy/config/application.rb +22 -0
  63. data/test/dummy/config/boot.rb +5 -0
  64. data/test/dummy/config/cable.yml +10 -0
  65. data/test/dummy/config/database.yml +25 -0
  66. data/test/dummy/config/environment.rb +5 -0
  67. data/test/dummy/config/environments/development.rb +67 -0
  68. data/test/dummy/config/environments/production.rb +87 -0
  69. data/test/dummy/config/environments/test.rb +60 -0
  70. data/test/dummy/config/initializers/content_security_policy.rb +25 -0
  71. data/test/dummy/config/initializers/filter_parameter_logging.rb +8 -0
  72. data/test/dummy/config/initializers/inflections.rb +16 -0
  73. data/test/dummy/config/initializers/permissions_policy.rb +11 -0
  74. data/test/dummy/config/locales/en.yml +33 -0
  75. data/test/dummy/config/puma.rb +43 -0
  76. data/test/dummy/config/routes.rb +11 -0
  77. data/test/dummy/config/storage.yml +34 -0
  78. data/test/dummy/config.ru +6 -0
  79. data/test/dummy/db/migrate/20220930184313_create_meetings.rb +11 -0
  80. data/test/dummy/db/schema.rb +21 -0
  81. data/test/dummy/lib/assets/.keep +0 -0
  82. data/test/dummy/log/.keep +0 -0
  83. data/test/dummy/public/404.html +67 -0
  84. data/test/dummy/public/422.html +67 -0
  85. data/test/dummy/public/500.html +66 -0
  86. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  87. data/test/dummy/public/apple-touch-icon.png +0 -0
  88. data/test/dummy/public/favicon.ico +0 -0
  89. data/test/dummy/storage/.keep +0 -0
  90. data/test/fixtures/meetings.yml +36 -0
  91. data/test/integrations/custom_calendar_test.rb +31 -0
  92. data/test/integrations/month_calendar_test.rb +58 -0
  93. data/test/simple_calendar_test.rb +7 -0
  94. data/test/test_helper.rb +14 -0
  95. metadata +79 -40
  96. data/gemfiles/rails_6.gemfile +0 -9
  97. data/gemfiles/rails_6.gemfile.lock +0 -195
  98. data/gemfiles/rails_master.gemfile.lock +0 -207
  99. data/lib/simple_calendar/railtie.rb +0 -9
  100. data/spec/calendar_spec.rb +0 -176
  101. data/spec/calendars/month_calendar_spec.rb +0 -25
  102. data/spec/simple_calendar_spec.rb +0 -9
  103. data/spec/spec_helper.rb +0 -96
  104. data/spec/support/fake_event.rb +0 -9
  105. data/spec/support/view_context.rb +0 -20
  106. data/spec/views_generators_spec.rb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e36ddb5bf4d84867961f50a904b50fbf62ce6f3b296504e2d1f9307c60371938
4
- data.tar.gz: f8c1c02a8f5f009950049035d26741104e2cd99d5edfee97f0270eb730670520
3
+ metadata.gz: 37a9649373c34dabc95e3549b89903edea28a8b86e3c5e84defd640354390961
4
+ data.tar.gz: 561d150c797c2c350fa00501f8936556412efe0158449aa909fd22b824fbf5e0
5
5
  SHA512:
6
- metadata.gz: 9b4bf518dae5f8cb63e83746e34eda30bbe460c2d7a9f5743e9fd7fd1ac822e8d1b7af43466ed7d29a1d41e57327c8a95c5b05b39af50ebfb5d40d8726373237
7
- data.tar.gz: dafcf5f2db9dd69202084a6233a2a3a0354f36565ba27f7551d38185ad8d50053dc6f5f4d12ee14fcda1e510ea9a68d202d40d073c4c2cd4f330c714a2477aa9
6
+ metadata.gz: 22c618117445c21407bfabd37889f83c5676143704a388670bf3f8b00ddd66d4d41fd2ccc5c4bdf9ecd2cde4b5b232407cac2d4265f2228640b51b4a65503e37
7
+ data.tar.gz: c284fe582e697f44e001c22dd0380a74c7ef60827a835f7768c058c56585534c339c4b11541ca938ad44da5a6aedad5ccd60fd5fe3e795a0dc921534dbebf105
@@ -12,17 +12,17 @@ jobs:
12
12
  runs-on: ubuntu-latest
13
13
  strategy:
14
14
  matrix:
15
- ruby: [ '2.6', '2.7', '3.0']
15
+ ruby: ['2.7', '3.0', '3.1', '3.2']
16
16
  gemfile:
17
- - rails_6
18
17
  - rails_6_1
19
- - rails_master
18
+ - rails_7_0
19
+ - rails_main
20
20
  env:
21
21
  BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
22
22
  BUNDLE_PATH_RELATIVE_TO_CWD: true
23
23
 
24
24
  steps:
25
- - uses: actions/checkout@master
25
+ - uses: actions/checkout@v3
26
26
 
27
27
  - name: Set up Ruby
28
28
  uses: ruby/setup-ruby@v1
@@ -30,6 +30,7 @@ jobs:
30
30
  ruby-version: ${{ matrix.ruby }}
31
31
  bundler: default
32
32
  bundler-cache: true
33
+ rubygems: latest
33
34
 
34
35
  - name: StandardRb check
35
36
  run: bundle exec standardrb
data/.gitignore CHANGED
@@ -4,3 +4,7 @@ Gemfile.lock
4
4
  pkg/*
5
5
  .ruby-version
6
6
  .ruby-gemset
7
+ test/dummy/db/test.sqlite3
8
+ test/dummy/db/development.sqlite3
9
+ test/dummy/log
10
+ test/dummy/tmp
data/Appraisals CHANGED
@@ -1,11 +1,11 @@
1
- appraise "rails-6" do
2
- gem "rails", "~> 6.0.0"
3
- end
4
-
5
1
  appraise "rails-6-1" do
6
2
  gem "rails", "~> 6.1.0"
7
3
  end
8
4
 
9
- appraise "rails-master" do
5
+ appraise "rails-7-0" do
6
+ gem "rails", "~> 7.0.0"
7
+ end
8
+
9
+ appraise "rails-main" do
10
10
  gem "rails", github: "rails/rails"
11
11
  end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ### 3.0.1
2
+
3
+ * Refactor to use block from `render_in` call to better support custom calendars
4
+
5
+ ### 3.0.0
6
+
7
+ * Drop support for Rails 6.0 and earlier
8
+ * Add Today link to calendars to reset to current date
9
+ * Add `locals: {}` option when rendering calendars to add extra local variables
10
+ * Refactor to use `render_in`
11
+
1
12
  ### 2.4.3
2
13
 
3
14
  * Fix deprecation warnings - @mbobin
data/Gemfile CHANGED
@@ -2,5 +2,10 @@ source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem "appraisal"
5
+ gem "appraisal", github: "thoughtbot/appraisal"
6
6
  gem "standard"
7
+
8
+ gem "puma"
9
+ gem "sqlite3"
10
+
11
+ gem "web-console", "~> 4.2", group: :development
data/Gemfile.lock CHANGED
@@ -1,197 +1,225 @@
1
+ GIT
2
+ remote: https://github.com/thoughtbot/appraisal.git
3
+ revision: b200e636903700098bef25f4f51dbc4c46e4c04c
4
+ specs:
5
+ appraisal (2.4.1)
6
+ bundler
7
+ rake
8
+ thor (>= 0.14.0)
9
+
1
10
  PATH
2
11
  remote: .
3
12
  specs:
4
- simple_calendar (2.4.3)
5
- rails (>= 3.0)
13
+ simple_calendar (3.0.1)
14
+ rails (>= 6.1)
6
15
 
7
16
  GEM
8
17
  remote: http://rubygems.org/
9
18
  specs:
10
- actioncable (6.1.4)
11
- actionpack (= 6.1.4)
12
- activesupport (= 6.1.4)
19
+ actioncable (7.0.6)
20
+ actionpack (= 7.0.6)
21
+ activesupport (= 7.0.6)
13
22
  nio4r (~> 2.0)
14
23
  websocket-driver (>= 0.6.1)
15
- actionmailbox (6.1.4)
16
- actionpack (= 6.1.4)
17
- activejob (= 6.1.4)
18
- activerecord (= 6.1.4)
19
- activestorage (= 6.1.4)
20
- activesupport (= 6.1.4)
24
+ actionmailbox (7.0.6)
25
+ actionpack (= 7.0.6)
26
+ activejob (= 7.0.6)
27
+ activerecord (= 7.0.6)
28
+ activestorage (= 7.0.6)
29
+ activesupport (= 7.0.6)
21
30
  mail (>= 2.7.1)
22
- actionmailer (6.1.4)
23
- actionpack (= 6.1.4)
24
- actionview (= 6.1.4)
25
- activejob (= 6.1.4)
26
- activesupport (= 6.1.4)
31
+ net-imap
32
+ net-pop
33
+ net-smtp
34
+ actionmailer (7.0.6)
35
+ actionpack (= 7.0.6)
36
+ actionview (= 7.0.6)
37
+ activejob (= 7.0.6)
38
+ activesupport (= 7.0.6)
27
39
  mail (~> 2.5, >= 2.5.4)
40
+ net-imap
41
+ net-pop
42
+ net-smtp
28
43
  rails-dom-testing (~> 2.0)
29
- actionpack (6.1.4)
30
- actionview (= 6.1.4)
31
- activesupport (= 6.1.4)
32
- rack (~> 2.0, >= 2.0.9)
44
+ actionpack (7.0.6)
45
+ actionview (= 7.0.6)
46
+ activesupport (= 7.0.6)
47
+ rack (~> 2.0, >= 2.2.4)
33
48
  rack-test (>= 0.6.3)
34
49
  rails-dom-testing (~> 2.0)
35
50
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
- actiontext (6.1.4)
37
- actionpack (= 6.1.4)
38
- activerecord (= 6.1.4)
39
- activestorage (= 6.1.4)
40
- activesupport (= 6.1.4)
51
+ actiontext (7.0.6)
52
+ actionpack (= 7.0.6)
53
+ activerecord (= 7.0.6)
54
+ activestorage (= 7.0.6)
55
+ activesupport (= 7.0.6)
56
+ globalid (>= 0.6.0)
41
57
  nokogiri (>= 1.8.5)
42
- actionview (6.1.4)
43
- activesupport (= 6.1.4)
58
+ actionview (7.0.6)
59
+ activesupport (= 7.0.6)
44
60
  builder (~> 3.1)
45
61
  erubi (~> 1.4)
46
62
  rails-dom-testing (~> 2.0)
47
63
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
- activejob (6.1.4)
49
- activesupport (= 6.1.4)
64
+ activejob (7.0.6)
65
+ activesupport (= 7.0.6)
50
66
  globalid (>= 0.3.6)
51
- activemodel (6.1.4)
52
- activesupport (= 6.1.4)
53
- activerecord (6.1.4)
54
- activemodel (= 6.1.4)
55
- activesupport (= 6.1.4)
56
- activestorage (6.1.4)
57
- actionpack (= 6.1.4)
58
- activejob (= 6.1.4)
59
- activerecord (= 6.1.4)
60
- activesupport (= 6.1.4)
61
- marcel (~> 1.0.0)
67
+ activemodel (7.0.6)
68
+ activesupport (= 7.0.6)
69
+ activerecord (7.0.6)
70
+ activemodel (= 7.0.6)
71
+ activesupport (= 7.0.6)
72
+ activestorage (7.0.6)
73
+ actionpack (= 7.0.6)
74
+ activejob (= 7.0.6)
75
+ activerecord (= 7.0.6)
76
+ activesupport (= 7.0.6)
77
+ marcel (~> 1.0)
62
78
  mini_mime (>= 1.1.0)
63
- activesupport (6.1.4)
79
+ activesupport (7.0.6)
64
80
  concurrent-ruby (~> 1.0, >= 1.0.2)
65
81
  i18n (>= 1.6, < 2)
66
82
  minitest (>= 5.1)
67
83
  tzinfo (~> 2.0)
68
- zeitwerk (~> 2.3)
69
- appraisal (2.4.0)
70
- bundler
71
- rake
72
- thor (>= 0.14.0)
73
84
  ast (2.4.2)
85
+ bindex (0.8.1)
74
86
  builder (3.2.4)
75
- concurrent-ruby (1.1.9)
87
+ concurrent-ruby (1.2.2)
76
88
  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.10)
89
+ date (3.3.3)
90
+ erubi (1.12.0)
91
+ globalid (1.1.0)
92
+ activesupport (>= 5.0)
93
+ i18n (1.14.1)
82
94
  concurrent-ruby (~> 1.0)
83
- loofah (2.10.0)
95
+ json (2.6.3)
96
+ language_server-protocol (3.17.0.3)
97
+ lint_roller (1.1.0)
98
+ loofah (2.21.3)
84
99
  crass (~> 1.0.2)
85
- nokogiri (>= 1.5.9)
86
- mail (2.7.1)
100
+ nokogiri (>= 1.12.0)
101
+ mail (2.8.1)
87
102
  mini_mime (>= 0.1.1)
88
- marcel (1.0.1)
103
+ net-imap
104
+ net-pop
105
+ net-smtp
106
+ marcel (1.0.2)
89
107
  method_source (1.0.0)
90
- mini_mime (1.1.0)
91
- mini_portile2 (2.5.3)
92
- minitest (5.14.4)
93
- nio4r (2.5.7)
94
- nokogiri (1.11.7)
95
- mini_portile2 (~> 2.5.0)
96
- racc (~> 1.4)
97
- nokogiri (1.11.7-x86_64-darwin)
108
+ mini_mime (1.1.2)
109
+ minitest (5.18.1)
110
+ net-imap (0.3.6)
111
+ date
112
+ net-protocol
113
+ net-pop (0.1.2)
114
+ net-protocol
115
+ net-protocol (0.2.1)
116
+ timeout
117
+ net-smtp (0.3.3)
118
+ net-protocol
119
+ nio4r (2.5.9)
120
+ nokogiri (1.15.3-x86_64-darwin)
98
121
  racc (~> 1.4)
99
- nokogiri (1.11.7-x86_64-linux)
122
+ nokogiri (1.15.3-x86_64-linux)
100
123
  racc (~> 1.4)
101
- parallel (1.20.1)
102
- parser (3.0.1.1)
124
+ parallel (1.23.0)
125
+ parser (3.2.2.3)
103
126
  ast (~> 2.4.1)
104
- racc (1.5.2)
105
- rack (2.2.3)
106
- rack-test (1.1.0)
107
- rack (>= 1.0, < 3)
108
- rails (6.1.4)
109
- actioncable (= 6.1.4)
110
- actionmailbox (= 6.1.4)
111
- actionmailer (= 6.1.4)
112
- actionpack (= 6.1.4)
113
- actiontext (= 6.1.4)
114
- actionview (= 6.1.4)
115
- activejob (= 6.1.4)
116
- activemodel (= 6.1.4)
117
- activerecord (= 6.1.4)
118
- activestorage (= 6.1.4)
119
- activesupport (= 6.1.4)
127
+ racc
128
+ puma (6.3.0)
129
+ nio4r (~> 2.0)
130
+ racc (1.7.1)
131
+ rack (2.2.7)
132
+ rack-test (2.1.0)
133
+ rack (>= 1.3)
134
+ rails (7.0.6)
135
+ actioncable (= 7.0.6)
136
+ actionmailbox (= 7.0.6)
137
+ actionmailer (= 7.0.6)
138
+ actionpack (= 7.0.6)
139
+ actiontext (= 7.0.6)
140
+ actionview (= 7.0.6)
141
+ activejob (= 7.0.6)
142
+ activemodel (= 7.0.6)
143
+ activerecord (= 7.0.6)
144
+ activestorage (= 7.0.6)
145
+ activesupport (= 7.0.6)
120
146
  bundler (>= 1.15.0)
121
- railties (= 6.1.4)
122
- sprockets-rails (>= 2.0.0)
123
- rails-dom-testing (2.0.3)
124
- activesupport (>= 4.2.0)
147
+ railties (= 7.0.6)
148
+ rails-dom-testing (2.1.1)
149
+ activesupport (>= 5.0.0)
150
+ minitest
125
151
  nokogiri (>= 1.6)
126
- rails-html-sanitizer (1.3.0)
127
- loofah (~> 2.3)
128
- railties (6.1.4)
129
- actionpack (= 6.1.4)
130
- activesupport (= 6.1.4)
152
+ rails-html-sanitizer (1.6.0)
153
+ loofah (~> 2.21)
154
+ nokogiri (~> 1.14)
155
+ railties (7.0.6)
156
+ actionpack (= 7.0.6)
157
+ activesupport (= 7.0.6)
131
158
  method_source
132
- rake (>= 0.13)
159
+ rake (>= 12.2)
133
160
  thor (~> 1.0)
134
- rainbow (3.0.0)
135
- rake (13.0.3)
136
- regexp_parser (2.1.1)
161
+ zeitwerk (~> 2.5)
162
+ rainbow (3.1.1)
163
+ rake (13.0.6)
164
+ regexp_parser (2.8.1)
137
165
  rexml (3.2.5)
138
- rspec (3.10.0)
139
- rspec-core (~> 3.10.0)
140
- rspec-expectations (~> 3.10.0)
141
- rspec-mocks (~> 3.10.0)
142
- rspec-core (3.10.1)
143
- rspec-support (~> 3.10.0)
144
- rspec-expectations (3.10.1)
145
- diff-lcs (>= 1.2.0, < 2.0)
146
- rspec-support (~> 3.10.0)
147
- rspec-mocks (3.10.2)
148
- diff-lcs (>= 1.2.0, < 2.0)
149
- rspec-support (~> 3.10.0)
150
- rspec-support (3.10.2)
151
- rubocop (1.14.0)
166
+ rubocop (1.52.1)
167
+ json (~> 2.3)
152
168
  parallel (~> 1.10)
153
- parser (>= 3.0.0.0)
169
+ parser (>= 3.2.2.3)
154
170
  rainbow (>= 2.2.2, < 4.0)
155
171
  regexp_parser (>= 1.8, < 3.0)
156
- rexml
157
- rubocop-ast (>= 1.5.0, < 2.0)
172
+ rexml (>= 3.2.5, < 4.0)
173
+ rubocop-ast (>= 1.28.0, < 2.0)
158
174
  ruby-progressbar (~> 1.7)
159
- unicode-display_width (>= 1.4.0, < 3.0)
160
- rubocop-ast (1.5.0)
161
- parser (>= 3.0.1.1)
162
- rubocop-performance (1.11.2)
175
+ unicode-display_width (>= 2.4.0, < 3.0)
176
+ rubocop-ast (1.29.0)
177
+ parser (>= 3.2.1.0)
178
+ rubocop-performance (1.18.0)
163
179
  rubocop (>= 1.7.0, < 2.0)
164
180
  rubocop-ast (>= 0.4.0)
165
- ruby-progressbar (1.11.0)
166
- sprockets (4.0.2)
167
- concurrent-ruby (~> 1.0)
168
- rack (> 1, < 3)
169
- sprockets-rails (3.2.2)
170
- actionpack (>= 4.0)
171
- activesupport (>= 4.0)
172
- sprockets (>= 3.0.0)
173
- standard (1.1.1)
174
- rubocop (= 1.14.0)
175
- rubocop-performance (= 1.11.2)
176
- thor (1.1.0)
177
- tzinfo (2.0.4)
181
+ ruby-progressbar (1.13.0)
182
+ sqlite3 (1.6.3-x86_64-darwin)
183
+ sqlite3 (1.6.3-x86_64-linux)
184
+ standard (1.30.1)
185
+ language_server-protocol (~> 3.17.0.2)
186
+ lint_roller (~> 1.0)
187
+ rubocop (~> 1.52.0)
188
+ standard-custom (~> 1.0.0)
189
+ standard-performance (~> 1.1.0)
190
+ standard-custom (1.0.2)
191
+ lint_roller (~> 1.0)
192
+ rubocop (~> 1.50)
193
+ standard-performance (1.1.1)
194
+ lint_roller (~> 1.1)
195
+ rubocop-performance (~> 1.18.0)
196
+ thor (1.2.2)
197
+ timeout (0.4.0)
198
+ tzinfo (2.0.6)
178
199
  concurrent-ruby (~> 1.0)
179
- unicode-display_width (2.0.0)
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)
180
206
  websocket-driver (0.7.5)
181
207
  websocket-extensions (>= 0.1.0)
182
208
  websocket-extensions (0.1.5)
183
- zeitwerk (2.4.2)
209
+ zeitwerk (2.6.8)
184
210
 
185
211
  PLATFORMS
186
- ruby
187
212
  x86_64-darwin-20
213
+ x86_64-darwin-22
188
214
  x86_64-linux
189
215
 
190
216
  DEPENDENCIES
191
- appraisal
192
- rspec
217
+ appraisal!
218
+ puma
193
219
  simple_calendar!
220
+ sqlite3
194
221
  standard
222
+ web-console (~> 4.2)
195
223
 
196
224
  BUNDLED WITH
197
- 2.2.20
225
+ 2.4.16
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  [![Build Status](https://github.com/excid3/simple_calendar/workflows/Tests/badge.svg)](https://github.com/excid3/simple_calendar/actions) [![Gem Version](https://badge.fury.io/rb/simple_calendar.svg)](https://badge.fury.io/rb/simple_calendar)
6
6
 
7
- Simple Calendar is designed to do one thing really really well: render a calendar.
7
+ Simple Calendar is designed to do one thing really really well: render a calendar.
8
8
 
9
9
  It lets you render a calendar of any size. Maybe you want a
10
10
  day view, a 4 day agenda, a week view, a month view, or a 6 week
@@ -120,7 +120,7 @@ In a Rails 6 app, the configuration could look like the following:
120
120
 
121
121
  * Add `gem 'rails-i18n'` to your `Gemfile` and run `bundle`.
122
122
  * Define the available and default locale e.g. in `config/application.rb`:
123
- ```ruby
123
+ ```ruby
124
124
  # config/application.rb
125
125
  config.i18n.available_locales = [:en, :de, :fr]
126
126
  config.i18n.default_locale = :en
@@ -134,7 +134,7 @@ de:
134
134
  next: ">>"
135
135
  week: Woche
136
136
  ```
137
-
137
+
138
138
  See the [Rails I18n Guide](https://guides.rubyonrails.org/i18n.html) for further information.
139
139
 
140
140
  ## Rendering Events
@@ -341,12 +341,29 @@ the top! :)
341
341
  ### AJAX Calendars
342
342
 
343
343
  Rendering calendars that update with AJAX is pretty simple. You'll need
344
- to wrap your calendar in a div, overwrite the `next_link` and `previous_link` options, and setup your
345
- controller to respond to JS requests. The response can simply replace
344
+ to follow these steps.
345
+
346
+ - Run `rails g simple_calendar:views` to generate the views.
347
+ - Add an ID to the calendar view's outer div. `<div id="calendar" class="simple-calendar">`
348
+ - Add `remote: true` option to the next & preview links like [this](https://github.com/excid3/simple_calendar-ajax-example/blob/ac8a1dc933d5933608421f8b53a5f5cf756b942f/app/views/simple_calendar/_month_calendar.html.erb#L3).
349
+ - Create `js.erb` file to respond to JS requests, render the new calendar, and replace the calendar on the page by ID like [this](https://github.com/excid3/simple_calendar-ajax-example/blob/master/app/views/events/index.js.erb).
350
+
351
+ The response can simply replace
346
352
  the HTML of the div with the newly rendered calendar.
347
353
 
348
354
  Take a look at **[excid3/simple_calendar-ajax-example](https://github.com/excid3/simple_calendar-ajax-example)** to see how it is done.
349
355
 
356
+ If you are using [Hotwire](https://hotwired.dev/), just wrap in a Turbo Frame.
357
+ Like this:
358
+
359
+ ```erb
360
+ <%= turbo_frame_tag 'calendar' do %>
361
+ <%= month_calendar do |date| %>
362
+ <%= date.day %>
363
+ <% end %>
364
+ <% end %>
365
+ ```
366
+
350
367
 
351
368
  ## Custom Calendars
352
369
 
@@ -377,7 +394,7 @@ end
377
394
  To render this in the view, you can do:
378
395
 
379
396
  ```erb
380
- <%= SimpleCalendar::BusinessWeekCalendar.new(self, {}).render do |date| %>
397
+ <%= render SimpleCalendar::BusinessWeekCalendar.new(self, events: meetings) do |date| %>
381
398
  <%= date %>
382
399
  <% end %>
383
400
  ```
@@ -406,12 +423,6 @@ expect_any_instance_of(SimpleCalendar::Calendar).to receive(:link_to).at_least(:
406
423
 
407
424
  With modifications as appropriate.
408
425
 
409
- ## TODO
410
-
411
- - Rspec tests for Calendar
412
- - Rspec tests for MonthCalendar
413
- - Rspec tests for WeekCalendar
414
-
415
426
  ## Author
416
427
 
417
428
  Chris Oliver <chris@gorails.com>
@@ -423,7 +434,3 @@ Chris Oliver <chris@gorails.com>
423
434
  ## License
424
435
 
425
436
  Simple Calendar is licensed under the [MIT License](LICENSE.txt).
426
-
427
- ## Support
428
-
429
- Need help
data/Rakefile CHANGED
@@ -1,8 +1,32 @@
1
- require "bundler/gem_tasks"
2
-
3
1
  begin
4
- require "rspec/core/rake_task"
5
- RSpec::Core::RakeTask.new(:spec)
6
- task default: :spec
2
+ require "bundler/setup"
7
3
  rescue LoadError
4
+ puts "You must `gem install bundler` and `bundle install` to run rake tasks"
5
+ end
6
+
7
+ require "bundler/gem_tasks"
8
+
9
+ require "rdoc/task"
10
+
11
+ RDoc::Task.new(:rdoc) do |rdoc|
12
+ rdoc.rdoc_dir = "rdoc"
13
+ rdoc.title = "SimpleCalendar"
14
+ rdoc.options << "--line-numbers"
15
+ rdoc.rdoc_files.include("README.md")
16
+ rdoc.rdoc_files.include("lib/**/*.rb")
8
17
  end
18
+
19
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
20
+ load "rails/tasks/engine.rake"
21
+
22
+ load "rails/tasks/statistics.rake"
23
+
24
+ require "rake/testtask"
25
+
26
+ Rake::TestTask.new(:test) do |t|
27
+ t.libs << "test"
28
+ t.pattern = "test/**/*_test.rb"
29
+ t.verbose = false
30
+ end
31
+
32
+ task default: :test
@@ -45,6 +45,10 @@
45
45
  border-left-width: 1px;
46
46
  }
47
47
 
48
+ .calendar-heading nav {
49
+ display: inline-block;
50
+ }
51
+
48
52
  .day {
49
53
  height: 80px;
50
54
  }
@@ -1,18 +1,18 @@
1
1
  module SimpleCalendar
2
- module ViewHelpers
2
+ module CalendarHelper
3
3
  def calendar(options = {}, &block)
4
4
  raise "calendar requires a block" unless block
5
- SimpleCalendar::Calendar.new(self, options).render(&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
- SimpleCalendar::MonthCalendar.new(self, options).render(&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
- SimpleCalendar::WeekCalendar.new(self, options).render(&block)
15
+ render SimpleCalendar::WeekCalendar.new(self, options), &block
16
16
  end
17
17
  end
18
18
  end
@@ -1,8 +1,12 @@
1
1
  <div class="simple-calendar">
2
2
  <div class="calendar-heading">
3
- <%= link_to t('simple_calendar.previous', default: 'Previous'), calendar.url_for_previous_view %>
4
3
  <span class="calendar-title"><%= t('date.month_names')[start_date.month] %> <%= start_date.year %></span>
5
- <%= link_to t('simple_calendar.next', default: 'Next'), calendar.url_for_next_view %>
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>
6
10
  </div>
7
11
 
8
12
  <table class="table table-striped">
@@ -19,11 +23,7 @@
19
23
  <%= content_tag :tr, class: calendar.tr_classes_for(week) do %>
20
24
  <% week.each do |day| %>
21
25
  <%= content_tag :td, class: calendar.td_classes_for(day) do %>
22
- <% if defined?(Haml) && respond_to?(:block_is_haml?) && block_is_haml?(passed_block) %>
23
- <% capture_haml(day, sorted_events.fetch(day, []), &passed_block) %>
24
- <% else %>
25
- <% passed_block.call day, sorted_events.fetch(day, []) %>
26
- <% end %>
26
+ <% instance_exec(day, calendar.sorted_events_for(day), &passed_block) %>
27
27
  <% end %>
28
28
  <% end %>
29
29
  <% end %>