Added study programme selector
This commit is contained in:
24
data.js
24
data.js
@@ -50,6 +50,29 @@ let steps = {
|
||||
}
|
||||
}
|
||||
},
|
||||
programme: {
|
||||
title: "Který program studujete?",
|
||||
layout: programme_layout,
|
||||
result: {
|
||||
faculty: "", // used for checking whether to clear
|
||||
idx: -1 // -1 = none, 0+ = index into programmes[faculty]
|
||||
},
|
||||
finalize: (result) => {
|
||||
if(result.idx == -1) {
|
||||
result.has_programme = false;
|
||||
return
|
||||
}
|
||||
|
||||
let programme = programmes[steps.faculty.result.name][result.idx];
|
||||
|
||||
result.has_programme = true;
|
||||
result.programme = programme.code + " " + (
|
||||
steps.language.result.lang == "cs" ?
|
||||
programme.cs_name :
|
||||
programme.en_name
|
||||
);
|
||||
}
|
||||
},
|
||||
collaborators: {
|
||||
title: "Vedoucí práce",
|
||||
layout: collaborators_layout,
|
||||
@@ -185,6 +208,7 @@ 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}",
|
||||
><programme.has_programme: programme: "{programme.programme}",
|
||||
><assignment.include_pdf: assignment: "assignment.pdf",
|
||||
> citations: "citations.bib"
|
||||
)
|
||||
|
15
styles.css
15
styles.css
@@ -302,6 +302,21 @@ input[type="text"]:disabled {
|
||||
color: lightgray;
|
||||
}
|
||||
|
||||
select {
|
||||
flex-grow: 0;
|
||||
padding: 8px 16px;
|
||||
|
||||
font-family: inherit;
|
||||
font-size: 100%;
|
||||
border: 1px var(--button-border-color) solid;
|
||||
color: black;
|
||||
background-color: var(--button-color);
|
||||
border-radius: 8px;
|
||||
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.zmp-logo {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
|
23
ui.js
23
ui.js
@@ -110,6 +110,29 @@ async function author_info_layout(content, result) {
|
||||
.finish());
|
||||
}
|
||||
|
||||
async function programme_layout(content, result) {
|
||||
let faculty = steps.faculty.result.name;
|
||||
let programmes_faculty = programmes[faculty];
|
||||
let options = [
|
||||
[[-1, "(žádný)"]],
|
||||
programmes_faculty.map((x, idx) => [
|
||||
idx,
|
||||
"(" + x.title + ", " + x.form.slice(0, 4) + ".) " + x.cs_name
|
||||
])
|
||||
].flat().map(x => new ElementBuilder("option")
|
||||
.value(x[0])
|
||||
.text(x[1])
|
||||
.finish());
|
||||
|
||||
content.appendChild(new ElementBuilder("select")
|
||||
.append_all(options)
|
||||
.on_change(e => result.idx = +e.target.value)
|
||||
.value(result.faculty != faculty ? -1 : result.idx)
|
||||
.finish());
|
||||
|
||||
result.faculty = faculty;
|
||||
}
|
||||
|
||||
async function collaborators_layout(content, result) {
|
||||
let supervisor_name = new TextInputBuilder(result, "supervisor_name")
|
||||
.placeholder("Jméno vedoucího práce (vč. titulů), příp. vedoucích")
|
||||
|
Reference in New Issue
Block a user