[FIX] website_slides: fix content toggle done
Purpose ======= Fix the traceback which was appearing when toggling as done the content in the course template. Specification ============= The traceback happened because when all the content in the section has been completed, we want to collapse the next section automatically. However in this view the sections aren't collapsable which resulted in calling methods on null HTML elements. Fixing this by checking if HTML elements exists before trying to collapse the next section. Task-3449558 closes odoo/odoo#130633 X-original-commit: 51f82b306ed12dc2c8e32d2a0bd3052f8eed5d2a Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
This commit is contained in:
@@ -24,11 +24,10 @@ export const SlideCoursePage = publicWidget.Widget.extend({
|
||||
* Collapse the next category when the current one has just been completed
|
||||
*/
|
||||
collapseNextCategory: function (nextCategoryId) {
|
||||
const $categorySection = document.getElementById(`category-collapse-${nextCategoryId}`);
|
||||
const $categorySlides = document.querySelector(`ul[id=collapse-${nextCategoryId}]`);
|
||||
if ($categorySection.getAttribute('aria-expanded') === 'false' && !$categorySlides.classList.contains('show')) {
|
||||
$categorySection.setAttribute('aria-expanded', true);
|
||||
$categorySlides.classList.add('show')
|
||||
const categorySection = document.getElementById(`category-collapse-${nextCategoryId}`);
|
||||
if (categorySection?.getAttribute('aria-expanded') === 'false') {
|
||||
categorySection.setAttribute('aria-expanded', true);
|
||||
document.querySelector(`ul[id=collapse-${nextCategoryId}]`).classList.add('show');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user