Compare commits
5 Commits
e2e0f45588
...
cc7a3908f6
Author | SHA1 | Date | |
---|---|---|---|
cc7a3908f6 | |||
670dd9596e | |||
48af642e4f | |||
99c876c48c | |||
264299a7a8 |
48
data.js
48
data.js
@@ -18,6 +18,10 @@ let steps = {
|
|||||||
layout: language_layout,
|
layout: language_layout,
|
||||||
result: {
|
result: {
|
||||||
lang: "cs"
|
lang: "cs"
|
||||||
|
},
|
||||||
|
finalize: (result) => {
|
||||||
|
result.is_cs = result.lang === "cs";
|
||||||
|
result.is_en = result.lang === "en";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
thesis_title: {
|
thesis_title: {
|
||||||
@@ -51,6 +55,7 @@ let steps = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
programme: {
|
programme: {
|
||||||
|
condition: () => programmes[steps.faculty.result.name] !== undefined,
|
||||||
title: "Který program studujete?",
|
title: "Který program studujete?",
|
||||||
layout: programme_layout,
|
layout: programme_layout,
|
||||||
result: {
|
result: {
|
||||||
@@ -101,6 +106,14 @@ let steps = {
|
|||||||
finalize: (result) => {
|
finalize: (result) => {
|
||||||
result.include_pdf = result.format === "external";
|
result.include_pdf = result.format === "external";
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
finishing_touches: {
|
||||||
|
title: "Závěrečné detaily",
|
||||||
|
layout: finishing_touches_layout,
|
||||||
|
result: {
|
||||||
|
has_keywords: true,
|
||||||
|
has_acknowledgement: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,11 +217,30 @@ const typst_header = `#import "template/template.typ": *
|
|||||||
document: "{thesis_type.type}",
|
document: "{thesis_type.type}",
|
||||||
lang: "{language.lang}",
|
lang: "{language.lang}",
|
||||||
title: (cs: "{thesis_title.cs}", en: "{thesis_title.en}"),
|
title: (cs: "{thesis_title.cs}", en: "{thesis_title.en}"),
|
||||||
|
<finishing_touches.has_keywords: keywords: (
|
||||||
|
cs: ("DOPLŇTE", "SEM", "KLÍČOVÁ", "SLOVA"),
|
||||||
|
en: ("INSERT", "KEYWORDS", "HERE")
|
||||||
|
)
|
||||||
|
><finishing_touches.has_acknowledgement: acknowledgement: (
|
||||||
|
<language.is_cs:cs: "
|
||||||
|
Rád bych poděkoval všem, kteří přispěli ke vzniku tohoto dílka.
|
||||||
|
"><language.is_en:en: "
|
||||||
|
I would like to acknowledge everyone who contributed to the creation of this fine piece of work.
|
||||||
|
">
|
||||||
|
)
|
||||||
|
> abstract: (
|
||||||
|
cs: "
|
||||||
|
Sem vyplňte abstrakt své práce v češtině.
|
||||||
|
",
|
||||||
|
en: "
|
||||||
|
Insert the abstract of your theses in English here.
|
||||||
|
"
|
||||||
|
),
|
||||||
author: "{author_info.name}",
|
author: "{author_info.name}",
|
||||||
author_pronouns: "{author_info.pronouns}",
|
author_pronouns: "{author_info.pronouns}",
|
||||||
<collaborators.has_supervisor: supervisor: "{collaborators.supervisor_name}",
|
<collaborators.has_supervisor: supervisor: "{collaborators.supervisor_name}",
|
||||||
><collaborators.has_consultant: consultant: "{collaborators.consultant_name}",
|
><collaborators.has_consultant: consultant: "{collaborators.consultant_name}",
|
||||||
><programme.has_programme: programme: "{programme.programme}",
|
><programme.has_programme: programme: ({language.lang}: "{programme.programme}"}),
|
||||||
><assignment.include_pdf: assignment: "assignment.pdf",
|
><assignment.include_pdf: assignment: "assignment.pdf",
|
||||||
> citations: "citations.bib"
|
> citations: "citations.bib"
|
||||||
)
|
)
|
||||||
@@ -234,9 +266,12 @@ function generate_template() {
|
|||||||
console.log("- " + key);
|
console.log("- " + key);
|
||||||
|
|
||||||
const search_condition = "<" + step_key + "." + key + ":";
|
const search_condition = "<" + step_key + "." + key + ":";
|
||||||
const condition_pos = out.search(search_condition);
|
|
||||||
|
|
||||||
if(condition_pos >= 0) {
|
while(true) {
|
||||||
|
const condition_pos = out.search(search_condition);
|
||||||
|
|
||||||
|
if(condition_pos < 0) break;
|
||||||
|
|
||||||
const condition_end_pos = out.slice(condition_pos).search(">");
|
const condition_end_pos = out.slice(condition_pos).search(">");
|
||||||
|
|
||||||
if(condition_end_pos >= 0) {
|
if(condition_end_pos >= 0) {
|
||||||
@@ -249,9 +284,12 @@ function generate_template() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const search_replacement = "{" + step_key + "." + key + "}";
|
const search_replacement = "{" + step_key + "." + key + "}";
|
||||||
const replacement_pos = out.search(search_replacement);
|
|
||||||
|
|
||||||
if(replacement_pos >= 0) {
|
while(true) {
|
||||||
|
const replacement_pos = out.search(search_replacement);
|
||||||
|
|
||||||
|
if(replacement_pos < 0) break;
|
||||||
|
|
||||||
const head = out.slice(0, replacement_pos);
|
const head = out.slice(0, replacement_pos);
|
||||||
const meat = result[key];
|
const meat = result[key];
|
||||||
const tail = out.slice(replacement_pos + search_replacement.length);
|
const tail = out.slice(replacement_pos + search_replacement.length);
|
||||||
|
23
ui.js
23
ui.js
@@ -178,6 +178,19 @@ async function assignment_layout(content, result) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function finishing_touches_layout(content, result) {
|
||||||
|
content.appendChild(new BinaryInputBuilder(result, "has_keywords")
|
||||||
|
.label("Vložit klíčová slova")
|
||||||
|
.finish());
|
||||||
|
content.appendChild(new BinaryInputBuilder(result, "has_acknowledgement")
|
||||||
|
.label("Vložit poděkování")
|
||||||
|
.finish());
|
||||||
|
content.appendChild(new ElementBuilder("div.vertical-spacer").finish());
|
||||||
|
content.appendChild(new ElementBuilder("div.hint")
|
||||||
|
.text("Generátor pouze vygeneruje ukázky, jak by tato pole měla vypadat. Samotná klíčová slova či poděkování si poté upravíte dle svých potřeb.")
|
||||||
|
.finish());
|
||||||
|
}
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
startbutton.style.cursor = "auto";
|
startbutton.style.cursor = "auto";
|
||||||
startbutton.disabled = true;
|
startbutton.disabled = true;
|
||||||
@@ -219,14 +232,20 @@ async function run() {
|
|||||||
let steps_len = Object.keys(steps).length;
|
let steps_len = Object.keys(steps).length;
|
||||||
|
|
||||||
while(id < steps_len) {
|
while(id < steps_len) {
|
||||||
|
let step = get_step(id);
|
||||||
|
|
||||||
|
if(step.condition && !step.condition()) {
|
||||||
|
if(animation > 0) id++;
|
||||||
|
if(animation < 0) id--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
back_button.style.display = (id != 0) ? "" : "none";
|
back_button.style.display = (id != 0) ? "" : "none";
|
||||||
next_button.innerText = (id < steps_len - 1) ? "Další →" : "Dokončit";
|
next_button.innerText = (id < steps_len - 1) ? "Další →" : "Dokončit";
|
||||||
next_button.disabled = false;
|
next_button.disabled = false;
|
||||||
|
|
||||||
container.innerHTML = "";
|
container.innerHTML = "";
|
||||||
|
|
||||||
let step = get_step(id);
|
|
||||||
|
|
||||||
let title = new ElementBuilder("h1")
|
let title = new ElementBuilder("h1")
|
||||||
.html(step.title)
|
.html(step.title)
|
||||||
.finish();
|
.finish();
|
||||||
|
8
utils.js
8
utils.js
@@ -235,11 +235,13 @@ class BinaryInputBuilder {
|
|||||||
let input = new ElementBuilder("input#" + this.key)
|
let input = new ElementBuilder("input#" + this.key)
|
||||||
.type("checkbox")
|
.type("checkbox")
|
||||||
.checked(this.result[this.key])
|
.checked(this.result[this.key])
|
||||||
.if(this.update_handler !== null, b => b.on_click(e => {
|
.on_click(e => {
|
||||||
console.log(e.target.checked);
|
console.log(e.target.checked);
|
||||||
this.result[this.key] = e.target.checked;
|
this.result[this.key] = e.target.checked;
|
||||||
this.update_handler(e.target.checked);
|
if(this.update_handler !== null) {
|
||||||
}))
|
this.update_handler(e.target.checked);
|
||||||
|
}
|
||||||
|
})
|
||||||
.finish();
|
.finish();
|
||||||
|
|
||||||
let bundle = new ElementBuilder("div.horizontal-list")
|
let bundle = new ElementBuilder("div.horizontal-list")
|
||||||
|
Reference in New Issue
Block a user