Improvements to PDF text placeholders (#2562)

This commit is contained in:
Raphael Michel
2022-03-30 17:43:26 +02:00
committed by GitHub
parent 69375f4092
commit ee72009e73
5 changed files with 101 additions and 5 deletions

View File

@@ -372,7 +372,9 @@
<label>{% trans "Content" %}</label><br>
<select class="input-block-level form-control" id="toolbox-content">
{% for varname, var in variables.items %}
<option data-sample="{{ var.editor_sample }}" value="{{ varname }}">{{ var.label }}</option>
{% if not var.hidden %}
<option data-sample="{{ var.editor_sample }}" {% if var.migrate_from %}data-old-value="{{ var.migrate_from }}"{% endif %} value="{{ varname }}">{{ var.label }}</option>
{% endif %}
{% endfor %}
{% for p in request.organizer.meta_properties.all %}
<option value="meta:{{ p.name }}">
@@ -394,6 +396,9 @@
<textarea id="toolbox-content-other-{{ l }}" rows="3" class="input-block-level form-control" title="{{ l }}" lang="{{ l }}"></textarea>
{% endfor %}
</div>
<p class="help-block" id="toolbox-content-other-help">
<a href="?placeholders=true" target="_blank">{% trans "Show available placeholders" %}</a>
</p>
</div>
</div>
</div>

View File

@@ -0,0 +1,68 @@
{% extends "pretixcontrol/event/base.html" %}
{% load i18n %}
{% load static %}
{% load compress %}
{% block title %}{% trans "PDF Editor" %}{% endblock %}
{% block custom_header %}
{{ block.super }}
{% compress css %}
<link type="text/css" rel="stylesheet" href="{% static "pretixcontrol/scss/pdfeditor.css" %}">
{% endcompress %}
<link type="text/css" rel="stylesheet" href="{% url "control:pdf.css" %}">
{% endblock %}
{% block content %}
<h1>
{% trans "PDF Editor" %}
<small>{% trans "Available placeholders" %}</small>
</h1>
<p>
{% blocktrans trimmed %}
You can use placeholders in custom texts on tickets to enrich your text with individual data. Which
placeholders are available depends on your event settings, activated plugins, the selected product,
as well as user input.
This page lists all placeholders technically available for your event, however most of them can also
be empty in some cases depending on configuration.
{% endblocktrans %}
</p>
<div class="table-responsive">
<table class="table table-hover table-condensed">
<thead>
<tr>
<th>{% trans "Placeholder" %}</th>
<th>{% trans "Description" %}</th>
<th>{% trans "Formatting example" %}</th>
</tr>
</thead>
<tbody>
{% for varname, var in variables.items %}
{% if not var.hidden %}
<tr>
<td><code>{{ "{" }}{{ varname }}{{ "}" }}</code></td>
<td>{{ var.label }}</td>
<td>{{ var.editor_sample }}</td>
</tr>
{% endif %}
{% endfor %}
{% for p in request.organizer.meta_properties.all %}
<tr>
<td><code>{{ "{" }}meta:{{ p.name }}{{ "}" }}</code></td>
<td>
{% trans "Event attribute:" %} {{ p.name }}
</td>
<td></td>
</tr>
{% endfor %}
{% for p in request.event.item_meta_properties.all %}
<tr>
<td><code>{{ "{" }}itemmeta:{{ p.name }}{{ "}" }}</code></td>
<td>
{% trans "Item attribute:" %} {{ p.name }}
</td>
<td></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}