Main functionality for translation entries

This commit is contained in:
2021-12-19 23:54:40 +02:00
parent 3515a687a2
commit 32a70881ba
7 changed files with 171 additions and 1 deletions

View File

@@ -5,6 +5,8 @@ block content
.center
h1= entry.name
.divider
.row
a.btn.black(href=`/library/${entry.id}/chapters/add`) add chapter
if entry.chapters.length == 0
@@ -15,4 +17,8 @@ block content
.col.s12
a(href=`/library/${entry.id}/chapters/${chapter.id}`)
.card-panel
p.flow-text= chapter.name
p.flow-text= chapter.name
.divider
.row
a.btn.black(href=`/library/${entry.id}/translations/add`) add translation

View File

@@ -0,0 +1,16 @@
document.addEventListener('DOMContentLoaded', function() {
fetch("http://localhost:7878/api/dialects")
.then(response => response.json())
.then(dialects => {
const dialectsData = dialects.reduce((accumulator, dialect) => {
accumulator[`${dialect.countryId}-${dialect.languageId}: ${dialect.name}`] = null
return accumulator
}, {})
var elems = document.querySelectorAll('#dialect-autocomplete');
var instances = M.Autocomplete.init(elems, {
data: dialectsData
});
})
});

View File

@@ -0,0 +1,7 @@
extend templates/layout.pug
block content
.container
.center
h1= translationEntry.name
h2= translationEntry.entry.name

View File

@@ -0,0 +1,22 @@
extend templates/layout.pug
block content
.container
.center
h1 Translation of #{entry.name}
.row
.col.s12
form.row(action=`/library/${entry.id}/translations/add`, method="post")
.col.s12.input-field
i.material-icons.prefix record_voice_over
input#dialect-autocomplete.autocomplete(type="text", name="dialect", required)
label(for="dialect-autocomplete") Dialect which this translation will be made in.
.col.s12
button.btn.black(type="submit") add translation
block additionalScripts
script
include js/init-dialect-autocomplete.js