ultimate_turbo_modal 2.0.4 → 2.1.1

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.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/TM_COMMANDS_GUIDE.md +0 -0
  3. data/.claude/commands/tm/add-dependency/add-dependency.md +0 -0
  4. data/.claude/commands/tm/add-subtask/add-subtask.md +0 -0
  5. data/.claude/commands/tm/add-subtask/convert-task-to-subtask.md +0 -0
  6. data/.claude/commands/tm/add-task/add-task.md +0 -0
  7. data/.claude/commands/tm/analyze-complexity/analyze-complexity.md +0 -0
  8. data/.claude/commands/tm/clear-subtasks/clear-all-subtasks.md +0 -0
  9. data/.claude/commands/tm/clear-subtasks/clear-subtasks.md +0 -0
  10. data/.claude/commands/tm/complexity-report/complexity-report.md +0 -0
  11. data/.claude/commands/tm/expand/expand-all-tasks.md +0 -0
  12. data/.claude/commands/tm/expand/expand-task.md +0 -0
  13. data/.claude/commands/tm/fix-dependencies/fix-dependencies.md +0 -0
  14. data/.claude/commands/tm/generate/generate-tasks.md +0 -0
  15. data/.claude/commands/tm/help.md +0 -0
  16. data/.claude/commands/tm/init/init-project-quick.md +0 -0
  17. data/.claude/commands/tm/init/init-project.md +0 -0
  18. data/.claude/commands/tm/learn.md +0 -0
  19. data/.claude/commands/tm/list/list-tasks-by-status.md +0 -0
  20. data/.claude/commands/tm/list/list-tasks-with-subtasks.md +0 -0
  21. data/.claude/commands/tm/list/list-tasks.md +0 -0
  22. data/.claude/commands/tm/models/setup-models.md +0 -0
  23. data/.claude/commands/tm/models/view-models.md +0 -0
  24. data/.claude/commands/tm/next/next-task.md +0 -0
  25. data/.claude/commands/tm/parse-prd/parse-prd-with-research.md +0 -0
  26. data/.claude/commands/tm/parse-prd/parse-prd.md +0 -0
  27. data/.claude/commands/tm/remove-dependency/remove-dependency.md +0 -0
  28. data/.claude/commands/tm/remove-subtask/remove-subtask.md +0 -0
  29. data/.claude/commands/tm/remove-task/remove-task.md +0 -0
  30. data/.claude/commands/tm/set-status/to-cancelled.md +0 -0
  31. data/.claude/commands/tm/set-status/to-deferred.md +0 -0
  32. data/.claude/commands/tm/set-status/to-done.md +0 -0
  33. data/.claude/commands/tm/set-status/to-in-progress.md +0 -0
  34. data/.claude/commands/tm/set-status/to-pending.md +0 -0
  35. data/.claude/commands/tm/set-status/to-review.md +0 -0
  36. data/.claude/commands/tm/setup/install-taskmaster.md +0 -0
  37. data/.claude/commands/tm/setup/quick-install-taskmaster.md +0 -0
  38. data/.claude/commands/tm/show/show-task.md +0 -0
  39. data/.claude/commands/tm/status/project-status.md +0 -0
  40. data/.claude/commands/tm/sync-readme/sync-readme.md +0 -0
  41. data/.claude/commands/tm/tm-main.md +0 -0
  42. data/.claude/commands/tm/update/update-single-task.md +0 -0
  43. data/.claude/commands/tm/update/update-task.md +0 -0
  44. data/.claude/commands/tm/update/update-tasks-from-id.md +0 -0
  45. data/.claude/commands/tm/utils/analyze-project.md +0 -0
  46. data/.claude/commands/tm/validate-dependencies/validate-dependencies.md +0 -0
  47. data/.claude/commands/tm/workflows/auto-implement-tasks.md +0 -0
  48. data/.claude/commands/tm/workflows/command-pipeline.md +0 -0
  49. data/.claude/commands/tm/workflows/smart-workflow.md +0 -0
  50. data/.cursor/rules/taskmaster/dev_workflow.mdc +424 -0
  51. data/.cursor/rules/taskmaster/taskmaster.mdc +558 -0
  52. data/.env.example +0 -0
  53. data/.taskmaster/CLAUDE.md +0 -0
  54. data/.taskmaster/config.json +37 -0
  55. data/.taskmaster/templates/example_prd.txt +0 -0
  56. data/.tool-versions +1 -1
  57. data/CHANGELOG.md +8 -0
  58. data/CLAUDE.md +82 -0
  59. data/Gemfile +1 -1
  60. data/Gemfile.lock +51 -125
  61. data/README.md +62 -98
  62. data/UPGRADING.md +55 -0
  63. data/VERSION +1 -1
  64. data/demo-app/.gitattributes +7 -0
  65. data/demo-app/.gitignore +34 -0
  66. data/demo-app/.ruby-version +1 -0
  67. data/demo-app/.tool-versions +2 -0
  68. data/demo-app/Gemfile +41 -0
  69. data/demo-app/Gemfile.lock +248 -0
  70. data/demo-app/Procfile.dev +3 -0
  71. data/demo-app/README.md +15 -0
  72. data/demo-app/Rakefile +6 -0
  73. data/demo-app/app/assets/builds/.keep +0 -0
  74. data/demo-app/app/assets/images/.keep +0 -0
  75. data/demo-app/app/assets/stylesheets/application.css +42 -0
  76. data/demo-app/app/controllers/application_controller.rb +10 -0
  77. data/demo-app/app/controllers/concerns/.keep +0 -0
  78. data/demo-app/app/controllers/concerns/set_flavor.rb +10 -0
  79. data/demo-app/app/controllers/hide_from_backends_controller.rb +34 -0
  80. data/demo-app/app/controllers/modal_controller.rb +11 -0
  81. data/demo-app/app/controllers/posts_controller.rb +69 -0
  82. data/demo-app/app/controllers/welcome_controller.rb +2 -0
  83. data/demo-app/app/helpers/application_helper.rb +9 -0
  84. data/demo-app/app/javascript/application.js +4 -0
  85. data/demo-app/app/javascript/controllers/application.js +13 -0
  86. data/demo-app/app/javascript/controllers/dark_mode_controller.js +28 -0
  87. data/demo-app/app/javascript/controllers/flash_controller.js +9 -0
  88. data/demo-app/app/javascript/controllers/hello_controller.js +7 -0
  89. data/demo-app/app/javascript/controllers/index.js +15 -0
  90. data/demo-app/app/models/application_record.rb +3 -0
  91. data/demo-app/app/models/concerns/.keep +0 -0
  92. data/demo-app/app/models/post.rb +4 -0
  93. data/demo-app/app/views/hide_from_backends/_notice.html.erb +10 -0
  94. data/demo-app/app/views/hide_from_backends/create.turbo_stream.erb +2 -0
  95. data/demo-app/app/views/hide_from_backends/new.html.erb +30 -0
  96. data/demo-app/app/views/layouts/application.html.erb +40 -0
  97. data/demo-app/app/views/modal/index.html.erb +45 -0
  98. data/demo-app/app/views/modal/show.html.erb +39 -0
  99. data/demo-app/app/views/posts/_form.html.erb +36 -0
  100. data/demo-app/app/views/posts/_post.html.erb +9 -0
  101. data/demo-app/app/views/posts/edit.html.erb +9 -0
  102. data/demo-app/app/views/posts/index.html.erb +14 -0
  103. data/demo-app/app/views/posts/new.html.erb +3 -0
  104. data/demo-app/app/views/posts/show.html.erb +21 -0
  105. data/demo-app/app/views/shared/_flash.html.erb +13 -0
  106. data/demo-app/app/views/welcome/index.html.erb +19 -0
  107. data/demo-app/bin/bundle +109 -0
  108. data/demo-app/bin/dev +7 -0
  109. data/demo-app/bin/rails +4 -0
  110. data/demo-app/bin/rake +4 -0
  111. data/demo-app/bin/setup +34 -0
  112. data/demo-app/config/application.rb +43 -0
  113. data/demo-app/config/boot.rb +3 -0
  114. data/demo-app/config/credentials.yml.enc +1 -0
  115. data/demo-app/config/database.yml +25 -0
  116. data/demo-app/config/environment.rb +14 -0
  117. data/demo-app/config/environments/development.rb +51 -0
  118. data/demo-app/config/environments/production.rb +67 -0
  119. data/demo-app/config/environments/test.rb +42 -0
  120. data/demo-app/config/initializers/assets.rb +7 -0
  121. data/demo-app/config/initializers/content_security_policy.rb +25 -0
  122. data/demo-app/config/initializers/filter_parameter_logging.rb +8 -0
  123. data/demo-app/config/initializers/inflections.rb +14 -0
  124. data/demo-app/config/initializers/new_framework_defaults_8_0.rb +30 -0
  125. data/demo-app/config/initializers/permissions_policy.rb +11 -0
  126. data/demo-app/config/initializers/ultimate_turbo_modal.rb +12 -0
  127. data/demo-app/config/initializers/ultimate_turbo_modal_tailwind.rb +21 -0
  128. data/demo-app/config/initializers/ultimate_turbo_modal_vanilla.rb +21 -0
  129. data/demo-app/config/locales/en.yml +33 -0
  130. data/demo-app/config/puma.rb +41 -0
  131. data/demo-app/config/routes.rb +9 -0
  132. data/demo-app/config.ru +6 -0
  133. data/demo-app/db/migrate/20230331002502_create_posts.rb +10 -0
  134. data/demo-app/db/migrate/20231031012703_add_post.rb +9 -0
  135. data/demo-app/db/migrate/20231128141054_add_publish_on_to_posts.rb +5 -0
  136. data/demo-app/db/schema.rb +22 -0
  137. data/demo-app/lib/assets/.keep +0 -0
  138. data/demo-app/lib/tasks/.keep +0 -0
  139. data/demo-app/log/.keep +0 -0
  140. data/demo-app/package.json +28 -0
  141. data/demo-app/postcss.config.js +7 -0
  142. data/demo-app/public/400.html +114 -0
  143. data/demo-app/public/404.html +114 -0
  144. data/demo-app/public/406-unsupported-browser.html +114 -0
  145. data/demo-app/public/422.html +114 -0
  146. data/demo-app/public/500.html +114 -0
  147. data/demo-app/public/apple-touch-icon-precomposed.png +0 -0
  148. data/demo-app/public/apple-touch-icon.png +0 -0
  149. data/demo-app/public/favicon.ico +0 -0
  150. data/demo-app/public/icon.png +0 -0
  151. data/demo-app/public/icon.svg +3 -0
  152. data/demo-app/public/img/bootstrap-logo-shadow.png +0 -0
  153. data/demo-app/public/img/unicat.jpg +0 -0
  154. data/demo-app/public/img/vanilla.png +0 -0
  155. data/demo-app/public/robots.txt +1 -0
  156. data/demo-app/tmp/.keep +0 -0
  157. data/demo-app/tmp/pids/.keep +0 -0
  158. data/demo-app/vendor/.keep +0 -0
  159. data/demo-app/yarn.lock +1022 -0
  160. data/javascript/modal_controller.js +63 -2
  161. data/javascript/package.json +4 -2
  162. data/javascript/yarn.lock +12 -0
  163. data/lib/ultimate_turbo_modal/configuration.rb +1 -0
  164. metadata +184 -4
