aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2012-12-14 15:44:57 -0500
committerSteve Klabnik <steve@steveklabnik.com>2012-12-14 15:44:57 -0500
commit8554537e48d6ed18ef08cb3ac0a9da96ac3c5cd6 (patch)
treea61ff797f8d55152bf7cf9f397c7ad940bc4e9fa /actionpack/lib
parentfa3457dc3b30e3dde5bc4b041f59c037c76e1f8b (diff)
downloadrails-8554537e48d6ed18ef08cb3ac0a9da96ac3c5cd6.tar.gz
rails-8554537e48d6ed18ef08cb3ac0a9da96ac3c5cd6.tar.bz2
rails-8554537e48d6ed18ef08cb3ac0a9da96ac3c5cd6.zip
Revert "Merge pull request #8499 from schneems/schneems/html-route-inspector"
This reverts commit ae68fc3864e99ab43c18fd12577744e1583f6b64, reversing changes made to 0262a18c7b0ab6f60fee842b3007388f9ffeb0fa. See here: https://github.com/rails/rails/pull/8499#issuecomment-11356417
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/routing/inspector.rb31
1 files changed, 7 insertions, 24 deletions
diff --git a/actionpack/lib/action_dispatch/routing/inspector.rb b/actionpack/lib/action_dispatch/routing/inspector.rb
index 63d394be75..8d7461ecc3 100644
--- a/actionpack/lib/action_dispatch/routing/inspector.rb
+++ b/actionpack/lib/action_dispatch/routing/inspector.rb
@@ -67,19 +67,15 @@ module ActionDispatch
@engines = Hash.new
end
- def format(all_routes, filter = nil, format = :txt)
+ def format(all_routes, filter = nil)
if filter
all_routes = all_routes.select{ |route| route.defaults[:controller] == filter }
end
routes = collect_routes(all_routes)
- routes = formatted_routes(routes, format) + formatted_routes_for_engines(format)
- if format == :html
- routes.join('')
- else
- routes
- end
+ formatted_routes(routes) +
+ formatted_routes_for_engines
end
def collect_routes(routes)
@@ -105,32 +101,19 @@ module ActionDispatch
end
end
- def formatted_routes_for_engines(format)
+ def formatted_routes_for_engines
@engines.map do |name, routes|
- ["\nRoutes for #{name}:"] + formatted_routes(routes, format)
+ ["\nRoutes for #{name}:"] + formatted_routes(routes)
end.flatten
end
- def formatted_routes(routes, format)
+ def formatted_routes(routes)
name_width = routes.map{ |r| r[:name].length }.max
verb_width = routes.map{ |r| r[:verb].length }.max
path_width = routes.map{ |r| r[:path].length }.max
routes.map do |r|
- if format == :txt
- "#{r[:name].rjust(name_width)} " +
- "#{r[:verb].ljust(verb_width)} " +
- "#{r[:path].ljust(path_width)} " +
- "#{r[:reqs]}"
- elsif format == :html
- route = r
- "<tr class='route-row' data-helper='path' #{[:name, :verb, :path, :reqs].each {|key| "data-#{key}='#{route[key]}'"} } >" +
- "<td class='route-name'>#{route[:name] + "<span class='helper'>_path</span>" if route[:name].present?}</td>" +
- "<td class='route-verb'>#{route[:verb]}</td>" +
- "<td class='route-path'>#{route[:path]}</td>" +
- "<td class='route-reqs'>#{route[:reqs]}</td>" +
- "</tr>"
- end
+ "#{r[:name].rjust(name_width)} #{r[:verb].ljust(verb_width)} #{r[:path].ljust(path_width)} #{r[:reqs]}"
end
end
end