Commit f055c6f9 by Nate Hardison

Inject theming hooks into navigation bar

Allow themes to inherit from the default navigation bar and override
pieces of it, including the main logo, the links that display to the
right of the logo, and the links inside the dropdown menu (with the
exception of the `Log Out` link.

In addition, this adds an empty block at the very top so that themes
can place a branding bar at the top of the page. (Stanford identity
guidelines require this: see https://identity.stanford.edu.)
parent a3ca0843
## mako ## mako
<%namespace name='static' file='static_content.html'/> <%namespace name='static' file='static_content.html'/>
<%namespace file='main.html' import="login_query"/> <%namespace file='main.html' import="login_query, stanford_theme_enabled"/>
<%! <%!
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
...@@ -10,6 +10,9 @@ import branding ...@@ -10,6 +10,9 @@ import branding
from status.status import get_site_status_msg from status.status import get_site_status_msg
%> %>
## Provide a hook for themes to inject branding on top.
<%block name="navigation_top" />
<%block cached="False"> <%block cached="False">
<% <%
try: try:
...@@ -38,9 +41,12 @@ site_status_msg = get_site_status_msg(course_id) ...@@ -38,9 +41,12 @@ site_status_msg = get_site_status_msg(course_id)
<nav> <nav>
<h1 class="logo"> <h1 class="logo">
<a href="${marketing_link('ROOT')}"> <a href="${marketing_link('ROOT')}">
<%block name="navigation_logo">
<img src="${static.url(branding.get_logo_url(request.META.get('HTTP_HOST')))}" alt="edX home" /> <img src="${static.url(branding.get_logo_url(request.META.get('HTTP_HOST')))}" alt="edX home" />
</a></h1> </%block>
</a>
</h1>
% if course: % if course:
<h2><span class="provider">${course.org}:</span> ${course.number} ${course.display_name_with_default}</h2> <h2><span class="provider">${course.org}:</span> ${course.number} ${course.display_name_with_default}</h2>
...@@ -49,9 +55,11 @@ site_status_msg = get_site_status_msg(course_id) ...@@ -49,9 +55,11 @@ site_status_msg = get_site_status_msg(course_id)
% if user.is_authenticated(): % if user.is_authenticated():
<ol class="left nav-global authenticated"> <ol class="left nav-global authenticated">
<li class="nav-global-01"> <%block name="navigation_global_links_authenticated">
<a href="${marketing_link('COURSES')}">Find Courses</a> <li class="nav-global-01">
</li> <a href="${marketing_link('COURSES')}">Find Courses</a>
</li>
</%block>
</ol> </ol>
<ol class="user"> <ol class="user">
<li class="primary"> <li class="primary">
...@@ -63,10 +71,9 @@ site_status_msg = get_site_status_msg(course_id) ...@@ -63,10 +71,9 @@ site_status_msg = get_site_status_msg(course_id)
<li class="primary"> <li class="primary">
<a href="#" class="dropdown">&#9662</a> <a href="#" class="dropdown">&#9662</a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <%block name="navigation_dropdown_menu_links" >
<a href="${marketing_link('FAQ')}"> <li><a href="${marketing_link('FAQ')}">Help</a></li>
Help </%block>
</a></li>
<li><a href="${reverse('logout')}">Log Out</a></li> <li><a href="${reverse('logout')}">Log Out</a></li>
</ul> </ul>
</li> </li>
...@@ -74,17 +81,19 @@ site_status_msg = get_site_status_msg(course_id) ...@@ -74,17 +81,19 @@ site_status_msg = get_site_status_msg(course_id)
% else: % else:
<ol class="left nav-global"> <ol class="left nav-global">
% if settings.MITX_FEATURES.get('ENABLE_MKTG_SITE'): <%block name="navigation_global_links">
<li class="nav-global-01"> % if settings.MITX_FEATURES.get('ENABLE_MKTG_SITE'):
<a href="${marketing_link('HOW_IT_WORKS')}">How it Works</a> <li class="nav-global-01">
</li> <a href="${marketing_link('HOW_IT_WORKS')}">How it Works</a>
<li class="nav-global-02"> </li>
<a href="${marketing_link('COURSES')}">Courses</a> <li class="nav-global-02">
</li> <a href="${marketing_link('COURSES')}">Courses</a>
<li class="nav-global-03"> </li>
<a href="${marketing_link('SCHOOLS')}">Schools</a> <li class="nav-global-03">
</li> <a href="${marketing_link('SCHOOLS')}">Schools</a>
% endif </li>
% endif
</%block>
% if not settings.MITX_FEATURES['DISABLE_LOGIN_BUTTON']: % if not settings.MITX_FEATURES['DISABLE_LOGIN_BUTTON']:
<li class="nav-global-04"> <li class="nav-global-04">
<a class="cta cta-register" href="/register">Register Now</a> <a class="cta cta-register" href="/register">Register Now</a>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment