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 i.pi-flamenco.pr-2
span Flamenco span Flamenco
| {% endmacro %} | {% 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 %}

View File

@@ -1,9 +1,10 @@
| {% extends 'layout.html' %} | {% extends 'layout.html' %}
| {% from '_macros/_navigation.html' import navigation_project %}
include ../../../../pillar/src/templates/mixins/components include ../../../../pillar/src/templates/mixins/components
| {% set title = 'landing' %} | {% set title = 'landing' %}
| {% import 'projects/_macros.html' as projectmacros %}
| {% from '_macros/_asset_list_item.html' import asset_list_item %} | {% from '_macros/_asset_list_item.html' import asset_list_item %}
| {% block page_title %}{{ project.name }}{% endblock%} | {% block page_title %}{{ project.name }}{% endblock%}
@@ -81,7 +82,7 @@ link(href="{{ url_for('static_cloud', filename='assets/css/project-main.css') }}
| {% endblock %} | {% endblock %}
| {% block navigation_tabs %} | {% block navigation_tabs %}
| {{ projectmacros.render_secondary_navigation(project, navigation_links, title) }} | {{ navigation_project(project, navigation_links, title) }}
| {% endblock navigation_tabs %} | {% endblock navigation_tabs %}
| {% block body %} | {% block body %}

View File

@@ -1,6 +1,6 @@
| {% extends 'layout.html' %} | {% extends 'layout.html' %}
| {% from '_macros/_add_new_menu.html' import add_new_menu %} | {% from '_macros/_add_new_menu.html' import add_new_menu %}
| {% from 'projects/_macros.html' import render_secondary_navigation %} | {% from '_macros/_navigation.html' import navigation_project %}
include ../../../../pillar/src/templates/mixins/components include ../../../../pillar/src/templates/mixins/components
@@ -87,7 +87,8 @@ link(href="{{ url_for('static_cloud', filename='assets/css/project-main.css') }}
| {% endblock %} | {% endblock %}
| {% block navigation_tabs %} | {% block navigation_tabs %}
| {{ render_secondary_navigation(project, navigation_links, title) }} | {% from '_macros/_navigation.html' import navigation_collection %}
| {{ navigation_project(project, navigation_links, title) }}
| {% endblock navigation_tabs %} | {% endblock navigation_tabs %}
| {% block body %} | {% block body %}