Skip to content

Commit

Permalink
Merge pull request #416 from oat-sa/fix/AUT-3940/order-attr-rename
Browse files Browse the repository at this point in the history
[AUT-3940] Fix: Single order interaction, moving from order to data-order.
  • Loading branch information
KirylHatalski authored Nov 22, 2024
2 parents 21b4450 + 3c6b2ec commit 59eee92
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/qtiCommonRenderer/renderers/interactions/OrderInteraction.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ const _setInstructions = function (interaction) {
};

const resetResponse = function (interaction) {
const isSingleOrder = interaction.attr('order') === 'single';
const orderState = interaction.attr('data-order') || interaction.attr('order');
const isSingleOrder = orderState === 'single';
const $container = containerHelper.get(interaction);
const initialOrder = _.keys(interaction.getChoices());
const $resultArea = $('.result-area', $container);
Expand Down Expand Up @@ -146,7 +147,8 @@ const render = function (interaction) {
choiceSelector = `${$choiceArea.selector} >li:not(.deactivated)`,
resultSelector = `${$resultArea.selector} >li`,
$dragContainer = $container.find('.drag-container'),
isSingleOrder = interaction.attr('order') === 'single',
orderState = interaction.attr('data-order') || interaction.attr('order'),
isSingleOrder = orderState === 'single',
orientation =
interaction.attr('orientation') && orientationSelectionEnabled
? interaction.attr('orientation')
Expand Down Expand Up @@ -573,7 +575,9 @@ const setResponse = function (interaction, response) {
const $container = containerHelper.get(interaction);
const $choiceArea = $('.choice-area', $container);
const $resultArea = $('.result-area', $container);
const isSingleOrder = interaction.attr('order') === 'single';
// legacy order attr support
const orderState = interaction.attr('data-order') || interaction.attr('order');
const isSingleOrder = orderState === 'single';

if (response === null || _.isEmpty(response)) {
resetResponse(interaction);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div {{#if attributes.id}}id="{{attributes.id}}"{{/if}} class="qti-interaction qti-blockInteraction qti-orderInteraction{{#if horizontal}} qti-horizontal{{else}} qti-vertical{{/if}}{{#if attributes.class}} {{attributes.class}}{{/if}}{{#equal attributes.order 'single'}} qti-single{{/equal}}"
<div {{#if attributes.id}}id="{{attributes.id}}"{{/if}} class="qti-interaction qti-blockInteraction qti-orderInteraction{{#if horizontal}} qti-horizontal{{else}} qti-vertical{{/if}}{{#if attributes.class}} {{attributes.class}}{{/if}}{{#equal attributes.data-order 'single'}} qti-single{{/equal}}{{#equal attributes.order 'single'}} qti-single{{/equal}}"
data-serial="{{serial}}"
data-qti-class="orderInteraction"
data-orientation="{{#if horizontal}}horizontal{{else}}vertical{{/if}}"{{#if attributes.xml:lang}} lang="{{attributes.xml:lang}}"{{/if}}>
Expand Down

0 comments on commit 59eee92

Please sign in to comment.