Add event meta-data

This commit is contained in:
Raphael Michel
2017-08-28 11:46:35 +02:00
parent 454ca27c54
commit 88f5af3e77
23 changed files with 470 additions and 27 deletions

View File

@@ -137,7 +137,7 @@ var editor = {
if (d.content === "other") {
o.setText(d.text);
} else {
o.setText(editor.text_samples[d.content]);
o.setText(editor._get_text_sample(d.content));
}
}
@@ -182,6 +182,13 @@ var editor = {
"addons": gettext("Addon 1\nAddon 2"),
},
_get_text_sample: function (key) {
if (key.startsWith('meta:')) {
return key.substr(5);
}
return editor.text_samples[key];
},
_load_pdf: function (dump) {
// TODO: Loading indicators
var url = editor.pdf_url;
@@ -362,7 +369,7 @@ var editor = {
if ($("#toolbox-content").val() === "other") {
o.setText($("#toolbox-content-other").val());
} else {
o.setText(editor.text_samples[$("#toolbox-content").val()]);
o.setText(editor._get_text_sample($("#toolbox-content").val()));
}
}

View File

@@ -304,6 +304,11 @@
<option value="addons">{% trans "List of Add-Ons" %}</option>
<option value="organizer">{% trans "Organizer name" %}</option>
<option value="organizer_info_text">{% trans "Organizer info text" %}</option>
{% for p in request.organizer.meta_properties.all %}
<option value="meta:{{ p.name }}">
{% trans "Event attribute:" %} {{ p.name }}
</option>
{% endfor %}
<option value="other">{% trans "Other…" %}</option>
</select>
<textarea type="text" value="" class="input-block-level form-control"

View File

@@ -69,6 +69,8 @@ class PdfTicketOutput(BaseTicketOutput):
ev = op.subevent or order.event
if o['content'] == 'other':
return o['text'].replace("\n", "<br/>\n")
elif o['content'].startswith('meta:'):
return ev.meta_data.get(o['content'][5:])
elif o['content'] == 'order':
return order.code
elif o['content'] == 'item':