Show adjacent chunks when translating

This commit is contained in:
2021-12-23 00:47:06 +02:00
parent b21637f015
commit 5bfa6285f2
4 changed files with 98 additions and 10 deletions

View File

@@ -0,0 +1,6 @@
document.addEventListener('DOMContentLoaded', function() {
const adjecentTabs = document.querySelector("#adjacent-tabs")
var instance = M.Tabs.init(adjecentTabs, {
});
});

View File

@@ -33,4 +33,4 @@ block content
else if chunk.translation
a.btn.blue review
else
a.btn.black(href=`/translate/${chapter.entry.translationEntries[0].id}/chapter/${chapter.id}/t/${chunk.id}`) translate
a.btn.black(href=`/translate/${chapter.entry.translationEntries[0].id}/chapter/${chapter.id}/t/${chunk.index}`) translate

View File

@@ -5,10 +5,78 @@ block content
.center
h1 Translate into #{chunk.chapter.entry.translationEntries[0].name}
//- TODO: Show previous...
form.row(action=`/translate/${chunk.chapter.entry.translationEntries[0].id}/chapter/${chunk.chapter.id}/t/${chunk.id}`)
.col.s12.m6.input-field
textarea#original-text.materialize-textarea(name="originalText")= chunk.text
label(for="original-text") Original Text
.col.s12.m6.input-field
textarea#translated-text.materialize-textarea(name="translatedText", placeholder=chunk.text)
label(for="original-text") Translated Text
label(for="original-text") Translated Text
//- TODO: Show next...
.row
.col.s12
ul.tabs#adjacent-tabs
if previousChunk
li.tab.col.s6
a(href="#previous-translation") Previous Translation
if nextChunk
li.tab.col.s6
a(href="#next-translation") Next Translation
if previousChunk
.col.s12#previous-translation
table
//- thead
tr
th #{chunk.chapter.entry.dialect.name}
th #{chunk.chapter.entry.translationEntries[0].name}
th
tbody
tr
td= previousChunk.text
td
if previousChunk.translated
span= previousChunk.text
else if previousChunk.translation
span= previousChunk.translation.text
else
span.grey-text= previousChunk.text
td
if previousChunk.translated
span nothing
else if previousChunk.translation
a.btn.blue review
else
a.btn.black(href=`/translate/${previousChunk.chapter.entry.translationEntries[0].id}/chapter/${previousChunk.chapter.id}/t/${previousChunk.index}`) previous translation
if nextChunk
.col.s12#next-translation
table
//- thead
tr
th #{chunk.chapter.entry.dialect.name}
th #{chunk.chapter.entry.translationEntries[0].name}
th
tbody
tr
td= nextChunk.text
td
if nextChunk.translated
span= nextChunk.text
else if nextChunk.translation
span= nextChunk.translation.text
else
span.grey-text= nextChunk.text
td
if nextChunk.translated
span nothing
else if nextChunk.translation
a.btn.blue review
else
a.btn.black(href=`/translate/${nextChunk.chapter.entry.translationEntries[0].id}/chapter/${nextChunk.chapter.id}/t/${nextChunk.index}`) next translation
block additionalScripts
script
include js/init-adjacent-tabs.js