Template for child pages; auto-footer; etc.

This commit is contained in:
mDuo13
2018-04-17 18:20:13 -07:00
parent 654986e154
commit 71dc422567
6 changed files with 112 additions and 82 deletions

View File

@@ -66,7 +66,7 @@ pages:
doc_type: Concepts doc_type: Concepts
category: Payment System category: Payment System
html: concept-payment-system.html html: concept-payment-system.html
template: template-cat-landing.html template: template-landing-category.html
targets: targets:
- local - local
@@ -113,7 +113,7 @@ pages:
doc_type: Concepts doc_type: Concepts
category: Consensus Network category: Consensus Network
html: concept-consensus-network.html html: concept-consensus-network.html
template: template-cat-landing.html template: template-landing-category.html
targets: targets:
- local - local
@@ -143,7 +143,7 @@ pages:
doc_type: References doc_type: References
category: rippled API Public Methods category: rippled API Public Methods
html: reference-rippled-public.html html: reference-rippled-public.html
template: template-cat-landing.html template: template-landing-category.html
targets: targets:
- local - local
@@ -222,7 +222,7 @@ pages:
doc_type: References doc_type: References
category: rippled API Admin Methods category: rippled API Admin Methods
html: reference-rippled-admin.html html: reference-rippled-admin.html
template: template-cat-landing.html template: template-landing-category.html
targets: targets:
- local - local
@@ -231,7 +231,7 @@ pages:
doc_type: References doc_type: References
category: rippled API Admin Methods category: rippled API Admin Methods
subcategory: Server Control Methods subcategory: Server Control Methods
template: template-cat-landing.html template: template-landing-category.html
targets: targets:
- local - local
@@ -240,21 +240,21 @@ pages:
doc_type: References doc_type: References
category: Test Empty Category category: Test Empty Category
html: reference-rippled-conventions.html html: reference-rippled-conventions.html
template: template-cat-landing.html template: template-landing-category.html
targets: targets:
- local - local
- name: Use Cases - name: Use Cases
funnel: Use Cases funnel: Use Cases
html: use-cases.html html: use-cases.html
template: template-cat-landing.html # TODO: use-cases landing template: template-landing-category.html # TODO: use-cases landing
targets: targets:
- local - local
- name: Dev Tools - name: Dev Tools
funnel: Dev Tools funnel: Dev Tools
html: dev-tools.html html: dev-tools.html
template: template-cat-landing.html # TODO: dev tools landing template: template-landing-category.html # TODO: dev tools landing
targets: targets:
- local - local
@@ -301,7 +301,7 @@ pages:
- name: News - name: News
funnel: News funnel: News
html: news.html html: news.html
template: template-cat-landing.html # TODO: news landing template: template-landing-category.html # TODO: news landing
targets: targets:
- local - local

View File

