12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <!doctype html>
- </style>
- <title>Generatore di volantini</title>
- <head>
- <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }} ">
- <title>gancio flyers</title>
- </head>
- <body>
- <h3> Generatore di volantini per balotta.org</h3>
- <div>
- Scegli gli eventi che vuoi mettere nel volantino e premi genera.
- <br>
- Per stampare fai "File >> Stampa" Scegli come destinazione "Salva come PDF", seleziona il giusto formato di carta (A3) e ricordati di selezionare anche "Print background".
- <br>
- L'attuale layout può contenere fino a <span id="maxEvents"></span> eventi.
- </div>
- <br>
- <form action="/flyer" target="_blank">
- <label for="template">Scegli un template: </label>
- <select onchange="templateSelected(this.value)" id="template" name="template">
- {% for template in templates %}
- <option value="{{template.name}}">{{template.name}}</option>
- {% endfor %}
- </select>
- <br><br>
- {% for event in events %}
- <input type="checkbox" id="{{event.id}}" name="events" value="{{event.id}}">
- <label for="{{event.id}}"> {{loop.index}} [ {{event.when}} ] {{ event.title }}</label><br>
- {% endfor %}
- <br>
- <input type="submit" value="Genera il volantino">
- </form>
- <script>
- const templates={{templates|tojson}}
- function templateSelected(templateName) {
- const template = templates.find((t) => t.name == templateName)
- const events = document.querySelectorAll("[name=events]")
- document.querySelector("#maxEvents").innerHTML = template.maxEvents
- var maxEvents = template.maxEvents
- events.forEach((e) => {
- e.checked = maxEvents > 0
- maxEvents--
- })
- }
- document.querySelector("#template").value = "{{default_template}}"
- templateSelected("{{default_template}}")
- </script>
- </body>
- </html>
|