module Sidekiq::Cron::WebExtension::Helpers

def cron_route_params(key)

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

def namespace_redirect_path

This method constructs the URL for the cron jobs page within the specified namespace.
def namespace_redirect_path
  "#{root_path}cron/namespaces/#{cron_route_params(:namespace)}"
end

def redirect_to_previous_or_default

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

def render_erb(view)

def render_erb(view)
  path = Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new("8.0.0") ? "views" : "views/legacy"
  views_path = File.join(File.expand_path("..", __FILE__), path)
  erb(File.read(File.join(views_path, "#{view}.erb")))
end