Rename secondary_navigation to navigation_project

And move to _navigation.pug with the other navigations macros.
This commit is contained in:
2018-09-20 12:06:43 +02:00
parent afa0c96156
commit dcac1317bf
3 changed files with 64 additions and 4 deletions

View File

@@ -115,3 +115,61 @@ include ../../../../pillar/src/templates/mixins/components
i.pi-flamenco.pr-2
span Flamenco
| {% endmacro %}
| {% macro navigation_project(project, navigation_links, title) %}
| {% if project.category == 'course' %}
| {% set category_url = url_for('cloud.courses') %}
| {% elif project.category == 'workshop' %}
| {% set category_url = url_for('cloud.workshops') %}
| {% elif project.category == 'film' %}
| {% set category_url = url_for('cloud.open_projects') %}
| {% else %}
| {% set category_url = url_for('main.homepage') %}
| {% endif %}
+nav-secondary()
| {% if project.url != 'blender-cloud' %}
| {% if not project.is_private %}
li.text-capitalize
a.nav-link.text-muted.px-0(href="{{ category_url }}")
| {% if project.category == 'film' %}
span Open Projects
| {% elif project.category == 'assets' %}
span Libraries
| {% else %}
span {{ project.category }}
| {% endif %}
li.px-1
i.pi-angle-right
| {% endif %}
+nav-secondary-link(
class="px-1 font-weight-bold{% if title == 'landing' %} active{% endif %}",
href="{{url_for('projects.view', project_url=project.url, _external=True)}}")
span {{ project.name }}
| {% endif %}
| {% for link in navigation_links %}
+nav-secondary-link(
href="{{ link['url'] }}",
class="{% if link['slug'] == title %}active{% endif %}")
span {{ link['label'] }}
| {% endfor %}
| {% if project.nodes_featured %}
| {# In some cases featured_nodes might might be embedded #}
| {% if '_id' in project.nodes_featured[0] %}
| {% set featured_node_id=project.nodes_featured[0]._id %}
| {% else %}
| {% set featured_node_id=project.nodes_featured[0] %}
| {% endif %}
+nav-secondary-link(
href="{{ url_for('projects.view_node', project_url=project.url, node_id=featured_node_id) }}",
title="Explore {{ project.name }}",
class="{% if title == 'project' %}active{% endif %}")
span Browse
| {% endif %}
| {% endmacro %}