simple_calendar 2.4.3 → 3.0.0

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 +7 -0
  6. data/Gemfile +4 -1
  7. data/Gemfile.lock +157 -136
  8. data/README.md +22 -15
  9. data/Rakefile +29 -5
  10. data/app/assets/stylesheets/simple_calendar.scss +4 -0
  11. data/app/views/simple_calendar/_calendar.html.erb +7 -7
  12. data/app/views/simple_calendar/_month_calendar.html.erb +8 -8
  13. data/app/views/simple_calendar/_week_calendar.html.erb +14 -12
  14. data/bin/rails +16 -0
  15. data/gemfiles/rails_6_1.gemfile +3 -1
  16. data/gemfiles/rails_6_1.gemfile.lock +159 -131
  17. data/gemfiles/{rails_6.gemfile → rails_7_0.gemfile} +4 -2
  18. data/gemfiles/rails_7_0.gemfile.lock +222 -0
  19. data/gemfiles/{rails_master.gemfile → rails_main.gemfile} +3 -1
  20. data/gemfiles/rails_main.gemfile.lock +246 -0
  21. data/lib/simple_calendar/calendar.rb +26 -14
  22. data/lib/simple_calendar/month_calendar.rb +4 -0
  23. data/lib/simple_calendar/version.rb +1 -1
  24. data/lib/simple_calendar/view_helpers.rb +3 -3
  25. data/lib/simple_calendar/week_calendar.rb +5 -1
  26. data/lib/simple_calendar.rb +8 -1
  27. data/simple_calendar.gemspec +1 -3
  28. data/test/calendars/calendar_test.rb +154 -0
  29. data/test/calendars/month_calendar_test.rb +16 -0
  30. data/test/dummy/Rakefile +6 -0
  31. data/test/dummy/app/assets/config/manifest.js +1 -0
  32. data/test/dummy/app/assets/images/.keep +0 -0
  33. data/test/dummy/app/assets/stylesheets/application.css +1 -0
  34. data/test/dummy/app/channels/application_cable/channel.rb +4 -0
  35. data/test/dummy/app/channels/application_cable/connection.rb +4 -0
  36. data/test/dummy/app/controllers/application_controller.rb +2 -0
  37. data/test/dummy/app/controllers/concerns/.keep +0 -0
  38. data/test/dummy/app/controllers/meetings_controller.rb +59 -0
  39. data/test/dummy/app/helpers/application_helper.rb +2 -0
  40. data/test/dummy/app/helpers/meetings_helper.rb +2 -0
  41. data/test/dummy/app/jobs/application_job.rb +7 -0
  42. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  43. data/test/dummy/app/models/application_record.rb +7 -0
  44. data/test/dummy/app/models/concerns/.keep +0 -0
  45. data/test/dummy/app/models/meeting.rb +2 -0
  46. data/test/dummy/app/views/layouts/application.html.erb +15 -0
  47. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  48. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  49. data/test/dummy/app/views/meetings/_form.html.erb +32 -0
  50. data/test/dummy/app/views/meetings/_meeting.html.erb +17 -0
  51. data/test/dummy/app/views/meetings/edit.html.erb +10 -0
  52. data/test/dummy/app/views/meetings/index.html.erb +24 -0
  53. data/test/dummy/app/views/meetings/new.html.erb +9 -0
  54. data/test/dummy/app/views/meetings/show.html.erb +10 -0
  55. data/test/dummy/bin/rails +4 -0
  56. data/test/dummy/bin/rake +4 -0
  57. data/test/dummy/bin/setup +33 -0
  58. data/test/dummy/config/application.rb +22 -0
  59. data/test/dummy/config/boot.rb +5 -0
  60. data/test/dummy/config/cable.yml +10 -0
  61. data/test/dummy/config/database.yml +25 -0
  62. data/test/dummy/config/environment.rb +5 -0
  63. data/test/dummy/config/environments/development.rb +67 -0
  64. data/test/dummy/config/environments/production.rb +87 -0
  65. data/test/dummy/config/environments/test.rb +60 -0
  66. data/test/dummy/config/initializers/content_security_policy.rb +25 -0
  67. data/test/dummy/config/initializers/filter_parameter_logging.rb +8 -0
  68. data/test/dummy/config/initializers/inflections.rb +16 -0
  69. data/test/dummy/config/initializers/permissions_policy.rb +11 -0
  70. data/test/dummy/config/locales/en.yml +33 -0
  71. data/test/dummy/config/puma.rb +43 -0
  72. data/test/dummy/config/routes.rb +7 -0
  73. data/test/dummy/config/storage.yml +34 -0
  74. data/test/dummy/config.ru +6 -0
  75. data/test/dummy/db/migrate/20220930184313_create_meetings.rb +11 -0
  76. data/test/dummy/db/schema.rb +21 -0
  77. data/test/dummy/lib/assets/.keep +0 -0
  78. data/test/dummy/log/.keep +0 -0
  79. data/test/dummy/public/404.html +67 -0
  80. data/test/dummy/public/422.html +67 -0
  81. data/test/dummy/public/500.html +66 -0
  82. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  83. data/test/dummy/public/apple-touch-icon.png +0 -0
  84. data/test/dummy/public/favicon.ico +0 -0
  85. data/test/dummy/storage/.keep +0 -0
  86. data/test/dummy/tmp/.keep +0 -0
  87. data/test/dummy/tmp/development_secret.txt +1 -0
  88. data/test/dummy/tmp/pids/.keep +0 -0
  89. data/test/dummy/tmp/pids/server.pid +1 -0
  90. data/test/dummy/tmp/restart.txt +0 -0
  91. data/test/dummy/tmp/storage/.keep +0 -0
  92. data/test/fixtures/meetings.yml +36 -0
  93. data/test/integrations/month_calendar_test.rb +58 -0
  94. data/test/simple_calendar_test.rb +7 -0
  95. data/test/test_helper.rb +14 -0
  96. metadata +80 -39
  97. data/gemfiles/rails_6.gemfile.lock +0 -195
  98. data/gemfiles/rails_master.gemfile.lock +0 -207
  99. data/spec/calendar_spec.rb +0 -176
  100. data/spec/calendars/month_calendar_spec.rb +0 -25
  101. data/spec/simple_calendar_spec.rb +0 -9
  102. data/spec/spec_helper.rb +0 -96
  103. data/spec/support/fake_event.rb +0 -9
  104. data/spec/support/view_context.rb +0 -20
  105. data/spec/views_generators_spec.rb +0 -7
  106. /data/lib/simple_calendar/{railtie.rb → engine.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e36ddb5bf4d84867961f50a904b50fbf62ce6f3b296504e2d1f9307c60371938
4
- data.tar.gz: f8c1c02a8f5f009950049035d26741104e2cd99d5edfee97f0270eb730670520
3
+ metadata.gz: e11781a625cdf2a8812e5b7972feecb016b82abe0c1ad57b6687e90851f04f86
4
+ data.tar.gz: 19f2e34143a16827b1b2a6255988ef53004477f91077e4e69bcfef31837aec31
5
5
  SHA512:
6
- metadata.gz: 9b4bf518dae5f8cb63e83746e34eda30bbe460c2d7a9f5743e9fd7fd1ac822e8d1b7af43466ed7d29a1d41e57327c8a95c5b05b39af50ebfb5d40d8726373237
7
- data.tar.gz: dafcf5f2db9dd69202084a6233a2a3a0354f36565ba27f7551d38185ad8d50053dc6f5f4d12ee14fcda1e510ea9a68d202d40d073c4c2cd4f330c714a2477aa9
6
+ metadata.gz: 140c319c81da2305230604b0101f6302e14d9952c2895ffab35a7d3c43cf7d4ab5eb4ad2111f0d2bb7246488446d9f09de71bb9b6e0bfe6ddeea11efba8b7bd0
7
+ data.tar.gz: 8c2f960eaea8445f1a4f45b62d7ba5fd7864010a91c6ee37f4299443aa95bc4df70c760cea79bdaff35a166d65a0cbaa2b0b0caf1be289668705b337a1dd8c30
@@ -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/log/test.log
9
+ test/dummy/log/development.log
10
+ test/dummy/db/development.sqlite3
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,10 @@
1
+ ### 3.0.0
2
+
3
+ * Drop support for Rails 6.0 and earlier
4
+ * Add Today link to calendars to reset to current date
5
+ * Add `locals: {}` option when rendering calendars to add extra local variables
6
+ * Refactor to use `render_in`
7
+
1
8
  ### 2.4.3
2
9
 
3
10
  * Fix deprecation warnings - @mbobin
data/Gemfile CHANGED
@@ -2,5 +2,8 @@ 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"
data/Gemfile.lock CHANGED
@@ -1,197 +1,218 @@
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.0)
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)
74
85
  builder (3.2.4)
