mirror of
https://github.com/pretix/pretix.git
synced 2026-09-15 16:34:42 +00:00
WIP preview
This commit is contained in:
@@ -8,37 +8,63 @@ import { StoreKey } from "../walletStore";
|
|||||||
|
|
||||||
const gettext = (window as any).gettext;
|
const gettext = (window as any).gettext;
|
||||||
|
|
||||||
const store = inject(StoreKey)!
|
const store = inject(StoreKey)!;
|
||||||
|
|
||||||
|
|
||||||
const platformChoices = computed(() => {
|
const platformChoices = computed(() => {
|
||||||
return [[null, "Do not generate pass"], ...Object.values(store.currentPlatformStyles).map(x => [x.identifier, x.name])]
|
return [
|
||||||
|
[null, "Do not generate pass"],
|
||||||
|
...Object.values(store.currentPlatformStyles).map((x) => [
|
||||||
|
x.identifier,
|
||||||
|
x.name,
|
||||||
|
]),
|
||||||
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
function openForm(url: string, data: Record<string, string>) {
|
function openForm(url: string, data: Record<string, string>) {
|
||||||
|
let form = document.createElement("form");
|
||||||
|
form.target = "_blank";
|
||||||
|
form.method = "POST";
|
||||||
|
form.action = url;
|
||||||
|
form.style.display = "none";
|
||||||
|
|
||||||
let form = document.createElement("form");
|
for (var key in data) {
|
||||||
form.target = "_blank";
|
var input = document.createElement("input");
|
||||||
form.method = "POST";
|
input.type = "hidden";
|
||||||
form.action = url;
|
input.name = key;
|
||||||
form.style.display = "none";
|
input.value = data[key];
|
||||||
|
form.appendChild(input);
|
||||||
for (var key in data) {
|
}
|
||||||
var input = document.createElement("input");
|
document.body.appendChild(form);
|
||||||
input.type = "hidden";
|
form.submit();
|
||||||
input.name = key;
|
document.body.removeChild(form);
|
||||||
input.value = data[key];
|
|
||||||
form.appendChild(input);
|
|
||||||
}
|
|
||||||
document.body.appendChild(form);
|
|
||||||
form.submit();
|
|
||||||
document.body.removeChild(form);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function openPreview(e: SubmitEvent) {
|
function openPreview(e: SubmitEvent) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
openForm("../../preview/", {"csrfmiddlewaretoken": store.csrfToken, "platform": store.currentPlatform, "style": store.currentPlatformLayout.style, "layout": JSON.stringify(store.currentPlatformLayout.layout)})
|
openForm("../../preview/", {
|
||||||
|
csrfmiddlewaretoken: store.csrfToken,
|
||||||
|
platform: store.currentPlatform,
|
||||||
|
style: store.currentPlatformLayout.style,
|
||||||
|
layout: JSON.stringify(store.currentPlatformLayout.layout),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const preview_layouts = [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
children: [
|
||||||
|
{ fieldgroup: "logo", relSize: 1 },
|
||||||
|
{ fieldgroup: "logo_text", relSize: 3 },
|
||||||
|
{ fieldgroup: "header", relSize: 2 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ fieldgroup: "primary" },
|
||||||
|
{ fieldgroup: "secondary" },
|
||||||
|
{ fieldgroup: "auxiliary" },
|
||||||
|
{ fieldgroup: "code" },
|
||||||
|
],
|
||||||
|
[{ fieldgroup: "back", mode: "column" }],
|
||||||
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
@@ -65,10 +91,8 @@ function openPreview(e: SubmitEvent) {
|
|||||||
.panel-heading Preview
|
.panel-heading Preview
|
||||||
.panel-body
|
.panel-body
|
||||||
span.text-muted The preview below is only a rough representation of what the pass might look like. Please check the generated pass.
|
span.text-muted The preview below is only a rough representation of what the pass might look like. Please check the generated pass.
|
||||||
PassPreview
|
PassPreview(v-for="layout in preview_layouts" :layout="layout")
|
||||||
div(style="margin-top: 1em; width: calc(10cm); height: 15cm; position: relative; outline: solid 1px gray; border-radius: 1em;")
|
|
||||||
div(style="position: absolute; background-color: red; top: 0.5cm; left: 0.5cm; right: 0.5cm; height: 14cm;") Back
|
|
||||||
// TODO: Preview
|
|
||||||
pre
|
pre
|
||||||
code {{ store.currentPlatformLayout }}
|
code {{ store.currentPlatformLayout }}
|
||||||
pre(v-if="store.currentPlatformLayout.style")
|
pre(v-if="store.currentPlatformLayout.style")
|
||||||
|
|||||||
Reference in New Issue
Block a user