Skip to content

Commit

Permalink
Fix route on replace content (#14)
Browse files Browse the repository at this point in the history
* Fix route on replace content

* Update CHANGELOG.md

* Fix rubocop warnings
  • Loading branch information
dannnylo committed Sep 27, 2024
1 parent 239d127 commit 7df25e9
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 58 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## [Unreleased]

## [0.3.5] - 2024-09-27

- Fix replace_content to dynamic routes

## [0.3.4] - 2024-01-07

- Feature top label
Expand Down
84 changes: 37 additions & 47 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,85 +1,75 @@
PATH
remote: .
specs:
sidekiq-belt (0.3.4)
sidekiq-belt (0.3.5)
sidekiq (> 7.1.4)

GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
base64 (0.1.1)
byebug (11.1.3)
concurrent-ruby (1.2.2)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
diff-lcs (1.5.0)
docile (1.4.0)
json (2.6.3)
diff-lcs (1.5.1)
docile (1.4.1)
json (2.7.2)
language_server-protocol (3.17.0.3)
parallel (1.23.0)
parser (3.2.2.3)
logger (1.6.1)
parallel (1.26.3)
parser (3.3.5.0)
ast (~> 2.4.1)
racc
racc (1.7.1)
rack (3.0.11)
racc (1.8.1)
rack (3.1.7)
rainbow (3.1.1)
rake (13.0.6)
redis-client (0.14.1)
rake (13.2.1)
redis-client (0.22.2)
connection_pool
regexp_parser (2.8.1)
rexml (3.2.8)
strscan (>= 3.0.9)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
regexp_parser (2.9.2)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.1)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
rubocop (1.56.4)
base64 (~> 0.1.1)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.66.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.3)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.1, < 2.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.19.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.24.0)
rubocop (~> 1.33)
rubocop-ast (1.32.3)
parser (>= 3.3.1.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.24.1)
rubocop (~> 1.33)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-rspec (3.0.5)
rubocop (~> 1.61)
ruby-progressbar (1.13.0)
sidekiq (7.1.6)
sidekiq (7.3.2)
concurrent-ruby (< 2)
connection_pool (>= 2.3.0)
logger
rack (>= 2.2.4)
redis-client (>= 0.14.0)
redis-client (>= 0.22.2)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
strscan (3.1.0)
unicode-display_width (2.5.0)
unicode-display_width (2.6.0)

PLATFORMS
x86_64-linux
Expand Down
2 changes: 1 addition & 1 deletion lib/sidekiq/belt/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Sidekiq
module Belt
VERSION = "0.3.4"
VERSION = "0.3.5"
end
end
18 changes: 8 additions & 10 deletions lib/sidekiq/web_action_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,19 @@
module Sidekiq
module WebActionHelper
def render(engine, content, options = {})
begin
path_info = /"([^"]*)"/.match(block.source.to_s)[1]
rescue StandardError
path_info = nil
end

path_info ||= ::Rack::Utils.unescape(env["PATH_INFO"])
path_info = ::Rack::Utils.unescape(env["PATH_INFO"])

replace_views = Sidekiq::Config::DEFAULTS[:replace_views] || {}

replace_views.fetch(path_info.to_s, []).each do |content_block|
content_block.call(content)
replace_views.each do |key, content_blocks|
next if WebRoute.new("", key, true).match("", path_info).nil?

content_blocks.each do |content_block|
content_block.call(content)
end
end

super(engine, content, options)
super
end

def self.change_layout(&block)
Expand Down

0 comments on commit 7df25e9

Please sign in to comment.