learning-unlimited/ESP-Website — pull request #784 by pricem (2013-10-22 01:58:37+00:00)
Title: Add support for matching NavBarCategory to request path

Earlier migrations for NavBarCategory copied the DataTree anchor
URI into the new path field, which is helpful for keeping track of
what the anchor originally was, but not so helpful for controlling
when that NavBarCategory should appear.

This change takes the functionality of the esp.web.views.nav_category
function and moves it to NavBarCategory.from_request(), which is now
cached. The from_request() function takes a request path and a
section. It first tries to match the path against the path of a
NavBarCategory. If that fails, it falls back to the earlier
algorithm of matching the section (teach, learn, manage, etc.)
against the NavBarCategory names.

This means that the nav bars for program registration and
management pages can now be controlled.