[rb-commits] [website] master: Adapt site templates to have space and navigation for event sub-pages (66e1782)

lunar at jenkins.debian.net lunar at jenkins.debian.net
Thu Jan 14 19:30:19 CET 2016


Repository : ssh://jenkins/website

On branch  : master

>---------------------------------------------------------------

commit 66e1782ed9d6d684d40189161d022b92a888feff
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Thu Jan 7 15:44:05 2016 +0100

    Adapt site templates to have space and navigation for event sub-pages


>---------------------------------------------------------------

66e1782ed9d6d684d40189161d022b92a888feff
 _includes/event_contents.html             | 44 +++++++++++++++++++++++++++++++
 _layouts/{docs.html => event_detail.html} |  3 +--
 events.html                               |  2 ++
 3 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/_includes/event_contents.html b/_includes/event_contents.html
new file mode 100644
index 0000000..d666da9
--- /dev/null
+++ b/_includes/event_contents.html
@@ -0,0 +1,44 @@
+{% for site_page in site.events %}
+  {% assign event_name = site_page.url | split: "/" | last %}
+  {% if event_name == page.event %}
+    {% assign event_page = site_page %}
+    {% break %}
+  {% endif %}
+{% endfor %}
+{% assign sorted_events = site.events | sort: 'order' %}
+<div class="hide-on-mobiles">
+  <aside>
+    <h4><a href="{{ event_page.url | prepend: site.baseurl }}">{{ event_page.title }}</a></h4>
+    <p>{{ event_page.event_date_string }}</p>
+    <ul>
+      {% for site_page in sorted_events %}
+        {% if site_page.order %}
+          {% assign dirs = site_page.url | split: "/" %}
+          {% if dirs[2] == event_name %}
+            {% if site_page.url == page.url %}
+              {% assign c = "current" %}
+            {% else %}
+              {% assign c = "" %}
+            {% endif %}
+            <li class="{{ c }}"><a href="{{ site_page.url | prepend: site.baseurl }}">{{ site_page.title }}</a></li>
+          {% endif %}
+        {% endif %}
+      {% endfor %}
+    </ul>
+  </aside>
+</div>
+<div class="show-on-mobiles">
+  <select onchange="if (this.value) window.location.href=this.value">
+    <option value="">Navigate…</option>
+    <optgroup label="{{ event_page.title }}">
+      {% for site_page in sorted_events %}
+        {% if site_page.order %}
+          {% assign dirs = site_page.url | split: "/" %}
+          {% if dirs[2] == event_name %}
+            <option value="{{ site_page.url | prepend: site.baseurl }}">{{ site_page.title }}</option>
+          {% endif %}
+        {% endif %}
+      {% endfor %}
+    </optgroup>
+  </select>
+</div>
diff --git a/_layouts/docs.html b/_layouts/event_detail.html
similarity index 81%
copy from _layouts/docs.html
copy to _layouts/event_detail.html
index 0eacdc6..dbf6ff4 100644
--- a/_layouts/docs.html
+++ b/_layouts/event_detail.html
@@ -4,8 +4,7 @@ layout: default
 <div class="post">
   <div class="row">
     <div class="four columns">
-      {% include docs_contents.html %}
-      {% include docs_contents_mobile.html %}
+      {% include event_contents.html %}
     </div>
     <div class="eight columns">
       <header class="post-header">
diff --git a/events.html b/events.html
index 2d3d9b7..ec8b562 100644
--- a/events.html
+++ b/events.html
@@ -17,6 +17,7 @@ permalink: /events/
 
 {% assign sorted_events = site.events | sort: 'event_date' | reverse %}
 {% for page in sorted_events %}
+{% if page.event_date_string %}
 <div class="row">
   <div class="four columns title">
     <h2>{{ page.title }}</h2>
@@ -27,4 +28,5 @@ permalink: /events/
     <p><a href="{{ page.permalink | prepend: site.baseurl }}">Read more…</a></p>
   </div>
 </div>
+{% endif %}
 {% endfor %}



More information about the rb-commits mailing list