Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AUT-3940] Fix: Single order interaction, moving from order to data-order. #416

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading