good_job 3.12.6 → 3.12.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c529a4f3811213bcf4d534c3fc5c096cac64b944db891eedadd5b553ea77aae3
4
- data.tar.gz: fc88a86278de2dd445e463a84f8a1934bc281c976dc585c7db549e5c57ff97ba
3
+ metadata.gz: 24b3e7de3de7bb0365a230607a0f1f566d431adcd508ce7ee23406164c6528bc
4
+ data.tar.gz: cd84291baf21cbaabbc543510851481ee835278bd1e844380be99fff749e0702
5
5
  SHA512:
6
- metadata.gz: d5b076dccfa450de8256870ba502c1f65f8c84fcdd9921772176afe04f1ccc57bd65fd215d46cb6a6c3be8c32570d9e271cbd45b73abdc247c64ef593edab64d
7
- data.tar.gz: c243bf54c98d38fe92fa62f104074582968dc757e65f3df611877307b2068d0126d837450745da60a20a80901b52a27af64302694e117c763d268fa3535ed6e5
6
+ metadata.gz: d79680539f1dfabf4076e313207a54b3f38370f31ca855fdc3cf5bfc20799dd2e6b2495274055a45027459f31439dd11677f270ef823ec6c64b8f44359691312
7
+ data.tar.gz: 1606e6811d188bd18d56d368fe712871193283c93f3f52c5300052884e4ca1fbb3e8ab502499add0b9364780eca13154ca9cb6c2bfdc8674ca3dd6b157f28209
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.12.7](https://github.com/bensheldon/good_job/tree/v3.12.7) (2023-03-01)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.12.6...v3.12.7)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Rename "assets" to "frontends" to avoid Asset Pipeline collisions [\#874](https://github.com/bensheldon/good_job/pull/874) ([bensheldon](https://github.com/bensheldon))
10
+
11
+ **Closed issues:**
12
+
13
+ - GoodJob's JavaScript takes precedence over application's JavaScript in GoodJob 3.12.6, Rails 7 [\#873](https://github.com/bensheldon/good_job/issues/873)
14
+
3
15
  ## [v3.12.6](https://github.com/bensheldon/good_job/tree/v3.12.6) (2023-03-01)
4
16
 
5
17
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.12.5...v3.12.6)
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+ module GoodJob
3
+ class FrontendsController < ActionController::Base # rubocop:disable Rails/ApplicationController
4
+ skip_after_action :verify_same_origin_request
5
+
6
+ STATIC_ASSETS = {
7
+ css: {
8
+ bootstrap: GoodJob::Engine.root.join("app", "frontend", "good_job", "vendor", "bootstrap", "bootstrap.min.css"),
9
+ style: GoodJob::Engine.root.join("app", "frontend", "good_job", "style.css"),
10
+ },
11
+ js: {
12
+ bootstrap: GoodJob::Engine.root.join("app", "frontend", "good_job", "vendor", "bootstrap", "bootstrap.bundle.min.js"),
13
+ chartjs: GoodJob::Engine.root.join("app", "frontend", "good_job", "vendor", "chartjs", "chart.min.js"),
14
+ es_module_shims: GoodJob::Engine.root.join("app", "frontend", "good_job", "vendor", "es_module_shims.js"),
15
+ rails_ujs: GoodJob::Engine.root.join("app", "frontend", "good_job", "vendor", "rails_ujs.js"),
16
+ },
17
+ }.freeze
18
+
19
+ MODULE_OVERRIDES = {
20
+ application: GoodJob::Engine.root.join("app", "frontend", "good_job", "application.js"),
21
+ stimulus: GoodJob::Engine.root.join("app", "frontend", "good_job", "vendor", "stimulus.js"),
22
+ }.freeze
23
+
24
+ def self.js_modules
25
+ @_js_modules ||= GoodJob::Engine.root.join("app", "frontend", "good_job", "modules").children.select(&:file?).each_with_object({}) do |file, modules|
26
+ key = File.basename(file.basename.to_s, ".js").to_sym
27
+ modules[key] = file
28
+ end.merge(MODULE_OVERRIDES)
29
+ end
30
+
31
+ before_action do
32
+ expires_in 1.year, public: true
33
+ end
34
+
35
+ def static
36
+ render file: STATIC_ASSETS.dig(params[:format].to_sym, params[:name].to_sym) || raise(ActionController::RoutingError, 'Not Found')
37
+ end
38
+
39
+ def module
40
+ raise(ActionController::RoutingError, 'Not Found') if params[:format] != "js"
41
+
42
+ render file: self.class.js_modules[params[:name].to_sym] || raise(ActionController::RoutingError, 'Not Found')
43
+ end
44
+ end
45
+ end
@@ -8,15 +8,15 @@
8
8
  <%= csp_meta_tag %>
9
9
 
10
10
  <%# Do not use asset tag helpers to avoid paths being overriden by config.asset_host %>
11
- <%= tag.link rel: "stylesheet", href: static_asset_path(:bootstrap, format: :css, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
12
- <%= tag.link rel: "stylesheet", href: static_asset_path(:style, format: :css, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
11
+ <%= tag.link rel: "stylesheet", href: frontend_static_path(:bootstrap, format: :css, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
12
+ <%= tag.link rel: "stylesheet", href: frontend_static_path(:style, format: :css, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
13
13
 
14
- <%= tag.script "", src: static_asset_path(:bootstrap, format: :js, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
15
- <%= tag.script "", src: static_asset_path(:chartjs, format: :js, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
16
- <%= tag.script "", src: static_asset_path(:rails_ujs, format: :js, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
14
+ <%= tag.script "", src: frontend_static_path(:bootstrap, format: :js, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
15
+ <%= tag.script "", src: frontend_static_path(:chartjs, format: :js, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
16
+ <%= tag.script "", src: frontend_static_path(:rails_ujs, format: :js, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
17
17
 
18
- <%= tag.script "", src: static_asset_path(:es_module_shims, format: :js, v: GoodJob::VERSION, locale: nil), async: true, nonce: content_security_policy_nonce %>
19
- <% importmaps = GoodJob::AssetsController.js_modules.keys.index_with { |module_name| module_asset_path(module_name, format: :js, locale: nil, v: GoodJob::VERSION) } %>
18
+ <%= tag.script "", src: frontend_static_path(:es_module_shims, format: :js, v: GoodJob::VERSION, locale: nil), async: true, nonce: content_security_policy_nonce %>
19
+ <% importmaps = GoodJob::FrontendsController.js_modules.keys.index_with { |module_name| frontend_module_path(module_name, format: :js, locale: nil, v: GoodJob::VERSION) } %>
20
20
  <%= tag.script({ imports: importmaps }.to_json.html_safe, type: "importmap", nonce: content_security_policy_nonce) %>
21
21
  <%= tag.script "", type: "module", nonce: content_security_policy_nonce do %> import "application"; <% end %>
22
22
  </head>
data/config/routes.rb CHANGED
@@ -27,8 +27,8 @@ GoodJob::Engine.routes.draw do
27
27
 
28
28
  resources :processes, only: %i[index]
29
29
 
30
- scope :assets, controller: :assets do
31
- get "modules/:name", action: :module, as: :module_asset, constraints: { format: 'js' }
32
- get "static/:name", action: :static, as: :static_asset, constraints: { format: %w[css js] }
30
+ scope :frontend, controller: :frontends do
31
+ get "modules/:name", action: :module, as: :frontend_module, constraints: { format: 'js' }
32
+ get "static/:name", action: :static, as: :frontend_static, constraints: { format: %w[css js] }
33
33
  end
34
34
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module GoodJob
3
3
  # GoodJob gem version.
4
- VERSION = '3.12.6'
4
+ VERSION = '3.12.7'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: good_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.12.6
4
+ version: 3.12.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Sheldon
@@ -318,30 +318,30 @@ files:
318
318
  - CHANGELOG.md
319
319
  - LICENSE.txt
320
320
  - README.md
321
- - app/assets/good_job/application.js
322
- - app/assets/good_job/modules/charts.js
323
- - app/assets/good_job/modules/checkbox_toggle.js
324
- - app/assets/good_job/modules/document_ready.js
325
- - app/assets/good_job/modules/live_poll.js
326
- - app/assets/good_job/modules/popovers.js
327
- - app/assets/good_job/modules/toasts.js
328
- - app/assets/good_job/style.css
329
- - app/assets/good_job/vendor/bootstrap/bootstrap.bundle.min.js
330
- - app/assets/good_job/vendor/bootstrap/bootstrap.min.css
331
- - app/assets/good_job/vendor/chartjs/chart.min.js
332
- - app/assets/good_job/vendor/es_module_shims.js
333
- - app/assets/good_job/vendor/rails_ujs.js
334
- - app/assets/good_job/vendor/stimulus.js
335
321
  - app/charts/good_job/scheduled_by_queue_chart.rb
336
322
  - app/controllers/good_job/application_controller.rb
337
- - app/controllers/good_job/assets_controller.rb
338
323
  - app/controllers/good_job/batches_controller.rb
339
324
  - app/controllers/good_job/cron_entries_controller.rb
325
+ - app/controllers/good_job/frontends_controller.rb
340
326
  - app/controllers/good_job/jobs_controller.rb
341
327
  - app/controllers/good_job/processes_controller.rb
342
328
  - app/filters/good_job/base_filter.rb
343
329
  - app/filters/good_job/batches_filter.rb
344
330
  - app/filters/good_job/jobs_filter.rb
331
+ - app/frontend/good_job/application.js
332
+ - app/frontend/good_job/modules/charts.js
333
+ - app/frontend/good_job/modules/checkbox_toggle.js
334
+ - app/frontend/good_job/modules/document_ready.js
335
+ - app/frontend/good_job/modules/live_poll.js
336
+ - app/frontend/good_job/modules/popovers.js
337
+ - app/frontend/good_job/modules/toasts.js
338
+ - app/frontend/good_job/style.css
339
+ - app/frontend/good_job/vendor/bootstrap/bootstrap.bundle.min.js
340
+ - app/frontend/good_job/vendor/bootstrap/bootstrap.min.css
341
+ - app/frontend/good_job/vendor/chartjs/chart.min.js
342
+ - app/frontend/good_job/vendor/es_module_shims.js
343
+ - app/frontend/good_job/vendor/rails_ujs.js
344
+ - app/frontend/good_job/vendor/stimulus.js
345
345
  - app/helpers/good_job/application_helper.rb
346
346
  - app/models/concerns/good_job/filterable.rb
347
347
  - app/models/concerns/good_job/reportable.rb
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
- module GoodJob
3
- class AssetsController < ActionController::Base # rubocop:disable Rails/ApplicationController
4
- skip_after_action :verify_same_origin_request
5
-
6
- STATIC_ASSETS = {
7
- css: {
8
- bootstrap: GoodJob::Engine.root.join("app", "assets", "good_job", "vendor", "bootstrap", "bootstrap.min.css"),
9
- style: GoodJob::Engine.root.join("app", "assets", "good_job", "style.css"),
10
- },
11
- js: {
12
- bootstrap: GoodJob::Engine.root.join("app", "assets", "good_job", "vendor", "bootstrap", "bootstrap.bundle.min.js"),
13
- chartjs: GoodJob::Engine.root.join("app", "assets", "good_job", "vendor", "chartjs", "chart.min.js"),
14
- es_module_shims: GoodJob::Engine.root.join("app", "assets", "good_job", "vendor", "es_module_shims.js"),
15
- rails_ujs: GoodJob::Engine.root.join("app", "assets", "good_job", "vendor", "rails_ujs.js"),
16
- },
17
- }.freeze
18
-
19
- MODULE_OVERRIDES = {
20
- application: GoodJob::Engine.root.join("app", "assets", "good_job", "application.js"),
21
- stimulus: GoodJob::Engine.root.join("app", "assets", "good_job", "vendor", "stimulus.js"),
22
- }.freeze
23
-
24
- def self.js_modules
25
- @_js_modules ||= GoodJob::Engine.root.join("app", "assets", "good_job", "modules").children.select(&:file?).each_with_object({}) do |file, modules|
26
- key = File.basename(file.basename.to_s, ".js").to_sym
27
- modules[key] = file
28
- end.merge(MODULE_OVERRIDES)
29
- end
30
-
31
- before_action do
32
- expires_in 1.year, public: true
33
- end
34
-
35
- def static
36
- render file: STATIC_ASSETS.dig(params[:format].to_sym, params[:name].to_sym) || raise(ActionController::RoutingError, 'Not Found')
37
- end
38
-
39
- def module
40
- raise(ActionController::RoutingError, 'Not Found') if params[:format] != "js"
41
-
42
- render file: self.class.js_modules[params[:name].to_sym] || raise(ActionController::RoutingError, 'Not Found')
43
- end
44
- end
45
- end
File without changes
File without changes