Voeg thematische kleurplaten en creatieve niveaus toe (v0.4.65-beta) #3

Open
bes-r wants to merge 207 commits from bes-r/kleurplaten-v0-4-65 into main AGit
5 changed files with 13 additions and 7 deletions
Showing only changes of commit 8b57922307 - Show all commits

View file

@ -1 +1 @@
0.4.21-beta 0.4.22-beta

View file

@ -61,7 +61,7 @@
<button class="tbtn ghost" id="btnMute">🔊</button> <button class="tbtn ghost" id="btnMute">🔊</button>
<button class="tbtn ghost" id="btnZoomOut">A</button> <button class="tbtn ghost" id="btnZoomOut">A</button>
<button class="tbtn ghost" id="zoomPct">100%</button> <button class="tbtn ghost" id="zoomPct">100%</button>
<button class="tbtn ghost" id="btnZoomIn">A</button> <button class="tbtn ghost" id="btnZoomIn">A+</button>
<div class="spacer"></div> <div class="spacer"></div>
<button class="tbtn ghost" id="btnImages">🖼️</button> <button class="tbtn ghost" id="btnImages">🖼️</button>
<button class="tbtn ghost" id="btnFolders">📁</button> <button class="tbtn ghost" id="btnFolders">📁</button>

View file

@ -48,6 +48,12 @@
const creatableRoles = () => const creatableRoles = () =>
[...new Set([currentUser.role, ...(currentUser.extraRoles||[])].flatMap(r => CREATABLE_ROLES[r] || []))]; [...new Set([currentUser.role, ...(currentUser.extraRoles||[])].flatMap(r => CREATABLE_ROLES[r] || []))];
/* wie er als groepsleiding aan een klas gekoppeld kan staan - zelfde rollenset
als de server accepteert in POST /admin/classes/:id/teachers (niet alleen
"teacher": een schoolbeheerder of systeemmanager mag ook aan een klas
gekoppeld worden, en moet dan ook als zodanig getoond worden). */
const isClassStaff = u => ["teacher","admin","super"].includes(u.role);
const esc = s => String(s ?? "").replace(/&/g,"&amp;").replace(/</g,"&lt;"); const esc = s => String(s ?? "").replace(/&/g,"&amp;").replace(/</g,"&lt;");
const h = (tag, cls, text)=>{ const h = (tag, cls, text)=>{
const el = document.createElement(tag); const el = document.createElement(tag);
@ -1084,7 +1090,7 @@
onClick: ()=>{ navLevel = { type:"flat", kind:"requests" }; render(); } })); onClick: ()=>{ navLevel = { type:"flat", kind:"requests" }; render(); } }));
} }
CLASSES.forEach(c=>{ CLASSES.forEach(c=>{
const staff = USERS.filter(u=>u.role==="teacher" && (u.classIds||[]).some(id=>Number(id)===Number(c.id))).length; const staff = USERS.filter(u=>isClassStaff(u) && (u.classIds||[]).some(id=>Number(id)===Number(c.id))).length;
const cp = pupils.filter(u=>u.classId===c.id).length; const cp = pupils.filter(u=>u.classId===c.id).length;
grid.appendChild(tile({ label:c.name, stats:[{text:`🧑‍🏫 ${staff}`},{text:`🧒 ${cp}`}], grid.appendChild(tile({ label:c.name, stats:[{text:`🧑‍🏫 ${staff}`},{text:`🧒 ${cp}`}],
onClick: ()=>{ navLevel = { type:"class", id:c.id }; kebabOpen = false; render(); } })); onClick: ()=>{ navLevel = { type:"class", id:c.id }; kebabOpen = false; render(); } }));
@ -1125,7 +1131,7 @@
panel.appendChild(titleRow); panel.appendChild(titleRow);
if(kebabOpen && canManageClasses) panel.appendChild(classActionsPanel(c, otherSchools)); if(kebabOpen && canManageClasses) panel.appendChild(classActionsPanel(c, otherSchools));
const staff = USERS.filter(u=>u.role==="teacher" && (u.classIds||[]).some(id=>Number(id)===Number(c.id))); const staff = USERS.filter(u=>isClassStaff(u) && (u.classIds||[]).some(id=>Number(id)===Number(c.id)));
panel.appendChild(h("p","am-section-label", T("roleTeacher"))); panel.appendChild(h("p","am-section-label", T("roleTeacher")));
panel.appendChild(peopleList(staff)); panel.appendChild(peopleList(staff));
if(creatableRoles().includes("teacher")) panel.appendChild(addForm("teacher", c.id)); if(creatableRoles().includes("teacher")) panel.appendChild(addForm("teacher", c.id));

View file

@ -120,7 +120,7 @@ function makeWidget(def, saved){
const lockBtn = document.createElement("button"); lockBtn.className="wmin wlock"; lockBtn.textContent="🔓"; head.appendChild(lockBtn); const lockBtn = document.createElement("button"); lockBtn.className="wmin wlock"; lockBtn.textContent="🔓"; head.appendChild(lockBtn);
const previewBtn = document.createElement("button"); previewBtn.className="wmin wpreview"; previewBtn.textContent="◉"; head.appendChild(previewBtn); const previewBtn = document.createElement("button"); previewBtn.className="wmin wpreview"; previewBtn.textContent="◉"; head.appendChild(previewBtn);
const zBtn = document.createElement("button"); const zBtn = document.createElement("button");
zBtn.className = "wmin wz"; zBtn.textContent = "A"; zBtn.className = "wmin wz"; zBtn.textContent = "A+";
head.appendChild(zBtn); head.appendChild(zBtn);
const minBtn = document.createElement("button"); const minBtn = document.createElement("button");
minBtn.className = "wmin"; minBtn.textContent = ""; minBtn.className = "wmin"; minBtn.textContent = "";
@ -194,7 +194,7 @@ function makeWidget(def, saved){
function applyWZ(){ function applyWZ(){
body.style.zoom = wz; body.style.zoom = wz;
win.dataset.wz = wz; win.dataset.wz = wz;
zBtn.textContent = wz===1 ? "A" : Math.round(wz*100)+"%"; zBtn.textContent = wz===1 ? "A+" : Math.round(wz*100)+"%";
zBtn.classList.toggle("on", wz!==1); zBtn.classList.toggle("on", wz!==1);
zBtn.title = T("wZoom"); zBtn.title = T("wZoom");
} }

View file

@ -2,7 +2,7 @@
"use strict"; "use strict";
/* version shown until /api/version resolves (or if the fetch fails, e.g. offline). /* version shown until /api/version resolves (or if the fetch fails, e.g. offline).
Kept in sync by hand with the VERSION file at the repo root on every release. */ Kept in sync by hand with the VERSION file at the repo root on every release. */
const VERSION = "0.4.21-beta"; const VERSION = "0.4.22-beta";
(function(){ (function(){
const tag = document.getElementById("verTag"); const tag = document.getElementById("verTag");
tag.textContent = "v"+VERSION; tag.textContent = "v"+VERSION;