[tor-commits] [community/develop] Use databags for training resources

pili at torproject.org pili at torproject.org
Wed Oct 16 14:12:07 UTC 2019


commit b37bee859afbf66b8bfb58cf7adb19e57b6f35d8
Author: Pili Guerra <pili at piliguerra.com>
Date:   Wed Oct 16 16:10:29 2019 +0200

    Use databags for training resources
---
 databags/training-resources.json | 11 +++++++++++
 templates/macros/resources.html  |  1 -
 templates/resource.html          |  1 -
 templates/resources.html         | 16 ++++++++++++----
 4 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/databags/training-resources.json b/databags/training-resources.json
new file mode 100644
index 0000000..b1fecd7
--- /dev/null
+++ b/databags/training-resources.json
@@ -0,0 +1,11 @@
+{
+    "all-about-tor" : 
+    {
+        "label" : "All About Tor",
+        "name" : "all-about-tor",
+        "filename" : "all-about-tor-full-pack",
+        "formats" : ["odp","md"],
+        "description" : "Full set of slides for Tor Trainings",
+        "date" : "2019"
+    }
+}
\ No newline at end of file
diff --git a/templates/macros/resources.html b/templates/macros/resources.html
deleted file mode 120000
index fa7524a..0000000
--- a/templates/macros/resources.html
+++ /dev/null
@@ -1 +0,0 @@
-../../lego/templates/macros/resources.html
\ No newline at end of file
diff --git a/templates/resource.html b/templates/resource.html
deleted file mode 100644
index 0b1bdf2..0000000
--- a/templates/resource.html
+++ /dev/null
@@ -1 +0,0 @@
-{{ this.name }}
\ No newline at end of file
diff --git a/templates/resources.html b/templates/resources.html
index d40c313..778d76a 100644
--- a/templates/resources.html
+++ b/templates/resources.html
@@ -14,10 +14,18 @@
             </tr>
           </thead>
           <tbody>
-            {% from "macros/resources.html" import render_resource %}
-            {% for item in this.attachments %}
-              {{ render_resource(item) }}
-            {% endfor %}
+          {% for id, item in bag('training-resources').items() %}
+            <tr>
+              <td>{{ item.label}}</td>
+              <td>{{ item.description }}</td>
+              <td>
+                {% for format in item.formats %}
+                <a href="https://gitweb.torproject.org/community/training.git/plain/{{ item.date }}/{{ item.name }}/{{ item.filename }}.{{format}}">{{ format }}</a> 
+                {% endfor %}
+              </td>
+              <td>{{ item.date }}</td>
+            </tr>
+          {% endfor %}
           </tbody>
         </table>
       </div>



More information about the tor-commits mailing list