Skip to content

Commit

Permalink
Keep same expanded state of translations when linking/unliniking
Browse files Browse the repository at this point in the history
This handles more properly the issue in #628. We don't need to expand all the time.
  • Loading branch information
trang committed Apr 11, 2020
1 parent e05ea18 commit 9f29300
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions webroot/js/directives/sentence-and-translations.dir.js
Expand Up @@ -329,12 +329,11 @@
var sentence = result.data.sentence;
initSentence(sentence);
if (translationLang === 'und') {
refreshTranslations(sentence.translations);
updateNewTranslationsInfo(translation, sentenceId);
updateNewTranslationsInfo(translation, sentenceId, sentence.translations);
} else {
allDirectTranslations.unshift(translation);
refreshTranslations();
}
refreshTranslations();
vm.newTranslation = {};
show('translations');
vm.inProgress = false;
Expand Down Expand Up @@ -647,12 +646,17 @@
allIndirectTranslations = translations[1];
}

showAllTranslations();
vm.isExpanded = true;
vm.expandableIcon = 'expand_less';
if (vm.isExpanded) {
showAllTranslations();
} else {
showFewerTranslations();
}
}

function updateNewTranslationsInfo(translation, sentenceId) {
function updateNewTranslationsInfo(translation, sentenceId, translations) {
allDirectTranslations = translations[0];
allIndirectTranslations = translations[1];

newTranslations.push(translation.id);
if (translation.isDuplicate) {
duplicateTranslations.push(translation.id);
Expand Down

0 comments on commit 9f29300

Please sign in to comment.