75
- concurrent-ruby (1.1.9)
86
+ concurrent-ruby (1.2.2)
76
87
  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)
88
+ date (3.3.3)
89
+ erubi (1.12.0)
90
+ globalid (1.1.0)
91
+ activesupport (>= 5.0)
92
+ i18n (1.14.1)
82
93
  concurrent-ruby (~> 1.0)
83
- loofah (2.10.0)
94
+ json (2.6.3)
95
+ language_server-protocol (3.17.0.3)
96
+ lint_roller (1.1.0)
97
+ loofah (2.21.3)
84
98
  crass (~> 1.0.2)
85
- nokogiri (>= 1.5.9)
86
- mail (2.7.1)
99
+ nokogiri (>= 1.12.0)
100
+ mail (2.8.1)
87
101
  mini_mime (>= 0.1.1)
88
- marcel (1.0.1)
102
+ net-imap
103
+ net-pop
104
+ net-smtp
105
+ marcel (1.0.2)
89
106
  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)
107
+ mini_mime (1.1.2)
108
+ minitest (5.18.1)
109
+ net-imap (0.3.6)
110
+ date
111
+ net-protocol
112
+ net-pop (0.1.2)
113
+ net-protocol
114
+ net-protocol (0.2.1)
115
+ timeout
116
+ net-smtp (0.3.3)
117
+ net-protocol
118
+ nio4r (2.5.9)
119
+ nokogiri (1.15.3-x86_64-darwin)
98
120
  racc (~> 1.4)
