rolemodel-rails 2.2.0 → 2.3.0

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 (53) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +25 -12
  3. data/Rakefile +3 -3
  4. data/lib/generators/rolemodel/core_setup/core_setup_generator.rb +12 -8
  5. data/lib/generators/rolemodel/good_job/good_job_generator.rb +7 -11
  6. data/lib/generators/rolemodel/heroku/heroku_generator.rb +0 -15
  7. data/lib/generators/rolemodel/optics/base/base_generator.rb +2 -2
  8. data/lib/generators/rolemodel/saas/devise/devise_generator.rb +3 -3
  9. data/lib/generators/rolemodel/sentry/sentry_generator.rb +5 -17
  10. data/lib/generators/rolemodel/sentry/templates/app/controllers/concerns/sentry_user.rb +13 -0
  11. data/lib/generators/rolemodel/slim/templates/app/views/application/_head.html.slim.tt +0 -4
  12. data/lib/generators/rolemodel/testing/rspec/rspec_generator.rb +8 -10
  13. data/lib/generators/rolemodel/testing/vitest/vitest_generator.rb +1 -1
  14. data/lib/generators/rolemodel/turbo/all/README.md +16 -0
  15. data/lib/generators/rolemodel/turbo/all/USAGE +5 -0
  16. data/lib/generators/rolemodel/turbo/all/all_generator.rb +15 -0
  17. data/lib/generators/rolemodel/turbo/confirm/README.md +25 -0
  18. data/lib/generators/rolemodel/turbo/confirm/USAGE +5 -0
  19. data/lib/generators/rolemodel/turbo/confirm/confirm_generator.rb +35 -0
  20. data/lib/generators/rolemodel/turbo/form/README.md +8 -0
  21. data/lib/generators/rolemodel/turbo/form/USAGE +5 -0
  22. data/lib/generators/rolemodel/turbo/form/form_generator.rb +29 -0
  23. data/lib/generators/rolemodel/turbo/form/templates/app/javascript/controllers/turbo_form_controller.js +15 -0
  24. data/lib/generators/rolemodel/turbo/form/templates/spec/support/helpers/turbo_form_helper.rb +8 -0
  25. data/lib/generators/rolemodel/{ui_components → turbo}/modals/README.md +0 -2
  26. data/lib/generators/rolemodel/turbo/modals/USAGE +5 -0
  27. data/lib/generators/rolemodel/{ui_components → turbo}/modals/modals_generator.rb +9 -23
  28. data/lib/generators/rolemodel/turbo/ready/README.md +12 -0
  29. data/lib/generators/rolemodel/turbo/ready/USAGE +5 -0
  30. data/lib/generators/rolemodel/turbo/ready/ready_generator.rb +48 -0
  31. data/lib/generators/rolemodel/turbo/ready/templates/app/javascript/controllers/prevent_morph_controller.js +22 -0
  32. data/lib/generators/rolemodel/ui_components/navbar/navbar_generator.rb +10 -14
  33. data/lib/generators/rolemodel/webpack/templates/postcss.config.cjs +0 -3
  34. data/lib/generators/rolemodel/webpack/templates/webpack.config.js +4 -2
  35. data/lib/generators/rolemodel/webpack/webpack_generator.rb +12 -20
  36. data/lib/rolemodel/generator_base.rb +10 -32
  37. data/lib/rolemodel/version.rb +1 -1
  38. data/lib/rolemodel/yarn.rb +42 -0
  39. data/lib/rolemodel-rails.rb +0 -2
  40. metadata +46 -17
  41. data/lib/generators/rolemodel/ui_components/modals/USAGE +0 -8
  42. data/lib/generators/rolemodel/ui_components/modals/templates/app/javascript/controllers/morph_controller.js +0 -23
  43. data/lib/generators/rolemodel/webpack/templates/app/assets/stylesheets/application.scss +0 -5
  44. /data/lib/generators/rolemodel/{ui_components/modals/templates/app/javascript/initializers/turbo_confirm.js → turbo/confirm/templates/app/javascript/initializers/turbo_confirm.js.tt} +0 -0
  45. /data/lib/generators/rolemodel/{ui_components/modals/templates/app/views/application/_confirm.html.slim → turbo/confirm/templates/app/views/application/_confirm.html.slim.tt} +0 -0
  46. /data/lib/generators/rolemodel/{ui_components → turbo}/modals/templates/app/helpers/turbo_frame_link_helper.rb +0 -0
  47. /data/lib/generators/rolemodel/{ui_components → turbo}/modals/templates/app/javascript/controllers/toggle_controller.js +0 -0
  48. /data/lib/generators/rolemodel/{ui_components → turbo}/modals/templates/app/javascript/initializers/frame_missing_handler.js +0 -0
  49. /data/lib/generators/rolemodel/{ui_components → turbo}/modals/templates/app/views/layouts/modal.html.slim.tt +0 -0
  50. /data/lib/generators/rolemodel/{ui_components → turbo}/modals/templates/app/views/layouts/panel.html.slim.tt +0 -0
  51. /data/lib/generators/rolemodel/{ui_components/modals → turbo/ready}/templates/app/javascript/initializers/before_morph_handler.js +0 -0
  52. /data/lib/generators/rolemodel/ui_components/navbar/templates/app/assets/stylesheets/components/shoelace/{index.scss → index.css} +0 -0
  53. /data/lib/generators/rolemodel/ui_components/navbar/templates/app/views/{layouts → application}/_navbar.html.slim +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1cf52276aac5192b4349379e6f7792232fbdabae218e3d3ac6fbde81cd1ae01
4
- data.tar.gz: 3d13d291529c487fb93b8d7c7816acb05e3b686fd4129173208611c0c714558d
3
+ metadata.gz: 6f574ec1763415cfd5d59b0c42e27e04cf7a105639d736dec4b73f331212014b
4
+ data.tar.gz: f558030f6438ecc3703ddc58d51ef2fc29932e022ba3e732fffad2e58bdd3653
5
5
  SHA512:
6
- metadata.gz: 2fdd780f5256aac4772e65e9282569956b2b7e8a2fd663caa068d072a720a7905a721953725df5ccf07d671f600e31d7ec781831782128b63182b8cf586af61b
7
- data.tar.gz: 453e93d083a80ff9ce7a2b2ea1f02079e334e2a4ae5028ee91d7b67d0c6cb7d7d8f013e9bab777a9da2f77b767f354af38688a2ac101ba8e94dd28c5979e22ee
6
+ metadata.gz: 443ef8cc4397434dbccc3fba921dd5bd7e319ef9c92d5cb7e34b29b8dfb3537551d7b39428d07d4baa045b4caa9750cf8cd723d081ab314da3fb771795be661b
7
+ data.tar.gz: 75c1c5ed618b05e5656f87fd7af488707af8c184a97f71e1142019347e56b77c70e31c1175b321003c3ab4c05b9839c76228b7d02faa4781f6032b39bf8fdd51
data/README.md CHANGED
@@ -47,12 +47,6 @@ baseline so the app is ready to push straight to Heroku)
47
47
  bin/rails g rolemodel:core_setup
