[tor-commits] [community/staging] Use two columns template and fix current section pagenav underline

pili at torproject.org pili at torproject.org
Thu Jun 6 10:09:42 UTC 2019


commit 8b62be6aea4912af7df25538984ecc1ab7d902bb
Author: hiro <hiro at torproject.org>
Date:   Tue Jun 4 19:36:23 2019 +0200

    Use two columns template and fix current section pagenav underline
---
 .../becoming-tor-translator/contents.lr            |  2 +-
 templates/localization.html                        |  6 +++
 templates/pagenav.html                             |  6 ++-
 templates/sidenav.html                             | 44 ++++++++--------------
 templates/two-columns-page.html                    |  6 +++
 5 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/content/localization/becoming-tor-translator/contents.lr b/content/localization/becoming-tor-translator/contents.lr
index 2983a8a..7628797 100644
--- a/content/localization/becoming-tor-translator/contents.lr
+++ b/content/localization/becoming-tor-translator/contents.lr
@@ -13,7 +13,7 @@ subtitle: Becoming a translator for the Tor Project
 ---
 key: 1
 ---
-html: localization.html
+html: two-columns-page.html
 ---
 body:
 
diff --git a/templates/localization.html b/templates/localization.html
index 23c5a44..d52e348 100644
--- a/templates/localization.html
+++ b/templates/localization.html
@@ -20,8 +20,14 @@
         <div class="card h-100 border-0">
           <div class="card-body">
             <div class="card-body">
+<<<<<<< HEAD
               <h4 class="text-primary">.{{ child.key }}</h4>
               <h4 class="card-title text-primary"><a href="{{ child.path|url }}">{{ _(child.title) }}</a></h4>
+=======
+              <h4 class="card-title text-primary">
+                <a href="{{ child.path|url(alt=this.alt) }}">{{ _(child.title) }}</a>
+              </h4>
+>>>>>>> b231142... Use two columns template and fix current section pagenav underline
               <p class="card-text">{{ _(child.subtitle) }}</p>
             </div>
           </div>
diff --git a/templates/pagenav.html b/templates/pagenav.html
index 90f5ff9..37bfe58 100644
--- a/templates/pagenav.html
+++ b/templates/pagenav.html
@@ -4,11 +4,13 @@
       <ul class="nav">
         {% set menubag = 'pagenav' + '+' + this.alt %}
         {% for id, item in bag(menubag).items() %}
-        <li{% if this.path == '/' + item.path %} class="nav-item active border-active" {% else %} class="nav-item" {% endif %}>
+        {% set abs_path = item.path %}
+        <li{% if this.is_child_of(abs_path) %} class="nav-item active border-active" {% else %} class="nav-item" {% endif %}>
           {% set elm = site.get(item.path) %}
           {% if elm %}
             <a class="nav-link" href="{{ elm.path|url }}">{{ item.label }}
-          {% elif this.path == '/' + item.path %}
+          {% endif %}
+          {% if this.is_child_of(abs_path) %}
             <span class="sr-only">(current)</span>
           {% endif %}
           </a>
diff --git a/templates/sidenav.html b/templates/sidenav.html
index 8490aad..489faeb 100644
--- a/templates/sidenav.html
+++ b/templates/sidenav.html
@@ -1,7 +1,7 @@
 <div class="container-fluid sidebar col-xs-12 col-sm-12 col-md-3 col-lg-3">
   <nav class="smalltopics no-background navbar navbar-expand-lg navbar-light bg-white p-0 fixed">
     <a class="text-primary bg-white font-weight-bold navbar-brand" href="#collapseTopicsNav">
-	{{ _('Topics') }}
+	     {{ _('Topics') }}
     </a>
     <label class="side-toggler" for="menu-toggle">
       <a class="btn btn-lg outline-primary text-primary navbar-toggler chevron" data-toggle="collapse" data-target="#navbarSupportedTopicsContent" aria-controls="navbarSupportedTopicsContent" aria-expanded="false" aria-label="Toggle navigation">
@@ -13,40 +13,28 @@
 
     <div class="collapse navbar-collapse burger-menu" id="navbarSupportedTopicsContent">
       <ul class="nav nav-pills flex-column">
-	{% set topicbag = 'topics+en' %}
-	{% for id, item in bag(topicbag).items() %}
-    <li{% if this.is_child_of(item.path) %} class="nav-item" {% else %} class="toc-entry toc-h2 nav-item"{% endif %}>
-      <a role="button" {% if this.is_child_of(item.path) %} class="side-nav active" {% else %} class="side-nav" {% endif %}
-      {% if this.is_child_of(this.parent) %}
-        href="../../{{ item.path }}">
-      {% else %}
-        href="{{ item.path }}">
-      {% endif %}
-      {{ _(item.label) }}</a>
-    </li>
-	{% endfor %}
+        {% for child in this.parent.children %}
+          <li{% if this.is_child_of(child.path) %} class="toc-entry toc-h2 active nav-item" {% else %} class="toc-entry toc-h2 nav-item" {% endif %}>
+            <a role="button" {% if this.is_child_of(child.path) %} class="nav-link active" {% else %} class="nav-link" {% endif %}
+              href="{{ child.path|url(alt=this.alt) }}">{{ _(child.title) }}</a>
+          </li>
+      	{% endfor %}
     </ul>
     </div>
     <hr class="mb-0" />
   </nav>
 
-
   <nav class="d-none d-sm-block section-nav bg-white sidetopics sticky" id="sidenav-topics">
-          <h4 class="text-primary pl-4">{{ _('Topics') }}</h4>
+	  <h4 class="text-primary pl-4">{{ _("Topics") }}</h4>
     <ul class="nav nav-pills flex-column">
-      {% set topicbag = 'topics+en' %}
-      {% for id, item in bag(topicbag).items() %}
-        <li{% if this.is_child_of(item.path) %} class="nav-item" {% else %} class="toc-entry toc-h2 nav-item"{% endif %}>
-          <a role="button" {% if this.is_child_of(item.path) %} class="side-nav active" {% else %} class="side-nav" {% endif %}
-          {% if this.is_child_of(this.parent) %}
-            href="../../{{ item.path }}">
-          {% else %}
-            href="{{ item.path }}">
-          {% endif %}
-          {{ _(item.label) }}</a>
-      </li>
-
-      {% endfor %}
+    	{% for child in this.parent.children %}
+        <li{% if this.is_child_of(child.path) %} class="toc-entry toc-h2 active nav-item" {% else %} class="toc-entry toc-h2 nav-item" {% endif %}>
+          <a role="button" {% if this.is_child_of(child.path) %} class="nav-link active" {% else %} class="nav-link" {% endif %}
+            href="{{ child.path|url(alt=this.alt) }}">{{ _(child.title) }}</a>
+        </li>
+    	{% endfor %}
     </ul>
   </nav>
+
+
 </div>
diff --git a/templates/two-columns-page.html b/templates/two-columns-page.html
new file mode 100644
index 0000000..e1f1839
--- /dev/null
+++ b/templates/two-columns-page.html
@@ -0,0 +1,6 @@
+<div class="row pt-5">
+  {% include 'sidenav.html' %}
+  <div class="col-sm-12 col-xs-12  ml-sm-auto col-md-9 col-lg-9 {{ bag('alternatives', this.alt, 'order') }}">
+    {{ this.body }}
+  </div>
+</div>





More information about the tor-commits mailing list