Added thesis assignment format
This commit is contained in:
27
data.js
27
data.js
@@ -69,6 +69,16 @@ let steps = {
|
||||
}
|
||||
}
|
||||
},
|
||||
assignment: {
|
||||
title: "Jak vložit zadání?",
|
||||
layout: assignment_layout,
|
||||
result: {
|
||||
format: "empty"
|
||||
},
|
||||
finalize: (result) => {
|
||||
result.include_pdf = result.format === "external";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const faculties = {
|
||||
@@ -155,6 +165,15 @@ const pronouns_en = {
|
||||
}
|
||||
}
|
||||
|
||||
const assignment_formats = {
|
||||
"empty": {
|
||||
name: "Vložit do dokumentu prázdnou stránku.\nTuto stránku poté nahradíte podepsaným zadáním."
|
||||
},
|
||||
"external": {
|
||||
name: "Vložit do dokumentu zadání ve formě PDF."
|
||||
}
|
||||
}
|
||||
|
||||
const typst_header = `#import "template/template.typ": *
|
||||
|
||||
#show: tultemplate2.with(
|
||||
@@ -166,8 +185,8 @@ const typst_header = `#import "template/template.typ": *
|
||||
author_pronouns: "{author_info.pronouns}",
|
||||
<collaborators.has_supervisor: supervisor: "{collaborators.supervisor_name}",
|
||||
><collaborators.has_consultant: consultant: "{collaborators.consultant_name}",
|
||||
> citations: "citations.bib",
|
||||
assignment: "zadani.pdf"
|
||||
><assignment.include_pdf: assignment: "assignment.pdf",
|
||||
> citations: "citations.bib"
|
||||
)
|
||||
|
||||
= Nadpis
|
||||
@@ -229,6 +248,10 @@ async function generate_zip() {
|
||||
|
||||
out_zip.file("thesis.typ", generate_template());
|
||||
|
||||
if(!steps.assignment.result.include_pdf) {
|
||||
out_zip.remove("assignment.pdf");
|
||||
}
|
||||
|
||||
return await out_zip.generateAsync({ type: "blob" });
|
||||
}
|
||||
|
||||
|
19
ui.js
19
ui.js
@@ -136,6 +136,25 @@ async function collaborators_layout(content, result) {
|
||||
.finish());
|
||||
}
|
||||
|
||||
async function assignment_layout(content, result) {
|
||||
if(!Object.keys(assignment_formats).includes(result.format)) {
|
||||
document.querySelector("#next-button").disabled = true;
|
||||
}
|
||||
|
||||
let buttons = new ButtonListBuilder(Object.keys(assignment_formats))
|
||||
.should_be_pressed((key) => result.format == key)
|
||||
.modify((b, key) => b.class("wide").text(assignment_formats[key].name))
|
||||
.on_click((key) => {
|
||||
result.format = key;
|
||||
document.querySelector("#next-button").disabled = false;
|
||||
})
|
||||
.finish();
|
||||
|
||||
for(const button of buttons) {
|
||||
content.appendChild(button);
|
||||
}
|
||||
}
|
||||
|
||||
async function run() {
|
||||
startbutton.style.cursor = "auto";
|
||||
startbutton.disabled = true;
|
||||
|
Reference in New Issue
Block a user