48
48
  ```
49
49
 
50
- Or run every generator, including app-specific extras like React, SaaS/Devise, and GoodJob
51
-
52
- ```shell
53
- bin/rails g rolemodel:all
54
- ```
55
-
56
50
  Or run a single generator
57
51
 
58
52
  ```shell
@@ -84,6 +78,11 @@ bin/rails g
84
78
  * [Optics](./lib/generators/rolemodel/optics)
85
79
  * [Base](./lib/generators/rolemodel/optics/base)
86
80
  * [Icons](./lib/generators/rolemodel/optics/icons)
81
+ * [Turbo](./lib/generators/rolemodel/turbo)
82
+ * [Ready](./lib/generators/rolemodel/turbo/ready)
83
+ * [Confirm](./lib/generators/rolemodel/turbo/confirm)
84
+ * [Modals](./lib/generators/rolemodel/turbo/modals)
85
+ * [Form](./lib/generators/rolemodel/turbo/form)
87
86
  * [Testing](./lib/generators/rolemodel/testing)
88
87
  * [RSpec](./lib/generators/rolemodel/testing/rspec)
89
88
  * [Jasmine Playwright](./lib/generators/rolemodel/testing/jasmine_playwright)
@@ -101,7 +100,6 @@ bin/rails g
101
100
  * [ESLint](./lib/generators/rolemodel/linters/eslint)
102
101
  * [UI Components](./lib/generators/rolemodel/ui_components)
103
102
  * [Flash](./lib/generators/rolemodel/ui_components/flash)
104
- * [Modals](./lib/generators/rolemodel/ui_components/modals)
105
103
  * [Navbar](./lib/generators/rolemodel/ui_components/navbar)
106
104
  * [Source Map](./lib/generators/rolemodel/source_map)
107
105
  * [Kaminari](./lib/generators/rolemodel/kaminari)
@@ -248,7 +246,7 @@ e.g.
248
246
 
249
247
  ```ruby
250
248
  RSpec.describe Rolemodel::MyGenerator, type: :generator do
251
- before { run_generator_against_test_app }
249
+ before { run_generators }
252
250
  end
253
251
  ```
254
252
 
@@ -258,19 +256,34 @@ e.g.
258
256
 
259
257
  ```ruby
260
258
  RSpec.describe Rolemodel::Testing::JasminePlaywrightGenerator, type: :generator do
261
- before { run_generator_against_test_app(['--github-package-token=123']) }
259
+ before { run_generators(['--github-package-token=123']) }
260
+ end
261
+ ```
262
+
263
+ If the generator you're testing depends on being run after another generator, you may pass an array to the optional `generators` keyword argument in the order in which they should run.
264
+
265
+ e.g.
266
+
267
+ ```ruby
268
+ RSpec.describe Rolemodel::MyGenerator, type: :generator do
269
+ before do
270
+ run_generators(generators: [::Rolemodel::PrereqGenerator, described_class])
271
+ end
262
272
  end
263
273
  ```
264
274
 
265
- If the generator you're testing depends on being run after another generator, you should run that one first.
275
+ If you're testing the standard output produced by your generator, assign the return value of `run_generators` to a variable.
266
276
 
267
277
  e.g.
268
278
 
269
279
  ```ruby
270
280
  RSpec.describe Rolemodel::MyGenerator, type: :generator do
271
281
  before do
272
- run_generator_against_test_app(generator: ::Rolemodel::PrereqGenerator)
273
- run_generator_against_test_app
282
+ @stdout = run_generators(generators: [::Rolemodel::PrereqGenerator, described_class])
283
+ end
284
+
285
+ it 'prints something useful' do
286
+ expect(@stdout[Rolemodel::MyGenerator]).to include('something useful')
274
287
  end
275
288
  end
276
289
  ```
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
@@ -1,18 +1,22 @@
1
1
  module Rolemodel
2
2
  class CoreSetupGenerator < ::Rolemodel::GeneratorBase
3
+ class_option :skip_deployable, type: :boolean, default: false, desc: 'skip generators for app deployment (Heroku, Sentry, Lograge)'
4
+
3
5
  def run_the_core_generators
4
- generate 'rolemodel:github'
5
- generate 'rolemodel:heroku'
6
- generate 'rolemodel:readme'
7
- generate 'rolemodel:webpack'
8
- generate 'rolemodel:sentry'
9
6
  generate 'rolemodel:slim'
7
+ generate 'rolemodel:webpack'
10
8
  generate 'rolemodel:optics:all'
11
- generate 'rolemodel:testing:all'
12
9
  generate 'rolemodel:simple_form'
13
- generate 'rolemodel:linters:all'
10
+ generate 'rolemodel:testing:all'
11
+ generate 'rolemodel:turbo:all'
14
12
  generate 'rolemodel:ui_components:flash'
15
- generate 'rolemodel:ui_components:modals'
13
+ generate 'rolemodel:github'
14
+ generate 'rolemodel:readme'
15
+ generate 'rolemodel:linters:all'
16
+ return if options.skip_deployable?
17
+
18
+ generate 'rolemodel:heroku'
19
+ generate 'rolemodel:sentry'
16
20
  generate 'rolemodel:lograge'
17
21
  end
18
22
  end
@@ -16,13 +16,11 @@ module Rolemodel
16
16
  def configure_good_job
17
17
  say 'Add GoodJob configuration'
18
18
 
19
- inject_into_file 'config/application.rb', after: "class Application < Rails::Application\n" do
20
- optimize_indentation <<~'RUBY', 4
21
- # Add GoodJob ActiveJob queue adapter
22
- config.active_job.queue_adapter = :good_job
19
+ inject_into_class 'config/application.rb', 'Application', optimize_indentation(<<~'RUBY', 4)
20
+ # Add GoodJob ActiveJob queue adapter
21
+ config.active_job.queue_adapter = :good_job
23
22
 
24
- RUBY
25
- end
23
+ RUBY
26
24
 
27
25
  gsub_file 'config/environments/production.rb', 'config.active_job.queue_adapter', '# config.active_job.queue_adapter'
28
26
  end
@@ -30,7 +28,7 @@ module Rolemodel
30
28
  def configure_good_job_routes
31
29
  say 'Add GoodJob routes'
32
30
 
33
- route_text = <<~RUBY
31
+ route <<~RUBY
34
32
  # Example but update per the authorization strategy of app
