Routing overhaul
Created by: rspeicher
Closes #1507 (closed) and #1452 (closed)
New Routes
Redesigns all routes that work with branch/tag names and file paths:
# /:project_id/blame/*path
# /gitlabhq/blame/master/app/contexts/base_context.rb
# /gitlabhq/blame/test/branch/name/app/contexts/base_context.rb
#
# /:project_id/blob/*path
# /gitlabhq/blob/master/app/contexts/base_context.rb
# /gitlabhq/blob/test/branch/name/app/contexts/base_context.rb
#
# /:project_id/commit/:id
# /gitlabhq/commit/caef9ed1121a16ca0cc78715695daaa974271bfd
#
# /:project_id/commits
#
# /:project_id/commits/*path
# /gitlabhq/commits/master/app/contexts/base_context.rb
# /gitlabhq/commits/test/branch/name/app/contexts/base_context.rb
#
# /:project_id/tree/*path
# /gitlabhq/tree/master/app
# /gitlabhq/tree/test/branch/name/app
#
# /:project_id/compare
#
# /:project_id/compare/:from...:to
# /gitlabhq/compare/master...stable
It does this by basically allowing anything for the :id parameter on these routes, and uses a special module called ExtractsPaths to separate the branch/tag from the file path.
As a consequence of this, I had to do some hack-ish stuff to still allow the Atom feeds to work. See 33126227, 6b90f36f and 1799cf3b.
"Active Tab" cleanup
Adds a new nav_link
helper to the TabHelper module. It's well documented, so have a look. I also added comprehensive Spinach features to ensure that the correct main and sub tabs are marked as active across the various pages (see cada511f).
Misc. Cleanup
- I replaced all instances of
File.join(Rails.root, ...)
withRails.root.join(...)
. - I removed a
before_filter
calledrender_full_content
that didn't seem to be doing anything.