Difference between revisions of "Widget:DCTList"

From LINKS Community Center
Jump to: navigation, search
Line 90: Line 90:
 
     const sourcesLayout = [
 
     const sourcesLayout = [
 
         ['Crowd', 'Web'],
 
         ['Crowd', 'Web'],
         ['Facebook', 'Twitter', 'Instagram']
+
         ['Facebook', 'Twitter', 'Instagram', 'YouTube']
 
     ];
 
     ];
  
Line 229: Line 229:
  
 
         // Set up filters.
 
         // Set up filters.
 +
        const groupedSources = [];
 +
        for (const layoutGroup of sourcesLayout) {
 +
            const group = [];
 +
            for (const source of layoutGroup) {
 +
                let idx = dataSources.findIndex(src => src.name === source);
 +
                if (idx !== -1) {
 +
                    group.push(dataSources.splice(idx, 1)[0]);
 +
                }
 +
            }
 +
            if (group.length > 0) groupedSources.push(group);
 +
        }
 +
        console.log(groupedSources)
 +
 
         const filterHtml = dataSources.reduce((prev, curr, idx) => {
 
         const filterHtml = dataSources.reduce((prev, curr, idx) => {
 
             const identifier = escapeAttr(curr.name);
 
             const identifier = escapeAttr(curr.name);

Revision as of 15:39, 13 June 2022

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