From 1a7be4b565f240efab02836d2710e48f0be49164 Mon Sep 17 00:00:00 2001 From: Pablo Vazquez Date: Thu, 20 Sep 2018 16:36:46 +0200 Subject: [PATCH] Navigation: Move links in the main dropdown to their own macros So they can be easily re-used in other templates. --- src/templates/_macros/_navigation.pug | 200 ++++++++++++++++++++++++- src/templates/menus/_dropdown_main.pug | 181 +++------------------- 2 files changed, 211 insertions(+), 170 deletions(-) diff --git a/src/templates/_macros/_navigation.pug b/src/templates/_macros/_navigation.pug index c66cbf6..262a161 100644 --- a/src/templates/_macros/_navigation.pug +++ b/src/templates/_macros/_navigation.pug @@ -1,5 +1,196 @@ include ../../../../pillar/src/templates/mixins/components +| {# +| Main dropdown macros. These are just links without a container. +| So the container can be set per case (big dropdown, mobile, footer, etc) +| and the links reused multiple times. +| #} + +| {% macro dropdown_main_root(title) %} ++nav-secondary-link( + href="{{ url_for('main.homepage') }}", + data-toggle='dropdown-tab', + data-tab-target='home') + i.mr-2.pi-home + span Homepage + ++nav-secondary-link( + href="{{ url_for('cloud.open_projects') }}", + data-toggle='dropdown-tab', + data-tab-target='open-projects') + i.mr-2.pi-film-thick + span Open Projects + ++nav-secondary-link( + href="{{ url_for('cloud.learn') }}", + data-toggle='dropdown-tab', + data-tab-target='learn') + i.mr-2.pi-graduation-cap + span Learn + ++nav-secondary-link( + href="{{ url_for('cloud.libraries') }}", + data-toggle='dropdown-tab', + data-tab-target='libraries') + i.mr-2.pi-file-archive + span Libraries + ++nav-secondary-link( + href="{{ url_for('cloud.services') }}", + data-toggle='dropdown-tab', + data-tab-target='services', + class="{% if title == 'services' %}active{% endif %}") + i.mr-2.pi-whoosh + span Services +| {% endmacro %} + + +| {% macro dropdown_main_home(title) %} ++nav-secondary-link( + href="{{ url_for('main.main_blog') }}") + i.pi-newspaper + span Blog + ++nav-secondary-link( + href="{{ url_for('projects.index') }}") + i.pi-star + span My Projects + +| {% if current_user.has_organizations() %} ++nav-secondary-link( + href="{{ url_for('pillar.web.organizations.index') }}") + i.pi-users + span My Organizations +| {% endif %} + ++nav-secondary-link( + href="{{ url_for('projects.home_project_shared_images')}}") + i.pi-picture + span Image Sharing + ++nav-secondary-link( + href="{{ url_for('projects.home_project') }}") + i.pi-blender + span Blender Sync +| {% endmacro %} + + +| {% macro dropdown_main_open_projects(title) %} ++nav-secondary-link( + href="{{ url_for('cloud.open_projects') }}", + class="nav-see-more border-bottom") + span.font-weight-bold + | Open Projects + i.pi-angle-right.pl-2 + ++nav-secondary-link( + href="{{ url_for('projects.view', project_url='spring') }}") + span Spring + ++nav-secondary-link( + href="{{ url_for('projects.view', project_url='hero') }}") + span Hero + ++nav-secondary-link( + href="{{ url_for('projects.view', project_url='dailydweebs') }}") + span The Daily Dweebs + ++nav-secondary-link( + href="{{ url_for('projects.view', project_url='agent-327') }}") + span Agent 327 +| {% endmacro %} + + +| {% macro dropdown_main_learn(title) %} ++nav-secondary-link( + href="{{ url_for('cloud.learn') }}", + class="nav-see-more border-bottom") + span.font-weight-bold + | Learn + i.pi-angle-right.pl-2 + ++nav-secondary-link( + href="{{ url_for('cloud.courses') }}") + i.pi-graduation-cap + span Courses + ++nav-secondary-link( + href="{{ url_for('cloud.workshops') }}") + i.pi-lightbulb + span Workshops + ++nav-secondary-link( + href="{{ url_for('cloud.production') }}") + i.pi-puzzle + span.new Production Lessons +| {% endmacro %} + + +| {% macro dropdown_main_libraries(title) %} ++nav-secondary-link( + href="{{ url_for('cloud.libraries') }}", + class="nav-see-more border-bottom") + span.font-weight-bold + | Libraries + i.pi-angle-right.pl-2 + ++nav-secondary-link( + href="{{ url_for('projects.view', project_url='textures') }}") + i.pi-folder-texture + span Textures + ++nav-secondary-link( + href="{{ url_for('projects.view', project_url='hdri') }}") + i.pi-globe + span HDRI + ++nav-secondary-link( + href="{{ url_for('projects.view', project_url='characters') }}") + i.pi-character + span Characters + ++nav-secondary-link( + href="{{ url_for('projects.view', project_url='gallery') }}") + i.pi-picture + span Art Gallery +| {% endmacro %} + + +| {% macro dropdown_main_services(title) %} ++nav-secondary-link( + href="{{ url_for('cloud.services') }}", + class="nav-see-more border-bottom") + span.font-weight-bold + | Services + i.pi-angle-right.pl-2 + ++nav-secondary-link( + href="/attract") + i.pi-attract + span Attract + ++nav-secondary-link( + href="/flamenco") + i.pi-attract + span Flamenco + ++nav-secondary-link( + href="{{ url_for('cloud.services') }}#blender-cloud-add-on") + i.pi-blender + span Blender Cloud add-on + ++nav-secondary-link( + href="{{ url_for('cloud.services') }}#texture-browser") + i.pi-texture + span Texture & HDRI Browser +| {% endmacro %} + + +| {# +| Secondary Navigation Bars. +| They include the nav-secondary() container unlike dropdown entries which are just links. +| #} + | {% macro navigation_homepage(title) %} +nav-secondary() +nav-secondary-link( @@ -29,9 +220,9 @@ include ../../../../pillar/src/templates/mixins/components span Services | {% endmacro %} + | {% macro navigation_learn(title) %} +nav-secondary - | {% if title in ['learn', 'courses', 'workshops', 'production'] %} +nav-secondary-link( class="px-0 text-black-50 {% if title == 'learn' %}active{% endif %}", href="{{ url_for('cloud.learn') }}") @@ -54,13 +245,6 @@ include ../../../../pillar/src/templates/mixins/components class="{% if title == 'production' %}active{% endif %}", href="{{ url_for('cloud.production') }}") span.new Production Lessons - - | {% elif title in ['open-projects'] %} - +nav-secondary-link( - class="{% if title == 'open-projects' %}active{% endif %}", - href="{{ url_for('cloud.open_projects') }}") - span Open Projects - | {% endif %} | {% endmacro %} diff --git a/src/templates/menus/_dropdown_main.pug b/src/templates/menus/_dropdown_main.pug index d0e5c7d..42556ff 100644 --- a/src/templates/menus/_dropdown_main.pug +++ b/src/templates/menus/_dropdown_main.pug @@ -1,181 +1,38 @@ +| {% import '_macros/_navigation.html' as navigation %} + include ../../../../pillar/src/templates/mixins/components ul.dropdown-menu.nav-main +nav-secondary()( class="nav-secondary-vertical float-left bg-light border-left rounded-left") - +nav-secondary-link( - href="{{ url_for('main.homepage') }}", - data-toggle='dropdown-tab', - data-tab-target='home') - i.mr-2.pi-home - span Homepage - - +nav-secondary-link( - href="{{ url_for('cloud.open_projects') }}", - data-toggle='dropdown-tab', - data-tab-target='films') - i.mr-2.pi-film-thick - span Open Projects - - +nav-secondary-link( - href="{{ url_for('cloud.learn') }}", - data-toggle='dropdown-tab', - data-tab-target='learn') - i.mr-2.pi-graduation-cap - span Learn - - +nav-secondary-link( - href="{{ url_for('cloud.libraries') }}", - data-toggle='dropdown-tab', - data-tab-target='libraries') - i.mr-2.pi-file-archive - span Libraries - - +nav-secondary-link( - href="{{ url_for('cloud.services') }}", - data-toggle='dropdown-tab', - data-tab-target='services', - class="{% if title == 'services' %}active{% endif %}") - i.mr-2.pi-whoosh - span Services + | {{ navigation.dropdown_main_root(title) }} .dropdown-menu-tab(data-tab='home') .dropdown-menu-column - +nav-secondary()(class="nav-secondary-vertical rounded-right border-left overflow-hidden") - +nav-secondary-link( - href="{{ url_for('main.main_blog') }}") - i.pi-newspaper - span Blog + +nav-secondary()( + class="nav-secondary-vertical rounded-right border-left overflow-hidden") + | {{ navigation.dropdown_main_home(title) }} - +nav-secondary-link( - href="{{ url_for('projects.index') }}") - i.pi-star - span My Projects - - | {% if current_user.has_organizations() %} - +nav-secondary-link( - href="{{ url_for('pillar.web.organizations.index') }}") - i.pi-users - span My Organizations - | {% endif %} - - +nav-secondary-link( - href="{{ url_for('projects.home_project_shared_images')}}") - i.pi-picture - span Image Sharing - - +nav-secondary-link( - href="{{ url_for('projects.home_project') }}") - i.pi-blender - span Blender Sync - - .dropdown-menu-tab(data-tab='films') + .dropdown-menu-tab(data-tab='open-projects') .dropdown-menu-column - +nav-secondary()(class="nav-secondary-vertical rounded-right border-left overflow-hidden") - +nav-secondary-link( - href="{{ url_for('cloud.open_projects') }}", - class="nav-see-more border-bottom") - span.font-weight-bold - | Open Projects - i.pi-angle-right.pl-2 - - +nav-secondary-link( - href="{{ url_for('projects.view', project_url='spring') }}") - span Spring - - +nav-secondary-link( - href="{{ url_for('projects.view', project_url='hero') }}") - span Hero - - +nav-secondary-link( - href="{{ url_for('projects.view', project_url='dailydweebs') }}") - span The Daily Dweebs - - +nav-secondary-link( - href="{{ url_for('projects.view', project_url='agent-327') }}") - span Agent 327 + +nav-secondary()( + class="nav-secondary-vertical rounded-right border-left overflow-hidden") + | {{ navigation.dropdown_main_open_projects(title) }} .dropdown-menu-tab(data-tab='learn') .dropdown-menu-column - +nav-secondary()(class="nav-secondary-vertical rounded-right border-left overflow-hidden") - +nav-secondary-link( - href="{{ url_for('cloud.learn') }}", - class="nav-see-more border-bottom") - span.font-weight-bold - | Learn - i.pi-angle-right.pl-2 - - +nav-secondary-link( - href="{{ url_for('cloud.courses') }}") - i.pi-graduation-cap - span Courses - - +nav-secondary-link( - href="{{ url_for('cloud.workshops') }}") - i.pi-lightbulb - span Workshops - - +nav-secondary-link( - href="{{ url_for('cloud.production') }}") - i.pi-puzzle - span.new Production Lessons + +nav-secondary()( + class="nav-secondary-vertical rounded-right border-left overflow-hidden") + | {{ navigation.dropdown_main_learn(title) }} .dropdown-menu-tab(data-tab='libraries') .dropdown-menu-column - +nav-secondary()(class="nav-secondary-vertical rounded-right border-left overflow-hidden") - +nav-secondary-link( - href="{{ url_for('cloud.libraries') }}", - class="nav-see-more border-bottom") - span.font-weight-bold - | Libraries - i.pi-angle-right.pl-2 - - +nav-secondary-link( - href="{{ url_for('projects.view', project_url='textures') }}") - i.pi-folder-texture - span Textures - - +nav-secondary-link( - href="{{ url_for('projects.view', project_url='hdri') }}") - i.pi-globe - span HDRI - - +nav-secondary-link( - href="{{ url_for('projects.view', project_url='characters') }}") - i.pi-character - span Characters - - +nav-secondary-link( - href="{{ url_for('projects.view', project_url='gallery') }}") - i.pi-picture - span Art Gallery + +nav-secondary()( + class="nav-secondary-vertical rounded-right border-left overflow-hidden") + | {{ navigation.dropdown_main_libraries(title) }} .dropdown-menu-tab(data-tab='services') .dropdown-menu-column - +nav-secondary()(class="nav-secondary-vertical rounded-right border-left overflow-hidden") - +nav-secondary-link( - href="{{ url_for('cloud.services') }}", - class="nav-see-more border-bottom") - span.font-weight-bold - | All Services - i.pi-angle-right.pl-2 - - +nav-secondary-link( - href="/attract") - i.pi-attract - span Attract - - +nav-secondary-link( - href="/flamenco") - i.pi-attract - span Flamenco - - +nav-secondary-link( - href="{{ url_for('cloud.services') }}#blender-cloud-add-on") - i.pi-blender - span Blender Cloud add-on - - +nav-secondary-link( - href="{{ url_for('cloud.services') }}#texture-browser") - i.pi-texture - span Texture & HDRI Browser + +nav-secondary()( + class="nav-secondary-vertical rounded-right border-left overflow-hidden") + | {{ navigation.dropdown_main_services(title) }}