35
33
  namespace :admin do
36
34
  # authenticate :user, ->(user) { user.admin? } do
@@ -38,7 +36,6 @@ module Rolemodel
38
36
  # end
39
37
  end
40
38
  RUBY
41
- route route_text
42
39
  end
43
40
 
44
41
  def configure_procfile
@@ -58,12 +55,11 @@ module Rolemodel
58
55
  def copy_initializers
59
56
  say 'Add GoodJob initializers'
60
57
 
61
- copy_file 'config/initializers/active_job.rb'
62
- copy_file 'config/initializers/good_job.rb'
58
+ directory 'config/initializers'
63
59
  end
64
60
 
65
61
  def finishing_notes
66
- say <<~NOTES
62
+ say <<~NOTES, :green
67
63
  *** Reminder to also update your job classes to include appropriate concurrency controls (enqueue_limit/perform_limit with keys)
68
64
  NOTES
69
65
  end
@@ -27,21 +27,6 @@ module Rolemodel
27
27
  inject_into_file 'Gemfile', "\nruby file: '.ruby-version'\n", after: /^source .*$/
28
28
  end
29
29
 
30
- def use_database_url_in_production
31
- say 'Point the production database at DATABASE_URL for Heroku.', :green
32
-
33
- # Rails' generated production block hardcodes database/username/<APP>_DATABASE_PASSWORD,
34
- # none of which exist on Heroku, where the Postgres add-on provides a full DATABASE_URL.
35
- # Replace the whole block with a url-based config.
36
- gsub_file 'config/database.yml',
37
- /^production:\n(?:[ \t]+.*\n?)+/,
38
- <<~YAML
39
- production:
40
- <<: *default
41
- url: <%= ENV["DATABASE_URL"] %>
42
- YAML
43
- end
44
-
45
30
  def force_ssl
46
31
  say 'Require SSL for production environment.', :green
47
32
 
@@ -13,9 +13,9 @@ module Rolemodel
13
13
  def copy_templates
14
14
  say 'importing stylesheet', :green
15
15
 
16
- prepend_to_file Dir.glob('app/assets/stylesheets/application.*').first, <<~SCSS
16
+ prepend_to_file application_stylesheet_path, <<~CSS
17
17
  @import '@rolemodel/optics/dist/css/optics';
18
- SCSS
18
+ CSS
19
19
  end
20
20
  end
21
21
  end
@@ -161,11 +161,11 @@ module Rolemodel
161
161
  say 'importing login stylesheet', :green
162
162
  copy_file 'app/assets/stylesheets/login.css'
163
163
 
164
- return unless File.exist?(File.join(destination_root, 'app/assets/stylesheets/application.scss'))
164
+ return unless File.exist?(application_stylesheet_path)
165
165
 
166
- append_to_file 'app/assets/stylesheets/application.scss', <<~SCSS
166
+ append_to_file application_stylesheet_path, <<~CSS
167
167
  @import 'login';
168
- SCSS
168
+ CSS
169
169
  end
170
170
  end
171
171
  end
@@ -21,7 +21,7 @@ module Rolemodel
21
21
  # config/initializers/sentry.rb sets profiles_sample_rate; without stackprof
22
22
  # the SDK logs a warning on every boot and profiling is silently disabled.
23
23
  # stackprof is a native MRI extension, so restrict it to compatible platforms.
24
- gem 'stackprof', platforms: :ruby
24
+ bundle_command 'add stackprof --platform ruby'
25
25
  run_bundle
26
26
  end
27
27
 
@@ -34,22 +34,10 @@ module Rolemodel
34
34
  def add_user_context
35
35
  say 'Adding Sentry user context to ApplicationController', :green
36
36
 
37
- inject_into_class 'app/controllers/application_controller.rb', 'ApplicationController',
38
- " before_action :set_sentry_user\n"
39
-
40
- inject_into_file 'app/controllers/application_controller.rb', before: /^end\b/ do
41
- <<-RUBY
42
-
43
- private
44
-
45
- # Guarded so it works whether or not an authentication generator has been run.
46
- def set_sentry_user
47
- return unless respond_to?(:current_user) && current_user
37
+ directory 'app/controllers/concerns'
48
38
 
49
- Sentry.set_user(id: current_user.id)
50
- end
51
- RUBY
52
- end
39
+ inject_into_class 'app/controllers/application_controller.rb', 'ApplicationController',
40
+ " include SentryUser\n"
53
41
  end
54
42
 
55
43
  def add_js_dependencies
@@ -120,7 +108,7 @@ module Rolemodel
120
108
  private
121
109
 
122
110
  def sentry_app_name
123
- Rails.application.class.module_parent_name.underscore
111
+ Rails.application.name.underscore
124
112
  end
125
113
  end
126
114
  end
@@ -0,0 +1,13 @@
1
+ module SentryUser
2
+ extend ActiveSupport::Concern
3
+
4
+ included { before_action :set_sentry_user }
5
+
6
+ private
7
+
8
+ def set_sentry_user
9
+ return unless respond_to?(:current_user) && current_user
10
+
11
+ Sentry.set_user(id: current_user.id)
12
+ end
13
+ end
@@ -4,10 +4,6 @@ title <%= Rails.application.class.name.deconstantize.titleize %>
4
4
  = csp_meta_tag
5
5
 
6
6
  meta name="viewport" content="width=device-width, initial-scale=1"
7
- meta name="turbo-refresh-method" content="morph"
8
- meta name="turbo-refresh-scroll" content="preserve"
9
7
 
10
8
  = stylesheet_link_tag 'application', 'data-turbo-track': 'reload'
11
9
  = javascript_include_tag 'application', 'data-turbo-track': 'reload', defer: true
12
-
13
- = yield :head
@@ -10,26 +10,24 @@ module Rolemodel
10
10
  def install_rspec
11
11
  say 'Installing RSpec-rails', :green
12
12
 
13
- gem_group :development, :test do
14
- gem 'rspec-rails'
15
- end
13
+ bundle_command('add rspec-rails --group "development, test"')
14
+ end
16
15
 
16
+ def install_system_test_driver
17
17
  say 'Installing capybara-playwright-driver for system tests', :green
18
18
 
19
- gem_group :test do
20
- gem 'capybara-playwright-driver'
19
+ bundle_command('add capybara-playwright-driver --group "test"')
20
+ bundle_command('add marsh_grass --group "test"') if options.marsh_grass?
21
+ end
21
22
 
22
- if options.marsh_grass?
23
- gem 'marsh_grass'
24
- gem 'pry'
25
- end
26
- end
23
+ def bundle_install
27
24
  run_bundle
28
25
  end
29
26
 
30
27
  def install_playwright
31
28
  say 'Installing Playwright for system tests', :green
