1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Move all web stuff into /web, fix trailing slash issue.

This commit is contained in:
Mike Perham 2012-03-05 19:27:27 -08:00
parent 5ea0ca89d0
commit 20e51f1276
23 changed files with 6 additions and 2 deletions

View file

@ -18,6 +18,10 @@ module Sidekiq
end end
def call(env) def call(env)
# Solve the problem of people requesting /sidekiq when they need to request /sidekiq/ so
# that relative links in templates resolve correctly.
return [301, { 'Location' => "#{env['SCRIPT_NAME']}/" }, []] if env['SCRIPT_NAME'] == env['REQUEST_PATH']
return @app.call(env) unless @matcher =~ env["PATH_INFO"] return @app.call(env) unless @matcher =~ env["PATH_INFO"]
env['PATH_INFO'].sub!(@matcher,'') env['PATH_INFO'].sub!(@matcher,'')
@environment.call(env) @environment.call(env)
@ -25,10 +29,10 @@ module Sidekiq
end end
class Web < Sinatra::Base class Web < Sinatra::Base
dir = File.expand_path(File.dirname(__FILE__) + "/../..") dir = File.expand_path(File.dirname(__FILE__) + "/../../web")
set :views, "#{dir}/views" set :views, "#{dir}/views"
set :root, "#{dir}/public" set :root, "#{dir}/public"
use SprocketsMiddleware, :root => dir, :path => 'assets' use SprocketsMiddleware, :root => dir
get "/" do get "/" do
slim :index slim :index

View file

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View file

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB