Add badge.json for testing
authorStephen Frost <sfrost@snowman.net>
Wed, 28 Aug 2019 16:56:51 +0000 (12:56 -0400)
committerStephen Frost <sfrost@snowman.net>
Wed, 28 Aug 2019 16:56:57 +0000 (12:56 -0400)
templates/badge.json [new file with mode: 0644]

diff --git a/templates/badge.json b/templates/badge.json
new file mode 100644 (file)
index 0000000..3fa1fe1
--- /dev/null
@@ -0,0 +1,55 @@
+{
+    "width": 103,
+    "height": 138,
+    "elements": [
+       {"type": "box", "x": 4, "y": 10, "width": 95, "height": 28, "fill": [33, 139, 181], "stroke": false},
+       {"type": "image", "src": "img/pglogo_white.png", "x": 8, "y": 12, "width": 25, "height": 25, "mask": "auto"},
+       {"type": "paragraph", "text": "PGOpen 2019\nOrlando, Florida", "x": 35, "y": 12, "width": 63, "height": 25, "color": "white"},
+
+       {"type": "paragraph", "text": "{{reg.firstname|escapejson}} {{reg.lastname|escapejson}}", "x": 8, "y": 50, "width": 87, "height": 10, "bold": true},
+       {"type": "paragraph", "text": "{{reg.company|escapejson}}", "x": 8, "y": 60, "width": 87, "height": 8, "maxsize": 14},
+
+       {"type": "box", "x": 4, "y": 90, "width": 95, "height": 10, "stroke": false, "fill": [{{reg.regtype.regclass.bgcolortuplestr}}]},
+       {"type": "paragraph", "text": "{{reg.regtype.regclass.regclass}}", "x": 4, "y": 90, "width": 95, "height": 10, "color": [{{reg.regtype.regclass.fgcolortuplestr|default("0,0,0", true)}}], "align": "center"},
+
+        {"type": "image", "src": "img/pgconfeu_badge.png", "x": 4, "y": 103, "width": 22.7, "height": 30, "mask": "auto"},
+
+        {# access to which days#}
+        {"type": "box", "x": 43, "y": 115, "width": 56, "height": 15, "stroke": true},
+
+        {# regular days #}
+{%macro regday(day, dayname, xstart)-%}
+{%if reg.regtype.days|select("equalto", day)|list%}{%set fill=", \"fill\": [0,128,0]"%}{%else%}{%set fill=""%}{%endif%}
+        {"type": "box", "x": {{xstart}}, "y": 115, "width": 14, "height": 15, "stroke": true{{fill}}},
+        {"type": "paragraph", "text": "{{dayname}}", "x": {{xstart + 2}}, "y": 115, "width": 10, "height": 15, "color": [255,255,255], "align": "center", "verticalcenter": true , "maxsize": 13},
+
+{%endmacro%}
+        {{ regday("2018-10-24", "Wed", 57) }}
+        {{ regday("2018-10-25", "Thu", 71) }}
+        {{ regday("2018-10-26", "Fri", 85) }}
+
+{#
+       Lunch on training day depends on the training purchased. The first
+       set of ids here are the full-day trainings, plus explicit lunch.
+       The second set are the half-day trainings.  We don't need to check
+       for morning/afternoon as registration for simultaneous traninings is
+       already handled by the system, so we just look to see if there are
+       two.
+#}
+{% if reg.additionaloptions|selectattr("id", "inlist", [61, 68])|list or
+         reg.additionaloptions|selectattr("id", "inlist", [62, 63, 64, 65, 66, 67])|list|length == 2 %}
+{# full day training or two half days or explicit lunch -- thus, lunch! #}
+        {"type": "box", "x": 43, "y": 115, "width": 14, "height": 15, "stroke": true, "fill": [0, 128, 0]},
+        {"type": "paragraph", "text": "Tue", "x": 45, "y": 115, "width": 10, "height": 15, "color": [255,255,255], "align": "center", "verticalcenter": true , "maxsize": 13}
+{%elif reg.additionaloptions|length > 0%}
+{# has some type of training, but no lunch #}
+        {"type": "box", "x": 43, "y": 115, "width": 14, "height": 15, "stroke": true, "fill": [255, 255, 0]},
+        {"type": "paragraph", "text": "Tue", "x": 45, "y": 115, "width": 10, "height": 15, "color": [0,0,0], "align": "center", "verticalcenter": true , "maxsize": 13}
+{%else%}
+{# no training at all! #}
+        {"type": "box", "x": 43, "y": 115, "width": 14, "height": 15, "stroke": true},
+        {"type": "paragraph", "text": "Tue", "x": 45, "y": 115, "width": 10, "height": 15, "color": [0,0,0], "align": "center", "verticalcenter": true , "maxsize": 13},
+        {"type": "line", "x": 43, "y": 115, "width": 14, "height": 15}
+{%endif%}
+       ]
+}