Verified Commit 5682d03f authored by Jakob Moser's avatar Jakob Moser
Browse files

Lazily add some more links

parent c9ccad1e
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ main {
    display: grid;
    grid-template-columns: 100vw;
    justify-items: center;
    row-gap: 2em;

    overflow: auto;
}
@@ -135,7 +136,7 @@ a.button-and-text {
    text-decoration: none;

    display: grid;
    grid-auto-flow: column;
    grid-template-columns: max-content 1fr;
    align-items: center;
    column-gap: 0.5em;
}
+30 −0
Original line number Diff line number Diff line
import { Base } from "./Base.mjs"
import { Agenda } from "../pieces/Agenda.mjs"
import { getKey } from "../../account.mjs"
import { ButtonAndTextLink } from "../pieces/ButtonAndTextLink.mjs"

const items = {
    all: null,
@@ -35,11 +36,40 @@ export const Fachschaftssitzung = {
        items.fetch()
    },
    view() {
        const now = new Date()
        const today = now.toISOString().split("T")[0]

        return m(Base, [
            m(Agenda, {
                items: items.all?.map(item => item.name),
                message: items.message,
            }),
            m("section", [
                m(
                    "p",
                    m(ButtonAndTextLink, {
                        href: `https://gitlab.cl.uni-heidelberg.de/-/ide/project/fachschaft/protokolle/edit/master/-/${today.slice(0,4)}/${today}.md`,
                        icon: "fa-solid fa-file-pen",
                        name: "Aktuelles Protokoll bearbeiten",
                    }),
                ),
                m(
                    "p",
                    m(ButtonAndTextLink, {
                        href: `https://gitlab.cl.uni-heidelberg.de/api/v4/projects/1193/jobs/artifacts/master/raw/pdfs/${today}.pdf?job=convert-to-pdf`,
                        icon: "fa-regular fa-file-pdf",
                        name: "Protokoll als PDF herunterladen",
                    }),
                ),
                m(
                    "p",
                    m(ButtonAndTextLink, {
                        href: `https://gitlab.cl.uni-heidelberg.de/api/v4/projects/1193/jobs/artifacts/master/raw/pdfs/${today}_nur_Beschlüsse.pdf?job=convert-to-pdf`,
                        icon: "fa-solid fa-gavel",
                        name: "Beschlüsse als PDF herunterladen",
                    }),
                ),
            ]),
        ])
    },
}
+20 −0
Original line number Diff line number Diff line
export const ButtonAndTextLink = {
    view(vnode) {
        return m(
            "a.button-and-text",
            {
                href: vnode.attrs.href,
                target: vnode.attrs.sameTab ? "" : "_blank",
            },
            [
                m(
                    "span.box.small.button",
                    m("i", {
                        class: vnode.attrs.icon,
                    }),
                ),
                m("span.text", vnode.attrs.name),
            ],
        )
    },
}