Main functionality for translation entries
This commit is contained in:
@@ -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
|
||||
16
server/views/js/init-dialect-autocomplete.js
Normal file
16
server/views/js/init-dialect-autocomplete.js
Normal 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
|
||||
});
|
||||
})
|
||||
|
||||
});
|
||||
7
server/views/translation-entry.pug
Normal file
7
server/views/translation-entry.pug
Normal file
@@ -0,0 +1,7 @@
|
||||
extend templates/layout.pug
|
||||
|
||||
block content
|
||||
.container
|
||||
.center
|
||||
h1= translationEntry.name
|
||||
h2= translationEntry.entry.name
|
||||
22
server/views/translation-form.pug
Normal file
22
server/views/translation-form.pug
Normal 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
|
||||
Reference in New Issue
Block a user