Replace Community news with a Featured module section
This commit is contained in:
1 parent
1fe99c126b
commit
81614770bf
6 files changed
+72
-16
No files matched your search
+17
@@ -96,6 +96,22 @@
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------- featured module: one editorial pick, status live from the feed ---------- */
|
||||
var FEATURED = 'mail tracker';
|
||||
|
||||
function updateFeatured(rows) {
|
||||
var link = document.getElementById('featured-link');
|
||||
if (!link) return;
|
||||
var hit = rows.filter(function (m) {
|
||||
return String(m.name || '').toLowerCase().trim() === FEATURED;
|
||||
})[0];
|
||||
if (!hit) return;
|
||||
if (hit.URL) link.href = hit.URL;
|
||||
var branches = document.querySelectorAll('#featured-branches .branch');
|
||||
if (branches[0]) branches[0].classList.toggle('is-on', !!hit.v19);
|
||||
if (branches[1]) branches[1].classList.toggle('is-on', !!hit.v20);
|
||||
}
|
||||
|
||||
if (ocaBody) {
|
||||
fetch('https://n8n.odoo4projects.com/webhook/oc-guy/modules')
|
||||
.then(function (r) { if (!r.ok) throw new Error('http ' + r.status); return r.json(); })
|
||||
@@ -104,6 +120,7 @@
|
||||
: (Array.isArray(payload) ? payload : null);
|
||||
if (!rows || !rows.length) throw new Error('empty');
|
||||
renderOca(rows);
|
||||
updateFeatured(rows);
|
||||
})
|
||||
.catch(function () {
|
||||
/* keep the snapshot already in the markup */
|
||||
|
||||
Reference in new issue
Block a user