From 21f4ddd4863567908589392aef96fe763f284d07 Mon Sep 17 00:00:00 2001 From: Olimpia Magliulo <olimpiam@intern-ikts-MacBook-Air.local> Date: Tue, 7 Nov 2017 11:19:55 +0100 Subject: [PATCH] Convert metadata-converter to twig template --- templates/metadata-converter.twig | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 templates/metadata-converter.twig diff --git a/templates/metadata-converter.twig b/templates/metadata-converter.twig new file mode 100644 index 000000000..e17ca6089 --- /dev/null +++ b/templates/metadata-converter.twig @@ -0,0 +1,51 @@ +{% set pagetitle = 'Metadata parser'|trans %} +{% extends "base.twig" %} + + {% set i=1 %} +{% block content %} + <h2>{{ pagetitle }}</h2> + <form method="post" enctype="multipart/form-data"> + <p> {% trans 'XML metadata' %}</p> + <p> + <textarea name="xmldata" rows="20" style="width:100%">{{ xmldata }}</textarea> + </p> + <p> + {{ 'or select a file:'|trans }} + + <input type="file" name="xmlfile" /> + </p> + <p> + <button type="submit" class="btn">{% trans %}Parse{% endtrans %}</button> + </p> + </form> + + {% if output %} + + <h2>{{ 'Converted metadata'|trans }}</h2> + + + {% for type, text in output if text %} + + <h3> {{ type }}</h3> + <div class="metadatabox"> + <button data-clipboard-target="#metadata{{ loop.index }}" id="btn{{loop.index }}" class="btn topright" style="margin-right: 0.5em"> + <img src="/{{ baseurlpath }}resources/icons/clipboard.svg" + alt="Copy to clipboard" /> + </button> + <pre id="metadata{{ loop.index }}">{{ text }}</pre> + </div> + {% set i=i+1 %} + {% endfor %} + {% endif %} +{% endblock content %} + +{% block postload %} + <script type="text/javascript"> + {%- for j in 1..i %} + + var clipboard{{ j }} = new Clipboard('#btn{{ j }}'); + + {%- endfor %} + </script> +{% endblock postload %} + -- GitLab