Export | Pressedaten

Eine Liste von Events mit Pressedaten inkl. Download-Link der Medien.

Pressedaten

Es werden folgende Daten ausgespielt

  • Datum
  • Beginn
  • Titel
  • Untertitel (falls vorhanden)
  • Spielort
  • Informationen des Events, Künstlers und der Show mit dem Benutzerfeld „Info lang“

Medien

Öffentliche Dateien des Events, Künstlers und der Show mit dem Tag „promotion“ werden als Zip Datei Download-Link dargestellt.
Doppelte Medien werden herausgefiltert.

Vorschau

Preprozessor

const whitelistedFileTags = ["promotion"]

const d = deps.dateFns
const _ = deps.lodash

/**
 * prefixes file name with date and first segment of event ID
*/
const prefixFileName = (file, event) => {
    const dateString = d.format(d.parseISO(event.start), "yyyy-MM-dd")
    return `${dateString}___${event.id.split("-")[0]}___${file.name}`
}

let artistFiles = []

const filesByEventId = _.fromPairs(ctx.events.map(e => {
    if(e.artists?.length){
        for (const a of e.artists) {
            if(a.show?.files?.length) artistFiles.push(a.show?.files)
            if(a.show?.images?.length) artistFiles.push(a.show?.images)
            if(a.files?.length) artistFiles.push(a.files)
            if(a.images?.length) artistFiles.push(a.images)
        }
    }
    const files = [...e.images, ...e.files, ...artistFiles.flat()]
        // only use files tagged with specific tags
        .filter(f => f.tags?.some(t => whitelistedFileTags.includes(t)))
        .map(f => ({ ...f, prefixedName: prefixFileName(f, e) }))
    return [e.id, files]
}))

const files = _.uniqBy(_.values(filesByEventId).flat(),'id');

const zipFileName = `Termine-${ctx.instanceId}-${d.format(new Date(), "yyyy-MM-dd")}.zip`

const paths = files.map(f => `paths=${f.id}:${encodeURIComponent(f.prefixedName)}`).join("&")
const zipUrl = `/go/${ctx.instanceId}/files/${files.map(f => f.id).join(",")}/bulk/${zipFileName}?${paths}`

return {
    ...ctx,
    month: d.startOfMonth(d.parseISO(ctx.events[0].start)),
    filesByEventId,
    files,
    zipFileName,
    zipUrl,
}

Template

<style>
    @page {
        size: A4;
        margin: 1cm 2cm 0.5cm;
    }

    .logo {
        width: auto;
        height: 1.5cm;
    }

    .page-container-table {
        width: 100%;
    }

    .page-footer {
        position: fixed;
        bottom: 1cm;
        width: 17cm;

    }

    .page-footer table {
        width: 100%;
        font-size: 0.7em;
    }

    .page-header {
        position: fixed;
        top: 1cm;
        right: 1cm;
    }

    .page-header,
    .page-header-space {
        height: 1.5cm;
    }

    .page-footer,
    .page-footer-space {
        height: 1cm;
        display: flex;
        align-content: end;
    }

    .page-footer table td {
        width: 33%;
    }

    @media print {
        .page-header {
            top: 0 !important;
            right: 0 !important;
        }

        .page-footer {
            bottom: 0 !important;
        }
    }

    .alert {
        background-color: yellow;
        font-size: 1.5em;
    }

    h1 {
        font-family: Ubuntu;
        text-decoration: none;
    }

    body {
        position: relative;
        margin: 0;
        padding: 0;
    }

    body,
    h2,
    h3,
    h4,
    p,
    th,
    td {
        font-family: Ubuntu;
    }

    .page {
        margin-top: 1cm;
        padding-bottom: 1cm;
        page-break-after: auto;
    }

    .page table {
        width: 100%;
        table-layout: fixed;
        border-spacing: 0px;
        border-collapse: separate;
    }

    .page table td,
    .page table th {
        vertical-align: top;
    }

    .sign {
        text-align: left;
        border-bottom: 1px solid black;
        padding: 5px 10px;
        vertical-align: top;
        page-break-inside: avoid;
    }

    .smallText {
        font-size: 0.7rem;
    }

    ol {
        padding-left: 0;
    }

    table {
        width: 100%;
        table-layout: fixed;
        border-spacing: 0px;
        border-collapse: separate;
    }

    .promo td,
    .promo th {
        text-align: left;
        border: 0.2px solid gray;
        padding: 5px 10px;
        vertical-align: top;
    }

    .alert {
        background-color: yellow;
        font-size: 1.5em;
    }
</style>

<div class="page-header">
    {{#if baseData.images.[0].sizes}}
    <img class="logo" src="{{lookup baseData.images.[0].sizes '640'}}" />
    {{/if}}
</div>

<div class="page-footer">
    <table>
        <tbody>
            <tr>
                <td class="smallText">
                    {{ baseData.name }} <br />
                    {{ baseData.web }}
                </td>
                <td class="smallText">
                    {{baseData.addresses.[0].address.street}}<br />
                    {{baseData.addresses.[0].address.zip}} {{baseData.addresses.[0].address.city}}
                </td>
                <td class="smallText">
                    Tel: {{ baseData.phone }} <br />
                    {{ baseData.email }} <br />
                </td>
            </tr>
        </tbody>
    </table>
</div>

<table class="page-container-table">
    <thead>
        <tr>
            <td>
                <!--place holder for the fixed-position header-->
                <div class="page-header-space"></div>
            </td>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>

                <h1>Veranstaltungen {{formatDate month "LLLL yyy"}}</h1>

                <div class="page">

                    Alle Bilder downloaden: <a href={{zipUrl}}>{{zipFileName}}</a>

                    {{#each events}}
                    <hr />
                    <div style="display: grid; grid-template-columns: auto 1fr; gap: 0.25rem;">
                        <div><b>Datum:</b></div>
                        <div>{{formatDate this.start "E P"}}</div>
                        <div><b>Beginn:</b></div>
                        <div>{{formatDate this.start "p"}} Uhr</div>
                        <div><b>Titel:</b></div>
                        <div>{{displayNames.title}}</div>
                        {{#if subtitle}}
                        <div><b>Untertitel:</b></div>
                        <div>{{subtitle}}</div>
                        {{/if}}
                        {{#if displayNames.locationsWithCityAndRooms}}
                        <div><b>Spielort:</b></div>
                        <div>{{displayNames.locationsWithCityAndRooms}}</div>
                        {{/if}}
                    </div>

                    <div>{{md2Html (eventInformationByName this.eventInformations "Info lang")}}</div>
                    <div>{{md2Html (eventInformationByName this.artists.[0].artistInformations "Info lang")}}</div>
                    <div>{{md2Html (eventInformationByName this.artists.[0].show.artistShowInformations "Info lang")}}
                    </div>

                    {{/each}}

                </div>

            </td>
        </tr>
    </tbody>
    <tfoot>
        <tr>
            <td>
                <!--place holder for the fixed-position footer-->
                <div class="page-footer-space"></div>
            </td>
        </tr>
    </tfoot>
</table>