Loading portal/static/js/components/pages/Fachschaftssitzung.mjs +21 −11 Original line number Diff line number Diff line Loading @@ -2,7 +2,10 @@ import { Base } from "./Base.mjs" import { Agenda } from "../pieces/Agenda.mjs" import { getKey } from "../../account.mjs" import { ButtonAndTextLink } from "../pieces/ButtonAndTextLink.mjs" import { getLatestProtocolMetadata } from "../../gitlab.mjs" import { getLatestProtocolMetadata, getProtocolEditLink, } from "../../gitlab.mjs" const items = { all: null, Loading Loading @@ -55,12 +58,19 @@ export const Fachschaftssitzung = { m( "p", m(ButtonAndTextLink, { href: latestProtocol.meta?.editLink, href: latestProtocol.meta?.editLink || getProtocolEditLink( new Date().toISOString().split("T")[0], ), icon: "fa-solid fa-file-pen", name: "Aktuelles Protokoll bearbeiten", name: latestProtocol.meta ? "Aktuelles Protokoll bearbeiten" : "Heutiges Protokoll bearbeiten", }), ), latestProtocol.meta && m( latestProtocol.meta && m( "p", m(ButtonAndTextLink, { href: latestProtocol.meta?.downloadLink, Loading portal/static/js/gitlab.mjs +5 −1 Original line number Diff line number Diff line Loading @@ -78,6 +78,10 @@ async function waitUntilRendered(img) { }) } export function getProtocolEditLink(dateIso) { return `https://gitlab.cl.uni-heidelberg.de/-/ide/project/fachschaft/protokolle/edit/master/-/${dateIso.slice(0, 4)}/${dateIso}.md` } /** * Return an object with metadata about the latest protocol, or null, if the metadata cannot be accessed * (e.g., because the user is not logged in to GitLab, is logged in but has no access to the repo, or an error occurred in the pipeline). Loading Loading @@ -113,7 +117,7 @@ export async function getLatestProtocolMetadata() { const dateIso = toIsoString(year, month, day) const editLink = `https://gitlab.cl.uni-heidelberg.de/-/ide/project/fachschaft/protokolle/edit/master/-/${year}/${dateIso}.md` const editLink = getProtocolEditLink(dateIso) const downloadLink = `https://gitlab.cl.uni-heidelberg.de/api/v4/projects/1193/jobs/artifacts/master/raw/pdfs/${dateIso}.pdf?job=convert-to-pdf` const resolutionDownloadLink = containsResolution ? `https://gitlab.cl.uni-heidelberg.de/api/v4/projects/1193/jobs/artifacts/master/raw/pdfs/${dateIso}_nur_Beschlüsse.pdf?job=convert-to-pdf` Loading Loading
portal/static/js/components/pages/Fachschaftssitzung.mjs +21 −11 Original line number Diff line number Diff line Loading @@ -2,7 +2,10 @@ import { Base } from "./Base.mjs" import { Agenda } from "../pieces/Agenda.mjs" import { getKey } from "../../account.mjs" import { ButtonAndTextLink } from "../pieces/ButtonAndTextLink.mjs" import { getLatestProtocolMetadata } from "../../gitlab.mjs" import { getLatestProtocolMetadata, getProtocolEditLink, } from "../../gitlab.mjs" const items = { all: null, Loading Loading @@ -55,12 +58,19 @@ export const Fachschaftssitzung = { m( "p", m(ButtonAndTextLink, { href: latestProtocol.meta?.editLink, href: latestProtocol.meta?.editLink || getProtocolEditLink( new Date().toISOString().split("T")[0], ), icon: "fa-solid fa-file-pen", name: "Aktuelles Protokoll bearbeiten", name: latestProtocol.meta ? "Aktuelles Protokoll bearbeiten" : "Heutiges Protokoll bearbeiten", }), ), latestProtocol.meta && m( latestProtocol.meta && m( "p", m(ButtonAndTextLink, { href: latestProtocol.meta?.downloadLink, Loading
portal/static/js/gitlab.mjs +5 −1 Original line number Diff line number Diff line Loading @@ -78,6 +78,10 @@ async function waitUntilRendered(img) { }) } export function getProtocolEditLink(dateIso) { return `https://gitlab.cl.uni-heidelberg.de/-/ide/project/fachschaft/protokolle/edit/master/-/${dateIso.slice(0, 4)}/${dateIso}.md` } /** * Return an object with metadata about the latest protocol, or null, if the metadata cannot be accessed * (e.g., because the user is not logged in to GitLab, is logged in but has no access to the repo, or an error occurred in the pipeline). Loading Loading @@ -113,7 +117,7 @@ export async function getLatestProtocolMetadata() { const dateIso = toIsoString(year, month, day) const editLink = `https://gitlab.cl.uni-heidelberg.de/-/ide/project/fachschaft/protokolle/edit/master/-/${year}/${dateIso}.md` const editLink = getProtocolEditLink(dateIso) const downloadLink = `https://gitlab.cl.uni-heidelberg.de/api/v4/projects/1193/jobs/artifacts/master/raw/pdfs/${dateIso}.pdf?job=convert-to-pdf` const resolutionDownloadLink = containsResolution ? `https://gitlab.cl.uni-heidelberg.de/api/v4/projects/1193/jobs/artifacts/master/raw/pdfs/${dateIso}_nur_Beschlüsse.pdf?job=convert-to-pdf` Loading