32
29
 
30
+ ensure_yarn
33
31
  run 'yarn add --dev playwright'
34
32
  run 'yarn run playwright install'
35
33
  end
@@ -16,6 +16,7 @@ module Rolemodel
16
16
 
17
17
  def update_test_script
18
18
  say 'Update yarn test command', :green
19
+ ensure_yarn
19
20
 
20
21
  add_package_json_script 'test', TEST_COMMAND
21
22
  end
@@ -23,7 +24,6 @@ module Rolemodel
23
24
  def add_dev_dependencies
24
25
  say 'Adding new dev dependency to package.json', :green
25
26
 
26
- ensure_yarn
27
27
  run "yarn add --dev #{DEV_DEPENDENCIES.join(' ')}"
28
28
  end
29
29
 
@@ -0,0 +1,16 @@
1
+ # All Generator
2
+
3
+ Runs all Turbo Generators
4
+
5
+ ## Prerequisites
6
+
7
+ - slim
8
+ - webpack (if using webpack)
9
+ - optics
10
+
11
+ ## What you get
12
+
13
+ - Turbo meta tags in HEAD
14
+ - TurboConfirm setup
15
+ - Turbo Frame Modals setup
16
+ - Turbo-Form stimulus controller
@@ -0,0 +1,5 @@
1
+ Description:
2
+ All Turbo Generators
3
+
4
+ Example:
5
+ rails generate rolemodel:turbo:all
@@ -0,0 +1,15 @@
1
+ module Rolemodel
2
+ module Turbo
3
+ class AllGenerator < ::Rolemodel::GeneratorBase
4
+ source_root File.expand_path('templates', __dir__)
5
+
6
+ def run_generators
7
+ generate 'rolemodel:turbo:ready'
8
+ generate 'rolemodel:turbo:confirm'
9
+ generate 'rolemodel:turbo:modals'
10
+ generate 'rolemodel:turbo:form'
11
+ end
12
+ end
13
+ end
14
+ end
15
+
@@ -0,0 +1,25 @@
1
+ # Confirm Generator
2
+
3
+ Add custom dialog support to `data-turbo-confirm`
4
+
5
+ ## Prerequisites
6
+
7
+ * `rolmodel:slim`
8
+ * `rolemodel:webpack`
9
+ * `rolemodel:optics:base`
10
+
11
+ ## What you get
12
+
13
+ * Custom confirm dialogs via `@rolemodel/turbo-confirm` integration
14
+
15
+ ## Example
16
+
17
+ ```slim
18
+ = button_to "Test Confirm", model, method: :delete, data: { \
19
+ turbo_confirm: "For real?!?",
20
+ confirm_details: "You're about to delete #{model.name}, forever. 😱",
21
+ confirm_button: "YOLO!",
22
+ }
23
+ ```
24
+
25
+ data attributes other than `turbo-confirm` are optional & customizable. See [turbo-confirm](https://github.com/RoleModel/turbo-confirm) for more details.
@@ -0,0 +1,5 @@
1
+ Description:
2
+ Install @rolemodel/turbo-confirm
3
+
4
+ Example:
5
+ rails generate rolemodel:turbo:confirm
@@ -0,0 +1,35 @@
1
+ module Rolemodel
2
+ module Turbo
3
+ class ConfirmGenerator < ::Rolemodel::GeneratorBase
4
+ source_root File.expand_path('templates', __dir__)
5
+
6
+ def add_turbo_confirm_package
7
+ say 'Installing Turbo Confirm package', :green
8
+
9
+ ensure_yarn
10
+ run 'yarn add @rolemodel/turbo-confirm'
11
+ end
12
+
13
+ def add_initializer
14
+ template 'app/javascript/initializers/turbo_confirm.js'
15
+
16
+ append_to_file 'app/javascript/application.js' do
17
+ optimize_indentation <<~JS
18
+ import './initializers/turbo_confirm.js'
19
+ JS
20
+ end
21
+ end
22
+
23
+ def add_view_partial
24
+ template 'app/views/application/_confirm.html.slim'
25
+
26
+ inject_into_file 'app/views/layouts/application.html.slim', after: /\bbody.*\n/ do
27
+ optimize_indentation <<~SLIM, 4
28
+ = render 'confirm'
29
+ SLIM
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+
@@ -0,0 +1,8 @@
1
+ # Form Generator
2
+
3
+ Enable the "turbo-fetch" (now Turbo-Form) pattern in new/existing rails apps.
4
+
5
+ ## What you get
6
+
7
+ - turbo-form controller
8
+ - system spec helper
@@ -0,0 +1,5 @@
1
+ Description:
2
+ Enable Dynamic Form Interactions
3
+
4
+ Example:
5
+ rails generate rolemodel:turbo:form
@@ -0,0 +1,29 @@
1
+ module Rolemodel
2
+ module Turbo
3
+ class FormGenerator < GeneratorBase
4
+ source_root File.expand_path('templates', __dir__)
5
+
6
+ def add_rails_request_package
7
+ say 'Installing @rails/request.js package', :green
8
+
9
+ ensure_yarn
10
+ run 'yarn add @rails/request.js'
11
+ end
12
+
13
+ def add_stimulus_controller
14
+ say 'Adding Turbo Form Stimulus Controller', :green
15
+
16
+ directory 'app/javascript/controllers'
17
+
18
+ rails_command 'stimulus:manifest:update'
19
+ end
20
+
21
+ def add_system_spec_helper
22
+ say 'Adding Turbo Form System Spec Helper', :green
23
+
24
+ directory 'spec/support/helpers'
25
+ end
26
+ end
27
+ end
28
+ end
29
+
@@ -0,0 +1,15 @@
1
+ import { Controller } from '@hotwired/stimulus'
2
+ import { patch } from '@rails/request.js'
3
+
4
+ export default class extends Controller {
5
+ static values = { url: String, count: Number }
6
+
7
+ async perform({ params: { url: urlParam, query: queryParams } }) {
8
+ const body = new FormData(this.element)
9
+
10
+ if (queryParams) Object.keys(queryParams).forEach(key => body.append(key, queryParams[key]))
11
+
12
+ const response = await patch(urlParam || this.urlValue, { body, responseKind: 'turbo-stream' })
13
+ if (response.ok) this.countValue += 1
14
+ }
15
+ }
@@ -0,0 +1,8 @@
1
+ module TurboFormHelper
2
+ def expect_turbo_form_request
3
+ count_value = find("[data-controller='turbo-form']")['data-turbo-form-count-value'] || 0
4
+ yield
5
+ expect(page).to have_selector("[data-turbo-form-count-value='#{count_value.to_i + 1}']"),
6
+ 'Expected a successful Turbo-Form request, but none was detected'
7
+ end
8
+ end
@@ -9,10 +9,8 @@
9
9
 
10
10
  ## What you get
11
11
 
12
- * Custom confirm dialogs via `@rolemodel/turbo-confirm` integration
13
12
  * RoleModel Modal pattern integration. See Notes below for usage documentation.
14
13
  * RoleModel Panel pattern integration, if run with the `--panels` flag.
15
- * some generally useful, global Turbo before-morph handlers.
16
14
 
17
15
  > [!IMPORTANT]
18
16
  > This generator does not provide RoleModel Panel integration, unless run with the `--panels` flag.
@@ -0,0 +1,5 @@
1
+ Description:
2
+ Enable Turbo Frame Modals/Panels Pattern
3
+
4
+ Example:
5
+ rails generate rolemodel:turbo:modals
@@ -1,22 +1,13 @@
1
1
  module Rolemodel
2
- module UiComponents
3
- class ModalsGenerator < GeneratorBase
2
+ module Turbo
3
+ class ModalsGenerator < ::Rolemodel::GeneratorBase
4
4
  source_root File.expand_path('templates', __dir__)
5
5
  class_option :panels, type: :boolean, default: false, desc: 'Include RoleModel Panel Setup'
6
6
 
7
- def turbo_confirm
8
- say 'Installing Turbo Confirm package', :green
9
-
10
- ensure_yarn
11
- run 'yarn add @rolemodel/turbo-confirm'
12
- end
13
-
14
7
  def helpers_and_views
15
8
  say 'generating views & helpers', :green
16
9
 
17
- copy_file 'app/helpers/turbo_frame_link_helper.rb'
18
-
19
- directory 'app/views/application'
10
+ directory 'app/helpers'
20
11
  directory 'app/views/layouts'
21
12
  end
22
13
 
@@ -27,9 +18,7 @@ module Rolemodel
27
18
  directory 'app/javascript/initializers'
28
19
 
29
20
  append_to_file 'app/javascript/application.js', <<~JS
30
- import './initializers/turbo_confirm.js'
31
21
  import './initializers/frame_missing_handler.js'
32
- import './initializers/before_morph_handler.js'
33
22
  JS
34
23
  end
35
24
 
@@ -39,7 +28,6 @@ module Rolemodel
39
28
  inject_into_file 'app/views/layouts/application.html.slim', after: /\bbody.*\n/ do
40
29
  optimize_indentation <<~SLIM, 4
41
30
  = turbo_frame_tag 'modal'
42
- = render 'confirm'
43
31
  SLIM
44
32
  end
45
33
  end
@@ -48,18 +36,15 @@ module Rolemodel
48
36
  if options.panels?
49
37
  say 'Setting Up RoleModel Panel', :green
50
38
 
51
- inject_into_file 'app/views/layouts/application.html.slim', after: /\bturbo_frame_tag 'modal'\n/ do
39
+ inject_into_file 'app/views/layouts/application.html.slim', after: /\bturbo_frame_tag 'modal'.*\n/ do
52
40
  optimize_indentation <<~SLIM, 4
53
41
  = turbo_frame_tag 'panel'
54
42
  SLIM
55
43
  end
56
44
 
57
- inject_into_file 'app/assets/stylesheets/application.scss',
58
- after: "@import '@rolemodel/optics/dist/css/optics';\n" do
59
- <<~SCSS
60
- @import '@rolemodel/optics/dist/css/addons/panel';
61
- SCSS
62
- end
45
+ append_to_file application_stylesheet_path, <<~CSS
46
+ @import '@rolemodel/optics/dist/css/addons/panel';
47
+ CSS
63
48
  else
64
49
  remove_file 'app/views/layouts/panel.html.slim'
65
50
  end
@@ -68,8 +53,9 @@ module Rolemodel
68
53
  def register_stimulus_controller
69
54
  say 'updating stimulus manifest', :green
70
55
 
71
- run 'rails stimulus:manifest:update'
56
+ rails_command 'stimulus:manifest:update'
72
57
  end
73
58
  end
74
59
  end
75
60
  end
61
+
@@ -0,0 +1,12 @@
1
+ # Ready Generator
2
+
3
+ This generator is designed to make your application "Turbo Ready".
4
+
5
+ That is, "ready" for modern Turbo Features such as "morphing", "scroll preservation" and meta tag injection via Turbo-Rails helpers.
6
+
7
+ ## What you get
8
+
9
+ - a "head" outlet in your "head" partial (expected by all Turbo-Rails helpers)
10
+ - morphing and scroll preservation meta tags
11
+ - generally useful event handlers.
12
+ - a stimulus controller for skipping specific attribute morphing
@@ -0,0 +1,5 @@
1
+ Description:
2
+ Prepare your application for modern Turbo Integration
3
+
4
+ Example:
5
+ rails generate rolemodel:turbo:ready
@@ -0,0 +1,48 @@
1
+ module Rolemodel
2
+ module Turbo
3
+ class ReadyGenerator < ::Rolemodel::GeneratorBase
4
+ source_root File.expand_path('templates', __dir__)
5
+
6
+ def add_javascript_initializer
7
+ say 'generating & importing morph event handlers', :green
8
+
9
+ directory 'app/javascript/initializers'
10
+
11
+ append_to_file 'app/javascript/application.js', <<~JS
12
+ import './initializers/before_morph_handler.js'
13
+ JS
14
+ end
15
+
16
+ def add_stimulus_controller
17
+ say 'adding prevent-morph controller & updating manifest', :green
18
+
19
+ directory 'app/javascript/controllers'
20
+
21
+ rails_command 'stimulus:manifest:update'
22
+ end
23
+
24
+ def inject_meta_tags
25
+ say 'adding meta tags to head partial', :green
26
+
27
+ inject_into_file 'app/views/application/_head.html.slim', after: /meta name="viewport".*\n/ do
28
+ optimize_indentation <<~SLIM
29
+ meta name="turbo-refresh-method" content="morph"
30
+ meta name="turbo-refresh-scroll" content="preserve"
31
+ SLIM
32
+ end
33
+ end
34
+
35
+ def inject_head_outlet
36
+ say 'adding head outlet to head partial', :green
37
+
38
+ append_to_file 'app/views/application/_head.html.slim' do
39
+ optimize_indentation <<~SLIM
40
+
41
+ = yield :head
42
+ SLIM
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+
@@ -0,0 +1,22 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ static values = {
5
+ attributeName: String
6
+ }
7
+
8
+ /**
9
+ * Use this method to prevent morphing of a specific attribute on specific elements. This is useful for attributes that may have changed due to user interaction
10
+ * NOTE: The "open" attribute is preserved by default in 'app/javascript/initializers/before_morph_handler.js' and does not require this controller to be used.
11
+ *
12
+ * Example:
13
+ * <details controller="prevent-morph" data-prevent-morph-attribute-name-value="open" data-action="turbo:before-morph-attribute->prevent-morph#onNamedAttribute">
14
+ *
15
+ * @param {import("@hotwired/turbo").TurboBeforeMorphAttributeEvent} event
16
+ */
17
+ onNamedAttribute(event) {
18
+ if (event.detail.attributeName === this.attributeNameValue) {
19
+ event.preventDefault()
20
+ }
21
+ }
22
+ }
@@ -8,7 +8,7 @@ module Rolemodel
8
8
  def copy_navbar_files
