Skip to content

Commit

Permalink
fix(configuration): fix minor issues with usage of choices.js dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentinTh committed Oct 4, 2023
1 parent e5b5a6d commit bb5b879
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
9 changes: 5 additions & 4 deletions src/scripts/add-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,12 @@ const displayContent = async () => {
noChoicesText: 'No muscle to choose from',
addItems: false,
removeItems: false,
itemSelectText: ''
itemSelectText: '',
allowHTML: true
};

selectAntagonist = new Choices('#select-antagonist', selectConfig);
selectAntagonist.setChoices(muscleSelectData);
await selectAntagonist.setChoices(muscleSelectData);
selectAntagonist.enable();

selectAntagonist.passedElement.element.addEventListener('addItem', event => {
Expand All @@ -250,7 +251,7 @@ const displayContent = async () => {
});

selectAgonist = new Choices('#select-agonist', selectConfig);
selectAgonist.setChoices(muscleSelectData);
await selectAgonist.setChoices(muscleSelectData);
selectAgonist.enable();

selectAgonist.passedElement.element.addEventListener('addItem', event => {
Expand All @@ -262,7 +263,7 @@ const displayContent = async () => {
});

selectAngle = new Choices('#select-angle', selectConfig);
selectAngle.setChoices(muscleSelectData);
await selectAngle.setChoices(muscleSelectData);
selectAngle.enable();

selectAngle.passedElement.element.addEventListener('addItem', event => {
Expand Down
11 changes: 6 additions & 5 deletions src/scripts/edit-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const isRequiredInputValid = () => {
}
};

const displayContent = () => {
const displayContent = async () => {
const contentTitle = setupType === 'muscles' ? setupType.slice(0, -1) : setupType;
contentWrapper.insertAdjacentHTML(
'beforeend',
Expand Down Expand Up @@ -246,11 +246,12 @@ const displayContent = () => {
noChoicesText: 'No muscle to choose from',
addItems: false,
removeItems: false,
itemSelectText: ''
itemSelectText: '',
allowHTML: true
};

elements.selectAntagonist = new Choices('#select-antagonist', selectConfig);
elements.selectAntagonist.setChoices(muscleSelectData);
await elements.selectAntagonist.setChoices(muscleSelectData);
elements.selectAntagonist.enable();

elements.selectAntagonist.passedElement.element.addEventListener('addItem', event => {
Expand All @@ -262,7 +263,7 @@ const displayContent = () => {
});

elements.selectAgonist = new Choices('#select-agonist', selectConfig);
elements.selectAgonist.setChoices(muscleSelectData);
await elements.selectAgonist.setChoices(muscleSelectData);
elements.selectAgonist.enable();

elements.selectAgonist.passedElement.element.addEventListener('addItem', event => {
Expand Down Expand Up @@ -386,7 +387,7 @@ const displayData = async updateDataLabel => {
}
};

displayContent();
await displayContent();

const submitButton = document.querySelector('button[type="submit"]');
const resetButton = document.querySelector('button[type="reset"]');
Expand Down

0 comments on commit bb5b879

Please sign in to comment.