@@ -0,0 +1,34 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-*
13
+
14
+ # Ignore all logfiles and tempfiles.
15
+ /log/*
16
+ /tmp/*
17
+ !/log/.keep
18
+ !/tmp/.keep
19
+
20
+ # Ignore pidfiles, but keep the directory.
21
+ /tmp/pids/*
22
+ !/tmp/pids/
23
+ !/tmp/pids/.keep
24
+
25
+
26
+ /public/assets
27
+
28
+ # Ignore master key for decrypting credentials and more.
29
+ /config/master.key
30
+
31
+ /app/assets/builds/*
32
+ !/app/assets/builds/.keep
33
+
34
+ /node_modules
@@ -0,0 +1 @@
1
+ ruby-3.3.9
@@ -0,0 +1,2 @@
1
+ ruby 3.3.9
2
+ nodejs 22.14.0
data/demo-app/Gemfile ADDED
@@ -0,0 +1,41 @@
1
+ source "https://rubygems.org"
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ ruby file: ".tool-versions"
5
+
6
+ # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
7
+ gem "rails", "~> 8.0.2"
8
+
9
+ # The modern asset pipeline for Rails [https://github.com/rails/propshaft]
10
+ gem "propshaft"
11
+
12
+ # Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
13
+ gem "turbo-rails"
14
+
15
+ # Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
16
+ gem "stimulus-rails"
17
+
18
+ # Use sqlite3 as the database for Active Record
19
+ gem "sqlite3"
20
+
21
+ # Use the Puma web server [https://github.com/puma/puma]
22
+ gem "puma", "~> 6.6"
23
+
24
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
25
+ gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
26
+
27
+ group :development, :test do
28
+ # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
29
+ gem "debug", platforms: %i[ mri mingw x64_mingw ]
30
+ gem "web-console"
31
+ end
32
+
33
+ group :development do
34
+ # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
35
+ # gem "spring"
36
+ end
37
+
38
+ gem "cssbundling-rails"
39
+ gem "jsbundling-rails"
40
+ gem "faker"
41
+ gem "ultimate_turbo_modal", path: "../"
@@ -0,0 +1,248 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ ultimate_turbo_modal (2.0.4)
5
+ actionpack
6
+ activesupport
7
+ phlex-rails
8
+ railties
9
+ stimulus-rails
10
+ turbo-rails
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ actioncable (8.0.2)
16
+ actionpack (= 8.0.2)
17
+ activesupport (= 8.0.2)
18
+ nio4r (~> 2.0)
19
+ websocket-driver (>= 0.6.1)
20
+ zeitwerk (~> 2.6)
21
+ actionmailbox (8.0.2)
22
+ actionpack (= 8.0.2)
23
+ activejob (= 8.0.2)
24
+ activerecord (= 8.0.2)
25
+ activestorage (= 8.0.2)
26
+ activesupport (= 8.0.2)
27
+ mail (>= 2.8.0)
28
+ actionmailer (8.0.2)
29
+ actionpack (= 8.0.2)
30
+ actionview (= 8.0.2)
31
+ activejob (= 8.0.2)
32
+ activesupport (= 8.0.2)
33
+ mail (>= 2.8.0)
34
+ rails-dom-testing (~> 2.2)
35
+ actionpack (8.0.2)
36
+ actionview (= 8.0.2)
37
+ activesupport (= 8.0.2)
38
+ nokogiri (>= 1.8.5)
39
+ rack (>= 2.2.4)
40
+ rack-session (>= 1.0.1)
41
+ rack-test (>= 0.6.3)
42
+ rails-dom-testing (~> 2.2)
43
+ rails-html-sanitizer (~> 1.6)
44
+ useragent (~> 0.16)
45
+ actiontext (8.0.2)
46
+ actionpack (= 8.0.2)
47
+ activerecord (= 8.0.2)
48
+ activestorage (= 8.0.2)
49
+ activesupport (= 8.0.2)
50
+ globalid (>= 0.6.0)
51
+ nokogiri (>= 1.8.5)
52
+ actionview (8.0.2)
53
+ activesupport (= 8.0.2)
54
+ builder (~> 3.1)
55
+ erubi (~> 1.11)
56
+ rails-dom-testing (~> 2.2)
57
+ rails-html-sanitizer (~> 1.6)
58
+ activejob (8.0.2)
59
+ activesupport (= 8.0.2)
60
+ globalid (>= 0.3.6)
61
+ activemodel (8.0.2)
62
+ activesupport (= 8.0.2)
63
+ activerecord (8.0.2)
64
+ activemodel (= 8.0.2)
65
+ activesupport (= 8.0.2)
66
+ timeout (>= 0.4.0)
67
+ activestorage (8.0.2)
68
+ actionpack (= 8.0.2)
69
+ activejob (= 8.0.2)
70
+ activerecord (= 8.0.2)
71
+ activesupport (= 8.0.2)
72
+ marcel (~> 1.0)
73
+ activesupport (8.0.2)
74
+ base64
75
+ benchmark (>= 0.3)
76
+ bigdecimal
77
+ concurrent-ruby (~> 1.0, >= 1.3.1)
78
+ connection_pool (>= 2.2.5)
79
+ drb
80
+ i18n (>= 1.6, < 2)
81
+ logger (>= 1.4.2)
82
+ minitest (>= 5.1)
83
+ securerandom (>= 0.3)
84
+ tzinfo (~> 2.0, >= 2.0.5)
85
+ uri (>= 0.13.1)
86
+ base64 (0.2.0)
87
+ benchmark (0.4.0)
88
+ bigdecimal (3.1.9)
89
+ bindex (0.8.1)
90
+ builder (3.3.0)
91
+ concurrent-ruby (1.3.5)
92
+ connection_pool (2.5.0)
93
+ crass (1.0.6)
94
+ cssbundling-rails (1.4.3)
95
+ railties (>= 6.0.0)
96
+ date (3.4.1)
97
+ debug (1.10.0)
98
+ irb (~> 1.10)
99
+ reline (>= 0.3.8)
100
+ drb (2.2.1)
101
+ erubi (1.13.1)
102
+ faker (3.5.1)
103
+ i18n (>= 1.8.11, < 2)
104
+ globalid (1.2.1)
105
+ activesupport (>= 6.1)
106
+ i18n (1.14.7)
107
+ concurrent-ruby (~> 1.0)
108
+ io-console (0.8.0)
109
+ irb (1.15.2)
110
+ pp (>= 0.6.0)
111
+ rdoc (>= 4.0.0)
112
+ reline (>= 0.4.2)
113
+ jsbundling-rails (1.3.1)
114
+ railties (>= 6.0.0)
115
+ logger (1.7.0)
116
+ loofah (2.24.0)
117
+ crass (~> 1.0.2)
118
+ nokogiri (>= 1.12.0)
119
+ mail (2.8.1)
120
+ mini_mime (>= 0.1.1)
121
+ net-imap
122
+ net-pop
123
+ net-smtp
124
+ marcel (1.0.4)
125
+ mini_mime (1.1.5)
126
+ minitest (5.25.5)
127
+ net-imap (0.5.6)
128
+ date
129
+ net-protocol
130
+ net-pop (0.1.2)
131
+ net-protocol
132
+ net-protocol (0.2.2)
133
+ timeout
134
+ net-smtp (0.5.1)
135
+ net-protocol
136
+ nio4r (2.7.4)
137
+ nokogiri (1.18.7-arm64-darwin)
138
+ racc (~> 1.4)
139
+ phlex (1.11.0)
140
+ phlex-rails (1.2.2)
141
+ phlex (>= 1.10, < 2)
142
+ railties (>= 6.1, < 9)
143
+ pp (0.6.2)
144
+ prettyprint
145
+ prettyprint (0.2.0)
146
+ propshaft (1.1.0)
147
+ actionpack (>= 7.0.0)
148
+ activesupport (>= 7.0.0)
149
+ rack
150
+ railties (>= 7.0.0)
151
+ psych (5.2.3)
152
+ date
153
+ stringio
154
+ puma (6.6.0)
155
+ nio4r (~> 2.0)
156
+ racc (1.8.1)
157
+ rack (3.1.12)
158
+ rack-session (2.1.0)
159
+ base64 (>= 0.1.0)
160
+ rack (>= 3.0.0)
161
+ rack-test (2.2.0)
162
+ rack (>= 1.3)
163
+ rackup (2.2.1)
164
+ rack (>= 3)
165
+ rails (8.0.2)
166
+ actioncable (= 8.0.2)
167
+ actionmailbox (= 8.0.2)
168
+ actionmailer (= 8.0.2)
169
+ actionpack (= 8.0.2)
170
+ actiontext (= 8.0.2)
171
+ actionview (= 8.0.2)
172
+ activejob (= 8.0.2)
173
+ activemodel (= 8.0.2)
174
+ activerecord (= 8.0.2)
175
+ activestorage (= 8.0.2)
176
+ activesupport (= 8.0.2)
177
+ bundler (>= 1.15.0)
178
+ railties (= 8.0.2)
179
+ rails-dom-testing (2.2.0)
180
+ activesupport (>= 5.0.0)
181
+ minitest
182
+ nokogiri (>= 1.6)
183
+ rails-html-sanitizer (1.6.2)
184
+ loofah (~> 2.21)
185
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
186
+ railties (8.0.2)
187
+ actionpack (= 8.0.2)
188
+ activesupport (= 8.0.2)
189
+ irb (~> 1.13)
190
+ rackup (>= 1.0.0)
191
+ rake (>= 12.2)
192
+ thor (~> 1.0, >= 1.2.2)
193
+ zeitwerk (~> 2.6)
194
+ rake (13.2.1)
195
+ rdoc (6.13.1)
196
+ psych (>= 4.0.0)
197
+ reline (0.6.1)
198
+ io-console (~> 0.5)
199
+ securerandom (0.4.1)
200
+ sqlite3 (2.6.0-arm64-darwin)
201
+ stimulus-rails (1.3.4)
202
+ railties (>= 6.0.0)
203
+ stringio (3.1.6)
204
+ thor (1.3.2)
205
+ timeout (0.4.3)
206
+ turbo-rails (2.0.13)
207
+ actionpack (>= 7.1.0)
208
+ railties (>= 7.1.0)
209
+ tzinfo (2.0.6)
210
+ concurrent-ruby (~> 1.0)
211
+ uri (1.0.3)
212
+ useragent (0.16.11)
213
+ web-console (4.2.1)
214
+ actionview (>= 6.0.0)
215
+ activemodel (>= 6.0.0)
216
+ bindex (>= 0.4.0)
217
+ railties (>= 6.0.0)
218
+ websocket-driver (0.7.7)
219
+ base64
220
+ websocket-extensions (>= 0.1.0)
221
+ websocket-extensions (0.1.5)
222
+ zeitwerk (2.7.2)
223
+
224
+ PLATFORMS
225
+ arm64-darwin-22
226
+ arm64-darwin-23
227
+ arm64-darwin-24
228
+
229
+ DEPENDENCIES
230
+ cssbundling-rails
231
+ debug
232
+ faker
233
+ jsbundling-rails
234
+ propshaft
235
+ puma (~> 6.6)
236
+ rails (~> 8.0.2)
237
+ sqlite3
238
+ stimulus-rails
239
+ turbo-rails
240
+ tzinfo-data
241
+ ultimate_turbo_modal!
242
+ web-console
243
+
244
+ RUBY VERSION
245
+ ruby 3.3.9p170
246
+
247
+ BUNDLED WITH
248
+ 2.6.7
@@ -0,0 +1,3 @@
1
+ web: bin/rails server -p 3000
2
+ css: yarn build:css --watch
3
+ js: yarn build --watch
@@ -0,0 +1,15 @@
1
+ # The Ultimate Turbo Modal for Rails - Demo
2
+
3
+ This is a demo application. You can find the Ruby Gem and instructions on how to use
4
+ it in your own application at https://github.com/cmer/ultimate_turbo_modal.
5
+
6
+ &nbsp;
7
+ &nbsp;
8
+ # Getting up and running...
9
+
10
+ ```sh
11
+ bin/rails db:create db:migrate db:seed
12
+ yarn install
13
+ bin/dev
14
+ open http://localhost:3000
15
+ ```
data/demo-app/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative "config/application"
5
+
6
+ Rails.application.load_tasks
File without changes
File without changes
@@ -0,0 +1,42 @@
1
+ @import 'tailwindcss';
2
+ @import 'ultimate_turbo_modal/dist/vanilla.css' layer(components);
3
+ @import 'flatpickr/dist/flatpickr.css' layer(base);
4
+
5
+ @plugin '@tailwindcss/aspect-ratio';
6
+ @plugin '@tailwindcss/forms';
7
+ @plugin '@tailwindcss/typography';
8
+
9
+ @custom-variant dark (&:is(.dark *));
10
+
11
+ @theme {
12
+ --font-sans:
13
+ Inter var, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
14
+ 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif,
15
+ 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
16
+ }
17
+
18
+ @layer base {
19
+
20
+ *,
21
+ ::after,
22
+ ::before,
23
+ ::backdrop,
24
+ ::file-selector-button {
25
+ border-color: var(--color-gray-200, currentcolor);
26
+ }
27
+ }
28
+
29
+ #ts-notice:not(:empty) {
30
+ position: fixed;
31
+ top: 0.5rem;
32
+ right: 0.5rem;
33
+ width: auto;
34
+ border: 1px solid;
35
+ padding: 1rem;
36
+ margin-top: 2.5rem;
37
+ margin-bottom: 2.5rem;
38
+ color: black;
39
+ border-color: rgba(0, 148, 0, 0.8);
40
+ background-color: rgba(176, 255, 176, 0.6);
41
+ max-width: 32rem;
42
+ }
@@ -0,0 +1,10 @@
1
+ class ApplicationController < ActionController::Base
2
+ include SetFlavor
3
+
4
+ def set_modal_properties
5
+ %i[padding advance close_button].each do |it|
6
+ instance_variable_set("@#{it}", params[it] == "1")
7
+ end
8
+ @override_url = "/custom-advance-history-url" if @advance
9
+ end
10
+ end
File without changes
@@ -0,0 +1,10 @@
1
+ module SetFlavor
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ before_action do
6
+ UltimateTurboModal.flavor = request.params[:flavor] || cookies[:flavor] || "tailwind"
7
+ cookies.permanent[:flavor] = UltimateTurboModal.flavor
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,34 @@
1
+ # Sometimes it might be desirable to close the modal from the backend.
2
+ # This can be done with Turbo Stream as such:
3
+ #
4
+ # <%= turbo_stream.modal(:hide) %>
5
+ #
6
+ # This controller is an example of how to do that.
7
+ class HideFromBackendsController < ApplicationController
8
+ def new
9
+ # Show form
10
+ end
11
+
12
+ def create
13
+ form_is_valid? ? close_modal : render(:new, status: :unprocessable_entity)
14
+ end
15
+
16
+ private
17
+
18
+ def close_modal
19
+ if inside_modal?
20
+ # `create.turbo_stream.erb` will be rendered.
21
+ # A message will appear in the browser, and the backend
22
+ # will trigger a modal close via turbo stream.
23
+ else
24
+ # if not inside a modal, simply redirect
25
+ redirect_to("/")
26
+ end
27
+ end
28
+
29
+ def form_is_valid?
30
+ return true if request.params[:action] == 'new'
31
+ params[:email].present?
32
+ end
33
+ helper_method :form_is_valid?
34
+ end
@@ -0,0 +1,11 @@
1
+ class ModalController < ApplicationController
2
+ before_action :set_modal_properties
3
+
4
+ def index
5
+ @post = Post.first
6
+ end
7
+
8
+ def show
9
+ @header = !(params[:id] == "photo")
10
+ end
11
+ end
@@ -0,0 +1,69 @@
1
+ class PostsController < ApplicationController
2
+ before_action :set_post, only: %i[show edit update destroy]
3
+ before_action :set_modal_properties
4
+
5
+ # GET /posts
6
+ def index
7
+ @posts = Post.all
8
+ end
9
+
10
+ # GET /posts/1
11
+ def show
12
+ @modal_title = @post.title
13
+ end
14
+
15
+ # GET /posts/new
16
+ def new
17
+ @post = Post.new
18
+ @modal_title = "New Post"
19
+ end
20
+
21
+ # GET /posts/1/edit
22
+ def edit
23
+ @modal_title = "Edit Post"
24
+ end
25
+
26
+ # POST /posts
27
+ def create
28
+ @post = Post.new(post_params)
29
+ @modal_title = "New Post"
30
+
31
+ if @post.save
32
+ redirect_to "/",
33
+ notice: "Post was successfully created.",
34
+ status: :see_other
35
+ else
36
+ render :new, status: :unprocessable_entity
37
+ end
38
+ end
39
+
40
+ # PATCH/PUT /posts/1
41
+ def update
42
+ if @post.update(post_params)
43
+ redirect_to "/",
44
+ notice: "Post was successfully updated.",
45
+ status: :see_other
46
+ else
47
+ render :edit, status: :unprocessable_entity
48
+ end
49
+ end
50
+
51
+ # DELETE /posts/1
52
+ def destroy
53
+ redirect_to "/",
54
+ notice: "Post was successfully destroyed. (but not really)",
55
+ status: :see_other
56
+ end
57
+
58
+ private
59
+
60
+ # Use callbacks to share common setup or constraints between actions.
61
+ def set_post
62
+ @post = Post.find(params[:id])
63
+ end
64
+
65
+ # Only allow a list of trusted parameters through.
66
+ def post_params
67
+ params.require(:post).permit(:title, :body)
68
+ end
69
+ end
@@ -0,0 +1,2 @@
1
+ class WelcomeController < ApplicationController
2
+ end
@@ -0,0 +1,9 @@
1
+ module ApplicationHelper
2
+ def h1_classes
3
+ "text-2xl font-bold tracking-tight text-gray-900 sm:text-4xl border-b mb-2 dark:text-white"
4
+ end
5
+
6
+ def button_classes
7
+ "rounded-md bg-indigo-600 px-3.5 py-2.5 text-sm font-semibold text-white shadow-xs hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ import { Turbo } from "@hotwired/turbo-rails";
2
+ import "./controllers";
3
+
4
+ window.Turbo = Turbo;
@@ -0,0 +1,13 @@
1
+ import { Application } from "@hotwired/stimulus"
2
+
3
+ const application = Application.start()
4
+
5
+ // Configure Stimulus development experience
6
+ application.debug = false
7
+ window.Stimulus = application
8
+
9
+ // Flatpickr
10
+ import Flatpickr from "stimulus-flatpickr"
11
+ application.register('flatpickr', Flatpickr)
12
+
13
+ export { application }
@@ -0,0 +1,28 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ static targets = ["toggle"];
5
+
6
+ toggleTheme() {
7
+ // Toggle the dark class on the html element
8
+ if (document.documentElement.classList.contains('dark')) {
9
+ document.documentElement.classList.remove('dark');
10
+ this.setCookie('theme', 'light');
11
+ } else {
12
+ document.documentElement.classList.add('dark');
13
+ this.setCookie('theme', 'dark');
14
+ }
15
+ }
16
+
17
+ setCookie(name, value, days = 7) {
18
+ const expires = new Date(Date.now() + days * 864e5).toUTCString();
19
+ document.cookie = `${name}=${value};expires=${expires};path=/`;
20
+ }
21
+
22
+ getCookie(name) {
23
+ const value = `; ${document.cookie}`;
24
+ const parts = value.split(`; ${name}=`);
25
+ if (parts.length === 2) return parts.pop().split(';').shift();
26
+ return null;
27
+ }
28
+ }
@@ -0,0 +1,9 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ connect() {
5
+ setTimeout(() => {
6
+ this.element.remove()
7
+ }, 3000)
8
+ }
9
+ }
@@ -0,0 +1,7 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ connect() {
5
+ this.element.textContent = "Hello World!"
6
+ }
7
+ }
@@ -0,0 +1,15 @@
1
+ // This file is auto-generated by ./bin/rails stimulus:manifest:update
2
+ // Run that command whenever you add a new controller or create them with
3
+ // ./bin/rails generate stimulus controllerName
4
+
5
+ import { application } from "./application"
6
+
7
+ import DarkModeController from "./dark_mode_controller"
8
+ application.register("dark-mode", DarkModeController)
9
+
10
+ import FlashController from "./flash_controller"
11
+ application.register("flash", FlashController)
12
+
13
+ // import { UltimateTurboModalController } from "../../../../ultimate_turbo_modal-rails/javascript/dist/ultimate_turbo_modal.js"
14
+ import { UltimateTurboModalController } from "ultimate_turbo_modal"
15
+ application.register("modal", UltimateTurboModalController)
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ primary_abstract_class
3
+ end
File without changes
@@ -0,0 +1,4 @@
1
+ class Post < ApplicationRecord
2
+ validates :title, presence: true
3
+ validates :body, presence: true
4
+ end
@@ -0,0 +1,10 @@
1
+ <% if local_assigns[:message] %>
2
+ <div id="ts-notice">
3
+ <%= local_assigns[:message] %>
4
+ <div class="mt-3 font-medium">
5
+ <a href="#" onclick="document.getElementById('ts-notice').innerHTML=''; return false;">Close</a>
6
+ </div>
7
+ </div>
8
+ <% else %>
9
+ <div id="ts-notice"></div>
10
+ <% end %>
@@ -0,0 +1,2 @@
1
+ <%= turbo_stream.modal(:hide) %>
2
+ <%= turbo_stream.replace "ts-notice", partial: "notice", locals: { message: "Modal close was triggered by the backend via Turbo Stream @ #{Time.now}!" } %>