This project is read-only.

Parent controller reference

Dec 29, 2011 at 4:12 PM

Case: I have a long hierarchy like Admin/Projects/Internal/View/Staff. It's simple to reference root-level controllers with '~', or set of child with '+'. But, I can't simple reference from 'View' or 'Staff' level to frequently used action in 'Internals'-level controller, it's need to use '~Admin.Projects.Internals' because of '..' syntax can't be used both in 'View' ('Internal' are parent) and 'Staff' ('Internals' are grandparent) level.

jQuery has great function named 'closest' -, that go up from current level until find matching element. Use similar logic, we can write simple rule like '<-Internals', and use it in all descendent levels without worry about route errors.

It's not feature request, but my thinks about routing optimization :)

Dec 30, 2011 at 2:00 AM
Yes, I've thought about this, but I'm not sure if it's worth the
trouble. You have to make sure all routes don't match in the current
context before testing in a higher context, so you would have to wrap
RouteCollection or something, you cannot implement it in CodeRoute.