Merge pull request #2033 from alphagov/selected-nav

Highlight selected navigation item
This commit is contained in:
Chris Hill-Scott
2018-04-27 16:38:27 +01:00
committed by GitHub
7 changed files with 869 additions and 18 deletions
+11
View File
@@ -39,6 +39,7 @@ from werkzeug.local import LocalProxy
from app import proxy_fix
from app.config import configs
from app.asset_fingerprinter import AssetFingerprinter
from app.navigation import HeaderNavigation, MainNavigation, OrgNavigation
from app.notify_client.service_api_client import ServiceAPIClient
from app.notify_client.api_key_api_client import ApiKeyApiClient
from app.notify_client.invite_api_client import InviteApiClient
@@ -89,6 +90,12 @@ current_service = LocalProxy(partial(_lookup_req_object, 'service'))
# The current organisation attached to the request stack.
current_organisation = LocalProxy(partial(_lookup_req_object, 'organisation'))
navigation = {
'main_navigation': MainNavigation(),
'header_navigation': HeaderNavigation(),
'org_navigation': OrgNavigation(),
}
def create_app(application):
setup_commands(application)
@@ -171,6 +178,10 @@ def init_app(application):
def _attach_current_user():
return{'current_user': current_user}
@application.context_processor
def _nav_selected():
return navigation
@application.before_request
def record_start_time():
g.start = monotonic()