Browse files

Remove "Application" section title from routes

This PR standardizes the output of the HTML and console based routes to not include the title for "Application Routes" those that are defined by the application. Instead only routes defined in engines get any special treatment. 

Based on this conversation:

af5c0fd#commitcomment-2458823

ATP actionpack /cc @carlosantoniodasilva
  • Loading branch information...
1 parent 40e7978 commit f654c3cfc00271c3b410bc0fe9c80a5593709c02 @schneems schneems committed Jan 18, 2013
Showing with 13 additions and 6 deletions.
  1. +13 −6 actionpack/lib/action_dispatch/routing/inspector.rb
View
19 actionpack/lib/action_dispatch/routing/inspector.rb
@@ -73,10 +73,11 @@ def format(formatter, filter = nil)
routes_to_display = filter_routes(filter)
routes = collect_routes(routes_to_display)
- formatter.section :application, 'Application routes', routes
+ formatter.section routes
@engines.each do |name, engine_routes|
- formatter.section :engine, "Routes for #{name}", engine_routes
+ formatter.section_title "Routes for #{name}"
+ formatter.section engine_routes
end
formatter.result
@@ -125,8 +126,11 @@ def result
@buffer.join("\n")
end
- def section(type, title, routes)
- @buffer << "\n#{title}:" unless type == :application
+ def section_title(title)
+ @buffer << "\n#{title}:"
+ end
+
+ def section(routes)
@buffer << draw_section(routes)
end
@@ -148,8 +152,11 @@ def initialize(view)
@buffer = []
end
- def section(type, title, routes)
- @buffer << %(<tr><th colspan="4">#{title}</th></tr>)
+ def section_title(title)
+ @buffer << "<tr><th colspan="4">#{title}</th></tr>"
+ end
+
+ def section(routes)
@buffer << @view.render(partial: "routes/route", collection: routes)
end

0 comments on commit f654c3c

Please sign in to comment.