Added thesis language

This commit is contained in:
2025-10-06 20:35:26 +02:00
parent 4d40632db0
commit 4705b6ec68
3 changed files with 40 additions and 0 deletions

17
data.js
View File

@@ -13,6 +13,13 @@ let steps = {
type: ""
}
},
language: {
title: "V jakém jazyce budete práci tvořit?",
layout: language_layout,
result: {
lang: "cs"
}
},
thesis_title: {
title: "Jak se bude práce jmenovat?",
layout: thesis_title_layout,
@@ -118,6 +125,15 @@ const theses = {
}
}
const languages = {
"cs": {
name: "Čeština"
},
"en": {
name: "Angličtina"
}
}
const pronounss = {
"masculine": {
name: "Mužský rod"
@@ -135,6 +151,7 @@ const typst_header = `#import "template/template.typ": *
#show: tultemplate2.with(
faculty: "{faculty.name}",
document: "{thesis_type.type}",
lang: "{language.lang}",
title: (cs: "{thesis_title.cs}", en: "{thesis_title.en}"),
author: "{author_info.name}",
author_pronouns: "{author_info.pronouns}",

View File

@@ -134,6 +134,10 @@ button:hover, .button:hover {
background-color: white;
}
button.wide, .button.wide {
width: 100%;
}
button.narrow, .button.narrow {
padding: 4px 16px;
font-size: 16px;

19
ui.js
View File

@@ -43,6 +43,25 @@ async function thesis_layout(content, result) {
}
}
async function language_layout(content, result) {
if(!Object.keys(languages).includes(result.lang)) {
document.querySelector("#next-button").disabled = true;
}
let buttons = new ButtonListBuilder(Object.keys(languages))
.should_be_pressed((key) => result.lang == key)
.modify((b, key) => b.class("wide").text(languages[key].name))
.on_click((key) => {
result.lang = key;
document.querySelector("#next-button").disabled = false;
})
.finish();
for(const button of buttons) {
content.appendChild(button);
}
}
async function thesis_title_layout(content, result) {
content.appendChild(new TextInputBuilder(result, "cs")
.placeholder("Název práce (v češtině)")