Skip to content

Commit

Permalink
Fixed issue #18631: Order of answer options done on the base language…
Browse files Browse the repository at this point in the history
… are not reflected on secondary languages. (#2926)

Co-authored-by: lapiudevgit <devgit@lapiu.biz>
  • Loading branch information
gabrieljenik and lapiudevgit committed Mar 8, 2023
1 parent f800947 commit cc0c37b
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions assets/scripts/admin/questionEditor.js
Expand Up @@ -1486,18 +1486,14 @@ $(document).on('ready pjax:scriptcomplete', function () {
const $that = ui.item;
const newindex = Number($that.parent().children().index($that) + 1);
const oldindex = $that.data('oldindex');
const languages = languageJson.langs.split(';');
const scaleId = $that.closest('table').data('scaleid');

languages.forEach((curLanguage, x) => {
if (x > 0) {
const tablebody = $(`#tabpage_${languages[x]}`).find('tbody');
//
if (newindex < oldindex) {
$(`#tabpage_${languages[x]} tbody tr:nth-child(${newindex})`).before($(`#tabpage_${languages[x]} tbody tr:nth-child(${oldindex})`));
} else {
$(`#tabpage_${languages[x]} tbody tr:nth-child(${newindex})`).after($(`#tabpage_${languages[x]} tbody tr:nth-child(${oldindex})`));
tablebody.find('.row_'+newindex).after(tablebody.find('.row_'+oldindex));
}
// Process the corresponding scale id table for each extra language
$that.closest('.tab-pane').find(".extra-lang table[data-scaleid='" + scaleId + "']").each((idx, table) => {
if (newindex < oldindex) {
$(table).find(`tbody tr:nth-child(${newindex})`).before($(table).find(`tbody tr:nth-child(${oldindex})`));
} else {
$(table).find(`tbody tr:nth-child(${newindex})`).after($(table).find(`tbody tr:nth-child(${oldindex})`));
}
});
}
Expand Down

0 comments on commit cc0c37b

Please sign in to comment.