9
9
  say 'Copying Navbar files', :green
10
10
 
11
- copy_file 'app/views/layouts/_navbar.html.slim'
11
+ directory 'app/views'
12
12
  end
13
13
 
14
14
  def insert_navbar_before_content
@@ -17,7 +17,7 @@ module Rolemodel
17
17
  insert_into_file 'app/views/layouts/application.html.slim', before: /\s+\.app__content/ do
18
18
  optimize_indentation <<~SLIM, 4
19
19
 
20
- = render 'layouts/navbar'
20
+ = render 'navbar'
21
21
  SLIM
22
22
  end
23
23
  end
@@ -32,23 +32,19 @@ module Rolemodel
32
32
  def add_shoelace_javascript_imports
33
33
  say 'Copying Shoelace JS imports', :green
34
34
 
35
- copy_file 'app/javascript/lib/shoelace.js'
36
- append_to_file 'app/javascript/application.js' do
37
- <<~JS
38
- import './lib/shoelace.js'
39
- JS
40
- end
35
+ directory 'app/javascript/lib'
36
+ append_to_file 'app/javascript/application.js', <<~JS
37
+ import './lib/shoelace.js'
38
+ JS
41
39
  end
42
40
 
43
41
  def copy_shoelace_css_imports
44
42
  say 'Copying Shoelace CSS imports', :green
