|
|
@ -98,7 +98,8 @@ class App < Sinatra::Application
|
|
|
|
browser.ie? && %w(6 7 8 9).include?(browser.version)
|
|
|
|
browser.ie? && %w(6 7 8 9).include?(browser.version)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def doc_index_urls
|
|
|
|
def docs
|
|
|
|
|
|
|
|
@docs ||= begin
|
|
|
|
cookie = cookies[:docs]
|
|
|
|
cookie = cookies[:docs]
|
|
|
|
|
|
|
|
|
|
|
|
docs = if cookie.nil? || cookie.empty?
|
|
|
|
docs = if cookie.nil? || cookie.empty?
|
|
|
@ -106,7 +107,10 @@ class App < Sinatra::Application
|
|
|
|
else
|
|
|
|
else
|
|
|
|
cookie.split('/')
|
|
|
|
cookie.split('/')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def doc_index_urls
|
|
|
|
docs.inject [] do |result, slug|
|
|
|
|
docs.inject [] do |result, slug|
|
|
|
|
if doc = settings.docs[slug]
|
|
|
|
if doc = settings.docs[slug]
|
|
|
|
result << File.join('', settings.docs_prefix, doc['index_path']) + "?#{doc['mtime']}"
|
|
|
|
result << File.join('', settings.docs_prefix, doc['index_path']) + "?#{doc['mtime']}"
|
|
|
@ -212,6 +216,8 @@ class App < Sinatra::Application
|
|
|
|
redirect "/#{doc}#{type}/#{query_string_for_redirection}"
|
|
|
|
redirect "/#{doc}#{type}/#{query_string_for_redirection}"
|
|
|
|
elsif rest.length > 1 && rest.end_with?('/')
|
|
|
|
elsif rest.length > 1 && rest.end_with?('/')
|
|
|
|
redirect "/#{doc}#{type}#{rest[0...-1]}#{query_string_for_redirection}"
|
|
|
|
redirect "/#{doc}#{type}#{rest[0...-1]}#{query_string_for_redirection}"
|
|
|
|
|
|
|
|
elsif docs.include?(doc) && browser.modern?
|
|
|
|
|
|
|
|
redirect "/##{request.path}", 302
|
|
|
|
else
|
|
|
|
else
|
|
|
|
erb :other
|
|
|
|
erb :other
|
|
|
|
end
|
|
|
|
end
|
|
|
|