@@ -421,6 +421,7 @@ th {
line-height: 38px; line-height: 38px;
color: #27a2db; color: #27a2db;
text-decoration: none; text-decoration: none;
transition: 0.5s;
} }
.navbar-default .navbar-nav .active a { .navbar-default .navbar-nav .active a {
@@ -955,12 +956,8 @@ th {
font-size: font-size:
} }
.foot-nav-col .children-display ul { .children-display ul {
padding-left: 20px;
}
.foot-nav-col .children-display li {
padding-left: 0; padding-left: 0;
margin-left: 0;
} }
.foot-nav-col .children-display li:before { .foot-nav-col .children-display li:before {
content: ""; content: "";

View File

@@ -1,23 +1,32 @@
<footer class="content-info" role="contentinfo"> <footer class="content-info" role="contentinfo">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-sm-1">&nbsp;</div>
{% set funnels = [] %} {% set funnels = [] %}
{% for page in pages %} {% for page in pages %}
{% if page.funnel is defined and page.funnel not in funnels %} {% if page.funnel is defined and page.funnel not in funnels %}
{% set parent_page = pages|selectattr('funnel', 'equalto', page.funnel)|first %} {% set parent_page = pages|selectattr('funnel', 'equalto', page.funnel)|first %}
<!--{#<li class="nav-item{% if currentpage == thisfunneltop %} active{% elif currentpage.funnel == thisfunneltop.name %} active-parent{% endif %}"> <div class="col-sm-2 foot-nav-col">
<a class="nav-link" href="{{ thisfunneltop.html }}">{{ thisfunneltop.name }}</a> <h5><a class="foot-nav-link" href="{{ parent_page.html }}">{{ parent_page.name }}</a></h5>
</li>#}--> {% set depth=1 %}
{% include 'template-page-children.html' %}
</div><!--/.foot-nav-col -->
<div class="col-sm-3 foot-nav-col"> {% set _ = funnels.append(page.funnel) %}
<h5><a class="foot-nav-link" href="{{ parent_page.html }}">{{ parent_page.name }}</a></h5> {% endif %}
{% set depth=1 %} {% endfor %}
{% include 'template-page-children.html' %}
</div><!--/.foot-nav-col --> <div class="col-sm-2 foot-nav-col">
{% set _ = funnels.append(page.funnel) %} <h5><a class="foot-nav-link" href="https://ripple.com/">Ripple <i class="fa fa-external-link"></i></a></h5>
{% endif %} <div class="children-display">
{% endfor %} <ul>
<li class="level-1"><a class="foot-nav-link" href="https://ripple.com/company/">Our Company <i class="fa fa-external-link"></i></a></li>
<li class="level-1"><a class="foot-nav-link" href="https://ripple.com/company/careers/">Careers <i class="fa fa-external-link"></i></a></li>
<li class="level-1"><a href="https://ripple.com/collateral/#xrp">XRP Resources <i class="fa fa-external-link"></i></a></li>
</ul>
</div>
</div><!--/.foot-nav-col -->
</div><!--/.row--> </div><!--/.row-->
</div> </div>

View File

@@ -11,16 +11,27 @@
{% block main %} {% block main %}
<h1 class="main-page-header">{{ currentpage.name }}</h1> <h1 class="main-page-header">{{ currentpage.name }}</h1>
<section> <section class="container">
{% for grouper, docpages in pages|selectattr("doc_type", "defined")|groupby("doc_type") %} <div class="row">
<div class="panel panel-default"> {% set doc_types = [] %}
<h3><a href="{{(docpages|list)[0].html}}">{{ grouper }}</a></h3> {% for page in pages %}
<ul> {% if page.doc_type is defined and page.doc_type not in doc_types %}
{% for cat, catpages in docpages|selectattr("category", "defined")|groupby("category") %} {% set doc_type_top = pages|selectattr('doc_type', 'equalto', page.doc_type)|first %}
<li><a href="{{(catpages|first).html}}">{{ (catpages|first).name }}</a></li> <div class="col-sm-3">
{% endfor %} <div class="panel panel-default">
</ul> <div class="panel-heading">
</div> <h3 class="panel-title"><a href="{{doc_type_top.html}}">{{doc_type_top.name}}</a></h3>
</div><!--/.panel-heading-->
<div class="panel-body">
{% set parent_page = doc_type_top %}
{% set depth = 3 %}
{% include 'template-page-children.html' %}
</div><!--/.panel-body-->
</div><!--/.panel-->
</div><!--/.col-sm-3-->
{% set _ = doc_types.append(page.doc_type) %}
{% endif %}
{% endfor %} {% endfor %}
</div><!--/.row-->
</section> </section>
{% endblock %} {% endblock %}

View File

@@ -1,60 +1,73 @@
{% if parent_page is undefined %} {% if parent_page is undefined %}
{% set parent_page = currentpage %} {% set parent_page = currentpage %}
{% endif %} {% endif %}
{% if depth is undefined %}
{% if parent_level is undefined %} {% set depth = 5 %}
{% if parent_page.funnel is undefined %}
<!-- TEMPLATE ERROR: need funnel for children-display -->
{% elif parent_page == pages|selectattr("funnel", "equalto", parent_page.funnel)|first %}
{% set parent_level = "funnel" %}
{% elif parent_page == pages|selectattr("doc_type", "equalto", parent_page.doc_type)|first %}
{% set parent_level = "doc_type" %}
{% elif parent_page == pages|selectattr("category", "equalto", parent_page.category)|first %}
{% set parent_level = "category" %}
{% elif parent_page == pages|selectattr("subcategory", "equalto", parent_page.subcategory)|first %}
{% set parent_level = "subcategory" %}
{% else %}
<!-- TEMPLATE ERROR: page {{parent_page.name}} is not the parent of anything? -->
{% endif %}
<!-- parent_level is {{parent_level}} -->
{% set childpages = pages|selectattr(parent_level, "equalto", parent_page[parent_level])|list %}
{% endif %} {% endif %}
{% if parent_page.funnel is undefined %}
<!-- TEMPLATE ERROR: need funnel for children-display -->
{% elif parent_page == pages|selectattr("funnel", "equalto", parent_page.funnel)|first %}
{% set parent_level = "funnel" %}
{% set level_2 = "doc_type" %}
{% set level_3 = "category" %}
{% elif parent_page == pages|selectattr("doc_type", "equalto", parent_page.doc_type)|first %}
{% set parent_level = "doc_type" %}
{% set level_2 = "category" %}
{% set level_3 = "subcategory" %}
{% elif parent_page == pages|selectattr("category", "equalto", parent_page.category)|first %}
{% set parent_level = "category" %}
{% set level_2 = "subcategory" %}
{% set level_3 = None %}
{% elif parent_page == pages|selectattr("subcategory", "equalto", parent_page.subcategory)|first %}
{% set parent_level = "subcategory" %}
{% set level_2 = None %}
{% set level_3 = None %}
{% else %}
<!-- TEMPLATE ERROR: page {{parent_page.name}} is not the parent of anything? -->
{% endif %}
<!-- parent_level is {{parent_level}} -->
{% set childpages = pages|selectattr(parent_level, "equalto", parent_page[parent_level])|list %}
<div class="children-display"> <div class="children-display">
<ul> <ul>
{% set printed_subcategories = [] %} {% set printed_level2s = [] %}
{% for page in childpages %} {% for page in childpages %}
{% if page == parent_page %}{# skip parent #} {% if page == parent_page %}{# skip parent #}
{% elif level_2 == None or page[level_2] is undefined %}
{% elif parent_level == "funnel" %}
{% if page.doc_type is defined and page in childpages|selectattr("category", "undefined") %}
<li class="level-1"><a href="{{page.html}}">{{page.name}}</a></li>
{% elif not childpages|selectattr("category", "defined")|list %}
{# no categories in this funnel #}
<li class="level-1"><a href="{{page.html}}">{{page.name}}</a></li>
{% endif %}
{% elif parent_level == "category" %}
{% if page.subcategory is defined and (depth is undefined or depth > 1) %}
{% if page.subcategory not in printed_subcategories %}
{% for subpage in childpages|selectattr("subcategory", "equalto", page.subcategory) %}
{% if loop.index == 1 %}
<li class="level-1"><a href="{{subpage.html}}">{{subpage.name}}</a></li>
{% else %}
<li class="level-2"><a href="{{subpage.html}}">{{subpage.name}}</a></li>
{% endif %}
{% endfor %}
{% set _ = printed_subcategories.append(page.subcategory) %}
{% endif %}
{% else %}
{# non-subcategory page #}
<li class="level-1"><a href="{{page.html}}">{{page.name}}</a></li>
{% endif %}
{% else %}
<!-- TEMPLATE WARNING: unhandled case -->
<li class="level-1"><a href="{{page.html}}">{{page.name}}</a></li> <li class="level-1"><a href="{{page.html}}">{{page.name}}</a></li>
{% endif %} {% elif page[level_2] is defined %}
{% if page[level_2] not in printed_level2s %}
{% set printed_level3s = [] %}
{% set subpages = childpages|selectattr(level_2, "equalto", page[level_2])|list %}
{% for subpage in subpages %}
{% if loop.index == 1 %}
<li class="level-1"><a href="{{subpage.html}}">{{subpage.name}}</a></li>
{% else %}
{% if depth > 1 %}
{% if level_3 == None or subpage[level_3] is undefined %}
<li class="level-2"><a href="{{subpage.html}}">{{subpage.name}}</a></li>
{% elif subpage[level_3] is defined %}
{% if subpage[level_3] not in printed_level3s %}
{% for subsubpage in subpages|selectattr(level_3, "equalto", subpage[level_3])|list %}
{% if loop.index == 1 %}
<li class="level-2"><a href="{{subsubpage.html}}">{{subsubpage.name}}</a></li>
{% elif depth > 2 %}
<li class="level-3"><a href="{{subsubpage.html}}">{{subsubpage.name}}</a></li>
{% endif %}
{% endfor %}
{% set _ = printed_level3s.append(subpage[level_3]) %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% set _ = printed_level2s.append(page[level_2]) %}
{% endif %}
{% else %}
<!-- TEMPLATE warning: else case -->
{% endif %}
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>