From 06231a149ea8f7ce71a7ca18a039705bf060d1ad Mon Sep 17 00:00:00 2001
From: Chris Fiege <chris@tinyhost.de>
Date: Wed, 16 Oct 2019 21:34:40 +0200
Subject: [PATCH] firmware: Add download Links

Signed-off-by: Chris Fiege <chris@tinyhost.de>
---
 flamingo/content/firmware/index.rst     | 13 -------------
 flamingo/content/mitmachen/firmware.rst | 17 +++++++++++++++++
 flamingo/theme/templates/firmware.html  | 23 ++++++++++++++++++-----
 3 files changed, 35 insertions(+), 18 deletions(-)
 delete mode 100644 flamingo/content/firmware/index.rst
 create mode 100644 flamingo/content/mitmachen/firmware.rst

diff --git a/flamingo/content/firmware/index.rst b/flamingo/content/firmware/index.rst
deleted file mode 100644
index 3fb8500..0000000
--- a/flamingo/content/firmware/index.rst
+++ /dev/null
@@ -1,13 +0,0 @@
-template: firmware.html
-
-
-Firmware
-========
-
-Diese Seite gibt einen Überblick über die Änderungen zwischen unterschiedlichen
-Versionen der Freifunk Braunschweig Firmware.
-
-Die aktuellste Firmware kann `hier <https://firmware.freifunk-bs.de>`__ heruntergeladen
-werden.
-Solltest du eine ältere Firmware benötigen kannst du dich über
-`Kontakt </kontakt.html>`__ an uns wenden.
diff --git a/flamingo/content/mitmachen/firmware.rst b/flamingo/content/mitmachen/firmware.rst
new file mode 100644
index 0000000..468a145
--- /dev/null
+++ b/flamingo/content/mitmachen/firmware.rst
@@ -0,0 +1,17 @@
+template: firmware.html
+sort: 95
+
+
+Firmware
+========
+
+Diese Seite gibt einen Überblick über die Änderungen zwischen unterschiedlichen
+Versionen der Freifunk Braunschweig Firmware.
+
+Die aktuellste Firmware kann über den folgenden Link heruntergeladen werden.
+werden.
+Solltest du eine ältere Firmware benötigen kannst du dich über
+`Kontakt </kontakt.html>`__ an uns wenden.
+
+:raw-html:`<button type="button" class="btn btn-success" style="display: flex; align-items:center;"><i class="fas fa-download" style="font-size:150%; margin-right:0.5em;"></i> Firmware herunterladen</button>`
+
diff --git a/flamingo/theme/templates/firmware.html b/flamingo/theme/templates/firmware.html
index 8fed4f0..ff1613d 100644
--- a/flamingo/theme/templates/firmware.html
+++ b/flamingo/theme/templates/firmware.html
@@ -2,6 +2,9 @@
 
 
 {% block content %}
+<style>
+    p .fab, p .fas { width:1.05em; }
+</style>
 <div class="container" >
     <div class="page-header" >
         <h1>{{ content.content_title }}</h1>
@@ -9,7 +12,9 @@
     {{ content.content_body }}
 
     {% with contents=context.contents.filter(path__startswith="firmware/v").order_by("-content_title") %}
+    {% with latest_release=contents[:1].values("content_title")[0] %}
     {% for content in contents %}
+    <hr>
         <h2>{{content.content_title}}</h2>
         {% if content.date is not none%}
         <p>
@@ -17,27 +22,35 @@
         </p>
         {% endif %}
         {% if content.branches is not none %}
-        <p>
+        <p style="border-left: 2px solid #444; padding-left:1em; margin-left:0.4em;">
             {% with branches=content.branches %}
             {% for branch in branches %}
             <i class="fas fa-code-branch"></i>
             Freigeben in {{ branch["channel"] }}
-            als <i>{{branch["name"]}}</i>{% if branch["date"] is defined %} am {{branch["date"]}}{% endif %}.<br>
+            als <i>{{branch["name"]}}</i>{% if branch["date"] is defined %} am {{branch["date"]}}{% endif %}<br>
             {% endfor %}
             {% endwith %}
             {% if content.site is not none %}
-            <a href="{{content.site}}" ><i class="fab fa-gitlab"></i> Site Git Repository</a><br>
+            <i class="fab fa-gitlab"></i> <a href="{{content.site}}" >Site Git Repository</a><br>
             {% endif %}
             {% if content.gluon is not none %}
-            <a href="{{content.gluon}}" ><i class="fab fa-gitlab"></i> Gluon Git Repository</a><br>
+            <i class="fas fa-book"></i> <a href="{{content.gluon}}" >Gluon Git Repository</a><br>
             {% endif %}
             {% if content.rtd is not none %}
-            <a href="{{content.rtd}}" ><i class="fas fa-book"></i> Release Notes</a><br>
+            <i class="fas fa-book"></i> <a href="{{content.rtd}}" >Release Notes</a><br>
+            {% endif %}
+            <i class="fas fa-download" style=""></i>
+            {% if content.content_title == latest_release %}
+            <a href="https://firmware.freifunk-bs.de" >Hier herunterladen</a>
+            {% else %}
+            Nicht mehr online verfügbar. (<a href="/kontakt.html" >Kontakt</a>)
             {% endif %}
         </p>
         {% endif %}
+        <h3 style="margin-top:9px;">Änderungen</h3>
         {{content.content_body}}
     {% endfor %}
     {% endwith %}
+    {% endwith %}
 </div>
 {% endblock %}
-- 
GitLab