Module: Sidekiq::Cron::WebExtension::Helpers
- Defined in:
- lib/sidekiq/cron/web_extension.rb
Instance Method Summary collapse
- #cron_route_params(key) ⇒ Object
-
#namespace_redirect_path ⇒ Object
This method constructs the URL for the cron jobs page within the specified namespace.
- #redirect_to_previous_or_default ⇒ Object
- #render_erb(view) ⇒ Object
Instance Method Details
#cron_route_params(key) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/sidekiq/cron/web_extension.rb', line 5 def cron_route_params(key) if Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new("8.0.0") route_params(key) else route_params[key] end end |
#namespace_redirect_path ⇒ Object
This method constructs the URL for the cron jobs page within the specified namespace.
14 15 16 |
# File 'lib/sidekiq/cron/web_extension.rb', line 14 def namespace_redirect_path "#{root_path}cron/namespaces/#{cron_route_params(:namespace)}" end |
#redirect_to_previous_or_default ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/sidekiq/cron/web_extension.rb', line 18 def redirect_to_previous_or_default if Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new("8.0.0") redirect url_params('redirect') || namespace_redirect_path else redirect params["redirect"] || namespace_redirect_path end end |
#render_erb(view) ⇒ Object
26 27 28 29 30 |
# File 'lib/sidekiq/cron/web_extension.rb', line 26 def render_erb(view) path = Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new("8.0.0") ? "views" : "views/legacy" views_path = File.join(File.("..", __FILE__), path) erb(File.read(File.join(views_path, "#{view}.erb"))) end |