99
- nokogiri (1.11.7-x86_64-linux)
121
+ nokogiri (1.15.3-x86_64-linux)
100
122
  racc (~> 1.4)
101
- parallel (1.20.1)
102
- parser (3.0.1.1)
123
+ parallel (1.23.0)
124
+ parser (3.2.2.3)
103
125
  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)
126
+ racc
127
+ puma (6.3.0)
128
+ nio4r (~> 2.0)
129
+ racc (1.7.1)
130
+ rack (2.2.7)
131
+ rack-test (2.1.0)
132
+ rack (>= 1.3)
133
+ rails (7.0.6)
134
+ actioncable (= 7.0.6)
135
+ actionmailbox (= 7.0.6)
136
+ actionmailer (= 7.0.6)
137
+ actionpack (= 7.0.6)
138
+ actiontext (= 7.0.6)
139
+ actionview (= 7.0.6)
140
+ activejob (= 7.0.6)
141
+ activemodel (= 7.0.6)
142
+ activerecord (= 7.0.6)
143
+ activestorage (= 7.0.6)
144
+ activesupport (= 7.0.6)
120
145
  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)
146
+ railties (= 7.0.6)
147
+ rails-dom-testing (2.1.1)
148
+ activesupport (>= 5.0.0)
149
+ minitest
125
150
  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)
151
+ rails-html-sanitizer (1.6.0)
152
+ loofah (~> 2.21)
153
+ nokogiri (~> 1.14)
154
+ railties (7.0.6)
155
+ actionpack (= 7.0.6)
156
+ activesupport (= 7.0.6)
131
157
  method_source
132
- rake (>= 0.13)
158
+ rake (>= 12.2)
133
159
  thor (~> 1.0)
134
- rainbow (3.0.0)
135
- rake (13.0.3)
136
- regexp_parser (2.1.1)
160
+ zeitwerk (~> 2.5)
161
+ rainbow (3.1.1)
162
+ rake (13.0.6)
163
+ regexp_parser (2.8.1)
137
164
  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)
165
+ rubocop (1.52.1)
166
+ json (~> 2.3)
152
167
  parallel (~> 1.10)
153
- parser (>= 3.0.0.0)
168
+ parser (>= 3.2.2.3)
154
169
  rainbow (>= 2.2.2, < 4.0)
155
170
  regexp_parser (>= 1.8, < 3.0)
156
- rexml
157
- rubocop-ast (>= 1.5.0, < 2.0)
171
+ rexml (>= 3.2.5, < 4.0)
172
+ rubocop-ast (>= 1.28.0, < 2.0)
158
173
  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)
174
+ unicode-display_width (>= 2.4.0, < 3.0)
175
+ rubocop-ast (1.29.0)
176
+ parser (>= 3.2.1.0)
177
+ rubocop-performance (1.18.0)
163
178
  rubocop (>= 1.7.0, < 2.0)
164
179
  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)
180
+ ruby-progressbar (1.13.0)
181
+ sqlite3 (1.6.3-x86_64-darwin)
182
+ sqlite3 (1.6.3-x86_64-linux)
183
+ standard (1.30.1)
184
+ language_server-protocol (~> 3.17.0.2)
185
+ lint_roller (~> 1.0)
186
+ rubocop (~> 1.52.0)
187
+ standard-custom (~> 1.0.0)
188
+ standard-performance (~> 1.1.0)
189
+ standard-custom (1.0.2)
190
+ lint_roller (~> 1.0)
191
+ rubocop (~> 1.50)
192
+ standard-performance (1.1.1)
193
+ lint_roller (~> 1.1)
194
+ rubocop-performance (~> 1.18.0)
195
+ thor (1.2.2)
196
+ timeout (0.4.0)
197
+ tzinfo (2.0.6)
178
198
  concurrent-ruby (~> 1.0)
179
- unicode-display_width (2.0.0)
199
+ unicode-display_width (2.4.2)
180
200
  websocket-driver (0.7.5)
181
201
  websocket-extensions (>= 0.1.0)
182
202
  websocket-extensions (0.1.5)
183
- zeitwerk (2.4.2)
203
+ zeitwerk (2.6.8)
184
204
 
185
205
  PLATFORMS
186
- ruby
187
206
  x86_64-darwin-20
207
+ x86_64-darwin-22
188
208
  x86_64-linux
189
209
 
190
210
  DEPENDENCIES
191
- appraisal
192
- rspec
211
+ appraisal!
212
+ puma
193
213
  simple_calendar!
214
+ sqlite3
194
215
  standard
195
216
 
196
217
  BUNDLED WITH
197
- 2.2.20
218
+ 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
 
@@ -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,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 %>
@@ -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
- <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 %>
3
+ <time datetime="<%= start_date.strftime('%Y-%m') %>" class="calendar-title"><%= t('date.month_names')[start_date.month] %> <%= start_date.year %></time>
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
  <tr>
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
  </tr>