Widget: DCTList: Difference between revisions

From LINKS Community Center
Jump to: navigation, search
Eschmidt (talk | contribs)
No edit summary
Eschmidt (talk | contribs)
No edit summary
Line 127: Line 127:
         const selectedSources = Array.from(document.querySelectorAll('#data-source-filter input[type="checkbox"]:checked')).map(checkbox => checkbox.value);
         const selectedSources = Array.from(document.querySelectorAll('#data-source-filter input[type="checkbox"]:checked')).map(checkbox => checkbox.value);
         filterState.dataSources = selectedSources;
         filterState.dataSources = selectedSources;
        document.querySelectorAll('.source-option').forEach(el => {
            const box = el.querySelector('input[type="checkbox"]');
            if (selectedSources.includes(box.value)) { el.classList.remove('unchecked') }
            else { el.classList.add('unchecked'); }
        });


         table.setFilter(dctFilter, filterState);
         table.setFilter(dctFilter, filterState);
Line 140: Line 146:
             const identifier = escapeAttr(curr.name);
             const identifier = escapeAttr(curr.name);
             return prev +  
             return prev +  
                 '<div><input type="checkbox" id="filter-' + identifier + '" value="' + curr.name + '" checked>' +
                 '<div class="source-option"><input type="checkbox" id="filter-' + identifier + '" value="' + curr.name + '" checked>' +
                 '<label for="filter-' + identifier + '"><img src="' + curr.image + '"> ' + curr.name + '</label></div>'
                 '<label for="filter-' + identifier + '"><img src="' + curr.image + '"> ' + curr.name + '</label></div>'
         }, '');
         }, '');

Revision as of 16:00, 8 June 2022

Development verstion of the DCT List.
Not ready for production!