Skip to content

Commit

Permalink
fix: don't show segment outside translation/transcription and fix tra…
Browse files Browse the repository at this point in the history
…nslation supression
  • Loading branch information
FrFerry committed Nov 18, 2022
1 parent ecf0e79 commit dfd91fe
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/components/editors/RichTextEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
/>
</div>
<div
v-if="currentUserIsTeacher || currentUserIsAdmin"
v-if="(currentSection === 'transcription' || currentSection === 'translation') && (currentUserIsTeacher || currentUserIsAdmin)"
class="editor-controls-group"
>
<label>Segments</label>
Expand Down
28 changes: 16 additions & 12 deletions src/store/modules/translation/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import Quill from '../../../modules/quill/AdeleQuill';
import {http} from '../../../modules/http-common';

import {
TEIToQuill,
insertSegments, stripSegments, quillToTEI, convertLinebreakTEIToQuill,
computeAlignmentPointers
} from '../../../modules/quill/MarkupUtils'

const state = {
translationLoading: true,
translation: null,
Expand Down Expand Up @@ -92,33 +85,44 @@ const actions = {
}
},
/* useful */
addNewTranslation ({commit, dispatch, rootState}) {
async addNewTranslation ({commit, dispatch, rootState}) {
commit('LOADING_STATUS', true)
const emptyTranslation = {
data: {
content: ""
}
}
return http.post(`documents/${rootState.document.document.id}/translations/from-user/${rootState.workflow.selectedUserId}`, emptyTranslation).then(response => {
try {
const response = await http.post(`documents/${rootState.document.document.id}/translations/from-user/${rootState.workflow.selectedUserId}`, emptyTranslation)
commit('UPDATE', response.data.data)
commit('SET_ERROR', null)
}).catch(error => {
commit('LOADING_STATUS', false)
} catch (error) {
commit('SET_ERROR', error)
})
commit('CLEAR')
commit('LOADING_STATUS', false)
}
},
/* useful */
setError({commit}, payload) {
commit('SET_ERROR', payload)
},
/* useful */
async deleteTranslationFromUser({dispatch, commit}, {docId, userId}) {
commit('LOADING_STATUS', true)
try {
commit('SET_ERROR', null)
const response = await http.delete(`documents/${docId}/translations/from-user/${userId}`)
await dispatch('document/partialUpdate', {
validation_flags: response.data.data.validation_flags
}, {root: true})
await dispatch('fetchTranslationContent')
commit('CLEAR')
commit('LOADING_STATUS', false)
} catch(error) {
commit('SET_ERROR', error)
commit('SET_ERROR', error);
commit('SAVING_STATUS', 'error');
commit('LOADING_STATUS', false);
}
},

Expand Down

0 comments on commit dfd91fe

Please sign in to comment.