Added thesis language
This commit is contained in:
17
data.js
17
data.js
@@ -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}",
|
||||
|
@@ -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
19
ui.js
@@ -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ě)")
|
||||
|
Reference in New Issue
Block a user