45
43
 
46
- copy_file 'app/assets/stylesheets/components/shoelace/index.scss'
47
- append_to_file 'app/assets/stylesheets/application.scss' do
48
- <<~SCSS
49
- @import 'components/shoelace/index.scss';
50
- SCSS
51
- end
44
+ copy_file 'app/assets/stylesheets/components/shoelace/index.css'
45
+ append_to_file application_stylesheet_path, <<~CSS
46
+ @import 'components/shoelace/index.css';
47
+ CSS
52
48
  end
53
49
  end
54
50
  end
@@ -1,9 +1,6 @@
1
1
  module.exports = {
2
2
  syntax: require('postcss-scss'),
3
3
  plugins: [
4
- require('@csstools/postcss-sass')({
5
- includePaths: ['node_modules']
6
- }),
7
4
  require('postcss-preset-env')({
8
5
  autoprefixer: {
9
6
  flexbox: 'no-2009'
@@ -15,7 +15,7 @@ export default {
15
15
  entry: {
16
16
  application: [
17
17
  './app/javascript/application.js',
18
- './app/assets/stylesheets/application.scss'
18
+ './app/assets/stylesheets/application.css'
19
19
  ]
20
20
  },
21
21
  output: {
@@ -60,9 +60,11 @@ export default {
60
60
  {
61
61
  loader: 'css-loader',
62
62
  options: {
63
- url: false
63
+ url: false,
64
+ importLoaders: 1
64
65
  }
65
66
  },
67
+ 'strip-sourcemap-loader',
66
68
  'postcss-loader'
67
69
  ]
68
70
  }
@@ -2,9 +2,6 @@ module Rolemodel
2
2
  class WebpackGenerator < GeneratorBase
3
3
  source_root File.expand_path('templates', __dir__)
4
4
 
5
- class_option :sentry, type: :boolean, default: false,
6
- desc: 'Also run the rolemodel:sentry generator'
7
-
8
5
  DEV_DEPS = %w[
9
6
  esbuild
10
7
  esbuild-loader
@@ -26,6 +23,18 @@ module Rolemodel
26
23
  mini-css-extract-plugin
27
24
  ]
28
25
 
26
+ def ensure_no_importmap
27
+ return unless Rails.root.join(destination_root, 'config/importmap.rb').exist?
28
+
29
+ remove_file 'config/importmap.rb'
30
+ bundle_command 'remove importmap-rails'
31
+ end
32
+
33
+ def ensure_jsbundling
34
+ bundle_command 'add jsbundling-rails'
35
+ run_bundle
36
+ end
37
+
29
38
  def ensure_node_version
30
39
  say "Establish development environment Node version of #{set_color(NODE_VERSION, :yellow)}", :green
31
40
 
@@ -57,28 +66,11 @@ module Rolemodel
57
66
  run "yarn add --dev #{dependencies.join(' ')}"
58
67
  end
59
68
 
60
- def replace_css_entrypoint_with_scss
61
- say 'Replacing CSS entrypoint file with SCSS version', :green
62
-
63
- remove_file 'app/assets/stylesheets/application.css'
64
- copy_file 'app/assets/stylesheets/application.scss'
65
- end
66
-
67
69
  def add_webpack_config
68
70
  say 'Copying PostCSS & Webpack config files', :green
69
71
 
70
72
  copy_file 'postcss.config.cjs', force: true
71
73
  copy_file 'webpack.config.js', force: true
72
74
  end
73
-
74
- # All Sentry concerns (including wiring its plugin into webpack.config.js)
75
- # live in the Sentry generator; this option is a convenience for setting up
76
- # both in one run. Runs last so webpack.config.js exists before the Sentry
77
- # generator injects into it.
78
- def run_sentry_generator
79
- return unless options.sentry?
80
-
81
- generate 'rolemodel:sentry'
82
- end
83
75
  end
84
76
  end
@@ -3,52 +3,30 @@
3
3
  require 'rails/generators'
4
4
  require 'rails/generators/bundle_helper'
5
5
  require_relative 'replace_content_helper'
6
+ require 'rolemodel/yarn'
6
7
 
7
8
  module Rolemodel
8
9
  class GeneratorBase < ::Rails::Generators::Base
9
10
  include ::Rails::Generators::BundleHelper, ReplaceContentHelper
10
11
 
12
+
11
13
  private
12
14
  # based on https://github.com/rails/rails/blob/main/railties/lib/rails/generators/app_base.rb#L713
13
15
  def run_bundle
14
16
  bundle_command("install --quiet", "BUNDLE_IGNORE_MESSAGES" => "1")
15
17
  end
16
18
 
17
- # Enable Corepack and pin the project to Yarn 4+ (instead of the classic
18
- # Yarn 1.22). Idempotent, so any generator can call it before running a
19
- # `yarn` command to guarantee the modern toolchain is in place.
19
+ # Enable Corepack and pin the project to Yarn 4+ before running any `yarn`
20
+ # command. Empty args/opts are required: without them, Thor forwards this
21
+ # generator's own CLI args (e.g. the test harness's --skip-bundle
22
+ # --skip-bootsnap) into Rolemodel::Yarn#setup, which takes none and raises
23
+ # Thor::InvocationError.
20
24
  def ensure_yarn
21
- return if @yarn_ensured
22
-
23
- run 'corepack enable'
24
-
25
- unless File.exist?(File.expand_path('package.json', destination_root))
26
- create_file 'package.json', JSON.pretty_generate({}) + "\n"
27
- end
28
-
29
- # Configure the node-modules linker so webpack, Playwright, and the Rails
30
- # asset pipeline keep working (Yarn 4 defaults to Plug'n'Play otherwise).
31
- create_file '.yarnrc.yml', "nodeLinker: node-modules\n", force: true
32
-
33
- pin_yarn_version
34
- ignore_yarn_install_state
35
-
36
- @yarn_ensured = true
37
- end
38
-
39
- def pin_yarn_version
40
- modify_json_file('package.json') do |hash|
41
- hash['packageManager'] = "yarn@#{YARN_VERSION}"
42
- hash
43
- end
25
+ invoke 'rolemodel:yarn:setup', [], {}
44
26
  end
45
27
 
46
- def ignore_yarn_install_state
47
- gitignore = File.expand_path('.gitignore', destination_root)
48
- return create_file '.gitignore', "/.yarn/install-state.gz\n" unless File.exist?(gitignore)
49
- return if File.read(gitignore).include?('/.yarn/install-state.gz')
50
-
51
- append_to_file '.gitignore', "\n/.yarn/install-state.gz\n"
28
+ def application_stylesheet_path
29
+ Dir.glob('app/assets/stylesheets/application.*').first
52
30
  end
53
31
  end
54
32
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rolemodel
4
- VERSION = '2.2.0'
4
+ VERSION = '2.3.0'
5
5
  end
@@ -0,0 +1,42 @@
1
+ require 'thor'
2
+ require 'thor/actions'
3
+
4
+ module Rolemodel
5
+ class Yarn < ::Thor
6
+ include ::Thor::Actions
7
+
8
+ # Enable Corepack and pin the project to Yarn 4+ (instead of the classic
9
+ # Yarn 1.22). Idempotent, so any generator can call it before running a
10
+ # `yarn` command to guarantee the modern toolchain is in place.
11
+ desc 'setup', 'Set the current stable version of Yarn, enable corepack, and initialize a package.json file'
12
+ def setup
13
+ # Configure the node-modules linker so webpack, Playwright, and the Rails
14
+ # asset pipeline keep working (Yarn 4 defaults to Plug'n'Play otherwise).
15
+ # skip if exists? to avoid overwriting any other existing config
16
+ create_file '.yarnrc.yml', "nodeLinker: node-modules\n", skip: true
17
+
18
+ yes! 'yarn set version stable'
19
+ yes! 'corepack enable'
20
+ yes! 'yarn init'
21
+
22
+ ignore_yarn_install_state
23
+ end
24
+
25
+ private
26
+
27
+ def ignore_yarn_install_state
28
+ gitignore = File.expand_path('.gitignore', destination_root)
29
+ return create_file '.gitignore', "/.yarn/install-state.gz\n" unless File.exist?(gitignore)
30
+ return if File.read(gitignore).include?('/.yarn/install-state.gz')
31
+
32
+ append_to_file '.gitignore', "\n/.yarn/install-state.gz\n"
33
+ end
34
+
35
+ def yes!(command)
36
+ Open3.popen3(command) do |stdin, stdout, stderr, wait_thr|
37
+ stdin.puts 'y'
38
+ stdin.close
39
+ end
40
+ end
41
+ end
42
+ end
@@ -2,8 +2,6 @@
2
2
 
3
3
  module Rolemodel
4
4
  NODE_VERSION = '24.12.0'
5
- YARN_VERSION = '4.13.0'
6
- RUBY_VERSION = '4.0.1'
7
5
 
8
6
  GEM_LIB = File.expand_path(__dir__)
9
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rolemodel-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - RoleModel Software Inc
@@ -135,6 +135,20 @@ dependencies:
135
135
  - - ">="
136
136
  - !ruby/object:Gem::Version
137
137
  version: '0'
138
+ - !ruby/object:Gem::Dependency
139
+ name: rubocop-rails-omakase
140
+ requirement: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ type: :development
146
+ prerelease: false
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
138
152
  - !ruby/object:Gem::Dependency
139
153
  name: benchmark
140
154
  requirement: !ruby/object:Gem::Requirement
@@ -289,6 +303,7 @@ files:
289
303
  - lib/generators/rolemodel/sentry/README.md
290
304
  - lib/generators/rolemodel/sentry/USAGE
291
305
  - lib/generators/rolemodel/sentry/sentry_generator.rb
306
+ - lib/generators/rolemodel/sentry/templates/app/controllers/concerns/sentry_user.rb
292
307
  - lib/generators/rolemodel/sentry/templates/app/javascript/initializers/sentry.js
293
308
  - lib/generators/rolemodel/sentry/templates/config/initializers/sentry.rb
294
309
  - lib/generators/rolemodel/simple_form/README.md
@@ -364,6 +379,32 @@ files:
364
379
  - lib/generators/rolemodel/testing/vitest/templates/spec/javascript/test-setup.js
365
380
  - lib/generators/rolemodel/testing/vitest/templates/vitest.config.js
366
381
  - lib/generators/rolemodel/testing/vitest/vitest_generator.rb
382
+ - lib/generators/rolemodel/turbo/all/README.md
383
+ - lib/generators/rolemodel/turbo/all/USAGE
384
+ - lib/generators/rolemodel/turbo/all/all_generator.rb
385
+ - lib/generators/rolemodel/turbo/confirm/README.md
386
+ - lib/generators/rolemodel/turbo/confirm/USAGE
387
+ - lib/generators/rolemodel/turbo/confirm/confirm_generator.rb
388
+ - lib/generators/rolemodel/turbo/confirm/templates/app/javascript/initializers/turbo_confirm.js.tt
389
+ - lib/generators/rolemodel/turbo/confirm/templates/app/views/application/_confirm.html.slim.tt
390
+ - lib/generators/rolemodel/turbo/form/README.md
391
+ - lib/generators/rolemodel/turbo/form/USAGE
392
+ - lib/generators/rolemodel/turbo/form/form_generator.rb
393
+ - lib/generators/rolemodel/turbo/form/templates/app/javascript/controllers/turbo_form_controller.js
394
+ - lib/generators/rolemodel/turbo/form/templates/spec/support/helpers/turbo_form_helper.rb
395
+ - lib/generators/rolemodel/turbo/modals/README.md
396
+ - lib/generators/rolemodel/turbo/modals/USAGE
397
+ - lib/generators/rolemodel/turbo/modals/modals_generator.rb
398
+ - lib/generators/rolemodel/turbo/modals/templates/app/helpers/turbo_frame_link_helper.rb
399
+ - lib/generators/rolemodel/turbo/modals/templates/app/javascript/controllers/toggle_controller.js
400
+ - lib/generators/rolemodel/turbo/modals/templates/app/javascript/initializers/frame_missing_handler.js
401
+ - lib/generators/rolemodel/turbo/modals/templates/app/views/layouts/modal.html.slim.tt
402
+ - lib/generators/rolemodel/turbo/modals/templates/app/views/layouts/panel.html.slim.tt
403
+ - lib/generators/rolemodel/turbo/ready/README.md
404
+ - lib/generators/rolemodel/turbo/ready/USAGE
405
+ - lib/generators/rolemodel/turbo/ready/ready_generator.rb
406
+ - lib/generators/rolemodel/turbo/ready/templates/app/javascript/controllers/prevent_morph_controller.js
407
+ - lib/generators/rolemodel/turbo/ready/templates/app/javascript/initializers/before_morph_handler.js
367
408
  - lib/generators/rolemodel/ui_components/README.md
368
409
  - lib/generators/rolemodel/ui_components/USAGE
369
410
  - lib/generators/rolemodel/ui_components/all_generator.rb
@@ -372,27 +413,14 @@ files:
372
413
  - lib/generators/rolemodel/ui_components/flash/flash_generator.rb
373
414
  - lib/generators/rolemodel/ui_components/flash/templates/app/views/application/_flash.html.slim
374
415
  - lib/generators/rolemodel/ui_components/flash/templates/spec/support/matchers/flash_matchers.rb
375
- - lib/generators/rolemodel/ui_components/modals/README.md
376
- - lib/generators/rolemodel/ui_components/modals/USAGE
377
- - lib/generators/rolemodel/ui_components/modals/modals_generator.rb
378
- - lib/generators/rolemodel/ui_components/modals/templates/app/helpers/turbo_frame_link_helper.rb
379
- - lib/generators/rolemodel/ui_components/modals/templates/app/javascript/controllers/morph_controller.js
380
- - lib/generators/rolemodel/ui_components/modals/templates/app/javascript/controllers/toggle_controller.js
381
- - lib/generators/rolemodel/ui_components/modals/templates/app/javascript/initializers/before_morph_handler.js
382
- - lib/generators/rolemodel/ui_components/modals/templates/app/javascript/initializers/frame_missing_handler.js
383
- - lib/generators/rolemodel/ui_components/modals/templates/app/javascript/initializers/turbo_confirm.js
384
- - lib/generators/rolemodel/ui_components/modals/templates/app/views/application/_confirm.html.slim
385
- - lib/generators/rolemodel/ui_components/modals/templates/app/views/layouts/modal.html.slim.tt
386
- - lib/generators/rolemodel/ui_components/modals/templates/app/views/layouts/panel.html.slim.tt
387
416
  - lib/generators/rolemodel/ui_components/navbar/README.md
388
417
  - lib/generators/rolemodel/ui_components/navbar/USAGE
389
418
  - lib/generators/rolemodel/ui_components/navbar/navbar_generator.rb
390
- - lib/generators/rolemodel/ui_components/navbar/templates/app/assets/stylesheets/components/shoelace/index.scss
419
+ - lib/generators/rolemodel/ui_components/navbar/templates/app/assets/stylesheets/components/shoelace/index.css
391
420
  - lib/generators/rolemodel/ui_components/navbar/templates/app/javascript/lib/shoelace.js
392
- - lib/generators/rolemodel/ui_components/navbar/templates/app/views/layouts/_navbar.html.slim
421
+ - lib/generators/rolemodel/ui_components/navbar/templates/app/views/application/_navbar.html.slim
393
422
  - lib/generators/rolemodel/webpack/README.md
394
423
  - lib/generators/rolemodel/webpack/USAGE
395
- - lib/generators/rolemodel/webpack/templates/app/assets/stylesheets/application.scss
396
424
  - lib/generators/rolemodel/webpack/templates/postcss.config.cjs
397
425
  - lib/generators/rolemodel/webpack/templates/webpack.config.js
398
426
  - lib/generators/rolemodel/webpack/webpack_generator.rb
@@ -411,6 +439,7 @@ files:
411
439
  - lib/rolemodel/utility.rb
412
440
  - lib/rolemodel/utility/task_tools.rb
413
441
  - lib/rolemodel/version.rb
442
+ - lib/rolemodel/yarn.rb
414
443
  homepage: https://github.com/RoleModel/rolemodel_rails
415
444
  licenses:
416
445
  - MIT
@@ -429,7 +458,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
429
458
  - !ruby/object:Gem::Version
430
459
  version: '0'
431
460
  requirements: []
432
- rubygems_version: 4.0.6
461
+ rubygems_version: 4.0.3
433
462
  specification_version: 4
434
463
  summary: The RoleModel Way of building Rails apps.
435
464
  test_files: []
@@ -1,8 +0,0 @@
1
- Description:
2
- Add Modal, Panel, and Confirmation components
3
-
4
- Example:
5
- bin/rails generate rolemodel:ui_components:modals
6
-
7
- Example including RoleModel Panel Integration:
8
- bin/rails generate rolemodel:ui_components:modals --panels
@@ -1,23 +0,0 @@
1
- import { Controller } from "@hotwired/stimulus"
2
-
3
- export default class extends Controller {
4
- static values = {
5
- attributeName: String
6
- }
7
-
8
- /**
9
- * Use this method in conjunction with the turbo:before-morph-attribute event to prevent morphing of a specific
10
- * attribute on an element. This is useful for attributes that may change due to user interaction, such as the "open"
11
- * attribute on a details element, which can be toggled by the user and should not be overridden by Turbo's morphing process.
12
- *
13
- * Example:
14
- * <details controller="morph" data-morph-attribute-name-value="open" data-action="turbo:before-morph-attribute->morph#skipMorphAttribute">
15
- *
16
- * @param {import("@hotwired/turbo").TurboBeforeMorphAttributeEvent} event
17
- */
18
- skipMorphAttribute(event) {
19
- if (event.detail.attributeName === this.attributeNameValue) {
20
- event.preventDefault()
21
- }
22
- }
23
- }
@@ -1,5 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.css, which will include
2
- // all the files listed below.
3
- //
4
- // For example:
5
- // @import 'components/modal';