Refactor render_secondary_navigation macro
* Use navigation_links instead of pages. * Use secondary navigation mixin. * Always include project category. * Always include Explore tab. Should be eventually moved to Blender Cloud repo.
This commit is contained in:
@@ -1,29 +1,29 @@
|
|||||||
| {% macro render_secondary_navigation(project, pages=None) %}
|
include ../mixins/components
|
||||||
nav.navbar-secondary
|
|
||||||
nav.collapse.navbar-collapse
|
| {% macro render_secondary_navigation(project, navigation_links, title) %}
|
||||||
ul.navbar-nav.navbar-right
|
|
||||||
li
|
| {% if project.category == 'course' %}
|
||||||
a.navbar-item(
|
| {% set category_url = url_for('cloud.courses') %}
|
||||||
href="{{ url_for('projects.view', project_url=project.url) }}",
|
| {% elif project.category == 'workshop' %}
|
||||||
title="{{ project.name }} Homepage")
|
| {% set category_url = url_for('cloud.workshops') %}
|
||||||
span
|
| {% elif project.category == 'film' %}
|
||||||
b {{ project.name }}
|
| {% set category_url = url_for('cloud.open_projects') %}
|
||||||
li
|
| {% else %}
|
||||||
a.navbar-item(
|
| {% set category_url = url_for('main.index') %}
|
||||||
href="{{ url_for('main.project_blog', project_url=project.url) }}",
|
| {% endif %}
|
||||||
title="Project Blog",
|
|
||||||
class="{% if category == 'blog' %}active{% endif %}")
|
+nav-secondary()
|
||||||
span Blog
|
li.text-capitalize
|
||||||
| {% if pages %}
|
a.nav-link.text-muted.px-0(href="{{ category_url }}")
|
||||||
| {% for p in pages %}
|
| {{ project.category }}
|
||||||
li
|
li.px-1
|
||||||
a.navbar-item(
|
i.pi-angle-right
|
||||||
href="{{ url_for('projects.view_node', project_url=project.url, node_id=p._id) }}",
|
|
||||||
title="{{ p.name }}",
|
+nav-secondary-link(
|
||||||
class="{% if category == 'page' %}active{% endif %}")
|
class="px-0 font-weight-bold",
|
||||||
span {{ p.name }}
|
href="{{url_for('projects.view', project_url=project.url, _external=True)}}")
|
||||||
| {% endfor %}
|
| {{ project.name }}
|
||||||
| {% endif %}
|
|
||||||
| {% if project.nodes_featured %}
|
| {% if project.nodes_featured %}
|
||||||
| {# In some cases featured_nodes might might be embedded #}
|
| {# In some cases featured_nodes might might be embedded #}
|
||||||
| {% if '_id' in project.nodes_featured[0] %}
|
| {% if '_id' in project.nodes_featured[0] %}
|
||||||
@@ -31,11 +31,16 @@ nav.navbar-secondary
|
|||||||
| {% else %}
|
| {% else %}
|
||||||
| {% set featured_node_id=project.nodes_featured[0] %}
|
| {% set featured_node_id=project.nodes_featured[0] %}
|
||||||
| {% endif %}
|
| {% endif %}
|
||||||
li
|
+nav-secondary-link(
|
||||||
a.navbar-item(
|
|
||||||
href="{{ url_for('projects.view_node', project_url=project.url, node_id=featured_node_id) }}",
|
href="{{ url_for('projects.view_node', project_url=project.url, node_id=featured_node_id) }}",
|
||||||
title="Explore {{ project.name }}",
|
title="Explore {{ project.name }}",
|
||||||
class="{% if category == 'blog' %}active{% endif %}")
|
class="{% if title == 'project' %}active{% endif %}")
|
||||||
span Explore
|
| Explore
|
||||||
| {% endif %}
|
| {% endif %}
|
||||||
|
|
||||||
|
| {% for link in navigation_links %}
|
||||||
|
+nav-secondary-link(href="{{ link['url'] }}")
|
||||||
|
| {{ link['label'] }}
|
||||||
|
| {% endfor %}
|
||||||
|
|
||||||
| {% endmacro %}
|
| {% endmacro %}
|
||||||
|
Reference in New Issue
Block a user