[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tpo/staging] Use models for reports



commit f96624e8019a3748fb59382e2c90f2b54c242ebd
Author: hiro <hiro@xxxxxxxxxxxxxx>
Date:   Mon Jan 21 17:37:35 2019 +0100

    Use models for reports
---
 .../certificate-legal-existence/contents.lr        |  9 ++++
 content/about/reports/fiscal-year-2017/contents.lr | 11 ++++
 models/report.ini                                  | 32 +++++++++++
 models/reports.ini                                 | 28 ++++++++++
 templates/macros/reports.html                      | 16 ++++++
 templates/reports.html                             | 63 ++++------------------
 6 files changed, 106 insertions(+), 53 deletions(-)

diff --git a/content/about/reports/certificate-legal-existence/contents.lr b/content/about/reports/certificate-legal-existence/contents.lr
new file mode 100644
index 0000000..ea4ed8a
--- /dev/null
+++ b/content/about/reports/certificate-legal-existence/contents.lr
@@ -0,0 +1,9 @@
+_model: report
+---
+type: document
+---
+title: Tor Certificate of Legal Existence
+---
+description: Certificate of Legal Existence for Tor Project, Inc.
+---
+link: https://gitweb.torproject.org/company/policies.git/plain/corpdocs/Tor-Certificate-of-Legal-Existence.pdf
diff --git a/content/about/reports/fiscal-year-2017/contents.lr b/content/about/reports/fiscal-year-2017/contents.lr
new file mode 100644
index 0000000..2dfa9db
--- /dev/null
+++ b/content/about/reports/fiscal-year-2017/contents.lr
@@ -0,0 +1,11 @@
+_model: report
+---
+type: report
+---
+date: 2017
+---
+tag: Fiscal Year 2017
+---
+title: 2017 IRS Form 990
+---
+link: https://www.torproject.org/about/findoc/2017-TorProject-Form990.pdf
diff --git a/models/report.ini b/models/report.ini
new file mode 100644
index 0000000..d629831
--- /dev/null
+++ b/models/report.ini
@@ -0,0 +1,32 @@
+[model]
+name = Report
+label = {{ this.title }}
+hidden = yes
+
+[fields.title]
+label = Title
+type = string
+
+[fields.description]
+label = Description
+type = string
+
+[fields.type]
+label = Type
+type = string
+
+[fields.tag]
+label = Tag
+type = string
+
+[fields.link]
+label = Link
+type = string
+
+[fields.date]
+label = date
+type = string
+
+[fields.file]
+label = File
+type = string
diff --git a/models/reports.ini b/models/reports.ini
new file mode 100644
index 0000000..eba6b0b
--- /dev/null
+++ b/models/reports.ini
@@ -0,0 +1,28 @@
+[model]
+name = Reports
+label = {{ this.title }}
+hidden = yes
+
+[fields.title]
+label = Title
+type = string
+
+[fields.section]
+label = Section
+type = string
+
+[fields.body]
+label = Body
+type = markdown
+
+[fields.color]
+label = Color
+type = string
+
+[fields.html]
+label = Html
+type = string
+
+[children]
+model = report
+order_by = name
diff --git a/templates/macros/reports.html b/templates/macros/reports.html
new file mode 100644
index 0000000..1b399a9
--- /dev/null
+++ b/templates/macros/reports.html
@@ -0,0 +1,16 @@
+{% macro render_document(item, alternative) %}
+<tr>
+  <td>{{ item.title }}</td>
+  <td>{{ item.description }}</td>
+  <td><a href="{{ item.link }}">View PDF</a></td>
+</tr>
+{% endmacro %}
+
+{% macro render_report(item, alternative) %}
+<tr>
+  <th scope="row">{{ item.date }}</th>
+  <td><span class="badge-pill badge-success">{{ item.tag }}</span></td>
+  <td>{{ item.title }}</td>
+  <td><a href="{{ item.link }}">View PDF</a></td>
+</tr>
+{% endmacro %}
diff --git a/templates/reports.html b/templates/reports.html
index 9270d49..80cef40 100644
--- a/templates/reports.html
+++ b/templates/reports.html
@@ -4,41 +4,11 @@
 <div class="container py-3">
   <table class="table">
   <tbody>
-    <tr>
-      <td>Tor Certificate of Legal Existence</td>
-      <td>Certificate of Legal Existence for Tor Project, Inc.</td>
-      <td><a href="">View PDF</a></td>
-    </tr>
-    <tr>
-      <td>Tor Articles of Organization</td>
-      <td>Articles of Organization for Tor Project, Inc.</td>
-      <td><a href="">View PDF</a></td>
-    </tr>
-    <tr>
-      <td>Tor Articles of Organization as filed</td>
-      <td>Articles of Organization as they were filed by the Commonwealth of Massachusetts, including continuation pages.</td>
-      <td>View PDF</td>
-    </tr>
-    <tr>
-      <td>Tor Conflict of Interest Policy</td>
-      <td>Policy protecting the organization's interest from officers and directors entering arrangements that might benefit their private interests.</td>
-      <td><a href="">View PDF</a></td>
-    </tr>
-    <tr>
-      <td>Tor Conflict of Interest Policy</td>
-      <td>Policy protecting the organization's interest from officers and directors entering arrangements that might benefit their private interests.</td>
-      <td><a href="">View PDF</a></td>
-    </tr>
-    <tr>
-      <td>Form 1023, Exhibit A.</td>
-      <td>Form 1023, Exhibit A.</td>
-      <td><a href="">View PDF</a></td>
-    </tr>
-    <tr>
-      <td>Doc Name</td>
-      <td>Description.</td>
-      <td><a href="">View PDF</a></td>
-    </tr>
+    {% from "macros/reports.html" import render_document %}
+    {% set items = this.children %}
+    {% for item in items.filter(F.type == "document") %}
+      {{ render_document(item, this.alt) }}
+    {% endfor %}
   </tbody>
 </table>
 </div>
@@ -56,24 +26,11 @@
     </tr>
   </thead>
   <tbody>
-    <tr>
-      <th scope="row">2015</th>
-      <td><span class="badge-pill badge-primary">IRS 990</span></td>
-      <td>IRS Form 990</td>
-      <td><a href="">View PDF</a></td>
-    </tr>
-    <tr>
-      <th scope="row">2015</th>
-      <td><span class="badge-pill badge-success">AUDIT</span></td>
-      <td>Independent Audit Results</td>
-      <td><a href="">View PDF</a></td>
-    </tr>
-    <tr>
-      <th scope="row">2015</th>
-      <td><span class="badge-pill badge-secondary">BOARD MEETING</span></td>
-      <td>Tor Board Meeting Minutes - June</td>
-      <td><a href="">View PDF</a></td>
-    </tr>
+    {% from "macros/reports.html" import render_report %}
+    {% set items = this.children %}
+    {% for item in items.filter(F.type == "report") %}
+      {{ render_report(item, this.alt) }}
+    {% endfor %}
   </tbody>
 </table>
 </div>

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits