Skip to content

Commit

Permalink
Fixed issue #18628: Answer Code updates on base language are not refl…
Browse files Browse the repository at this point in the history
…ected on secondary languages (#2906)

Co-authored-by: lapiudevgit <devgit@lapiu.biz>
  • Loading branch information
gabrieljenik and lapiudevgit committed Feb 21, 2023
1 parent 6135f9e commit c0b6e62
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
Expand Up @@ -6,7 +6,7 @@

<!-- Loop all language, and then hide all but the current selected one with JS. -->
{% for lang in allLanguages %}
<div class="lang-hide lang-{{ lang }}">
<div class="lang-hide lang-{{ lang }} {{ first ? 'base-lang' : 'extra-lang' }}">
{% for scale_id in range(0, scalecount - 1) %}

{% set position = 1 %}
Expand Down
2 changes: 1 addition & 1 deletion application/views/questionAdministration/subquestions.twig
Expand Up @@ -6,7 +6,7 @@

<!-- Loop all language, and then hide all but the current selected one with JS. -->
{% for lang in allLanguages %}
<div class="lang-hide lang-{{ lang }}">
<div class="lang-hide lang-{{ lang }} {{ first ? 'base-lang' : 'extra-lang' }}">
{% for scale_id in range(0, scalecount - 1) %}
{% set anscount = subquestions|length %}
{# TODO : check the rendering of XSCALES / Y SCALES #}
Expand Down
13 changes: 13 additions & 0 deletions assets/scripts/admin/questionEditor.js
Expand Up @@ -2022,6 +2022,16 @@ $(document).on('ready pjax:scriptcomplete', function () {
}
}

/**
* Updates the answer/subquestion code on secondary languages
*/
function syncAnswerSubquestionCode() {
const itemCode = $(this).val();
const commonId = $(this).closest('tr').data('common-id');

$(this).closest('.tab-pane').find(".extra-lang tr[data-common-id='" + commonId + "'] td.code-title").text(itemCode);
}

// Below, things run on pjax:scriptcomplete.

makeAnswersTableSortable();
Expand Down Expand Up @@ -2137,4 +2147,7 @@ $(document).on('ready pjax:scriptcomplete', function () {
});

$('#relevance').on('keyup', showConditionsWarning);

$(document).on('focusout', '#subquestions table.subquestions-table:first-of-type td.code-title input.code', syncAnswerSubquestionCode);
$(document).on('focusout', '#answeroptions table.answeroptions-table:first-of-type td.code-title input.code', syncAnswerSubquestionCode);
});

0 comments on commit c0b6e62

Please sign in to comment.