MCPcopy Create free account
hub / github.com/error311/FileRise / rowHtml

Function rowHtml

public/js/adminFolderAccess.js:306–417  ·  view source on GitHub ↗
(folder, idx)

Source from the content-addressed store, hash-verified

304 container.appendChild(list);
305
306 const rowHtml = (folder, idx) => {
307 const g = grantsMap[folder] ? { ...grantsMap[folder] } : {};
308 const inheritChecked = g.__inherit === true || g.inherit === true;
309 const explicitFlag =
310 g.__explicit === true ||
311 g.explicit === true ||
312 (g.explicit && typeof g.explicit === 'object');
313 const hasExplicit = explicitFlag || !!(
314 g.view || g.viewOwn || g.manage || g.create || g.upload || g.edit || g.rename ||
315 g.copy || g.move || g.delete || g.extract || g.shareFile || g.shareFolder || g.share || g.write
316 );
317 const writeMetaChecked = !!(
318 g.write ||
319 g.create ||
320 g.upload ||
321 g.edit ||
322 g.rename ||
323 g.copy ||
324 g.delete ||
325 g.extract
326 );
327
328 if (g.share) {
329 g.shareFile = g.shareFile !== false;
330 g.shareFolder = g.shareFolder !== false;
331 }
332
333 const name = folder === "root" ? `${t("root_folder")} /` : folder;
334 const shareFolderDisabled = isAdmin ? true : undefined;
335
336 const toggle = (cap, label, checked, disabled, title = "") => `
337 <label class="form-check fr-toggle perm-toggle" title="${title.replace(/"/g, '&quot;')}">
338 <input type="checkbox" class="fr-toggle-input" data-cap="${cap}"
339 ${checked ? 'checked' : ''} ${disabled ? 'disabled' : ''} aria-label="${label}">
340 <span>${label}</span>
341 </label>
342 `;
343
344 const group = (title, content, bodyClass = '', groupClass = '') => `
345 <div class="perm-group${groupClass ? ` ${groupClass}` : ''}">
346 <div class="perm-group-title">${title}</div>
347 <div class="perm-group-body${bodyClass ? ` ${bodyClass}` : ''}">${content}</div>
348 </div>
349 `;
350
351 const parity = (idx % 2 === 0) ? 'row-even' : 'row-odd';
352
353 return `
354 <div class="folder-access-row ${parity}" data-folder="${folder}" data-inherit="${inheritChecked ? '1' : '0'}" data-explicit="${hasExplicit ? '1' : '0'}" data-admin="${isAdmin ? '1' : '0'}">
355 <div class="folder-cell">
356 <div class="folder-badge">
357 <i class="material-icons" style="font-size:18px;">folder</i>
358 <span class="folder-name-text">${name}</span>
359 <span class="inherited-tag" style="display:none;"></span>
360 <span class="inherit-flag-note pill-note" style="display:none;"></span>
361 <span class="group-flag-note pill-note" style="display:none;"></span>
362 <label class="form-check fr-toggle perm-toggle inherit-inline">
363 <input type="checkbox"

Callers 1

appendChunkFunction · 0.85

Calls 4

tFunction · 0.85
groupFunction · 0.85
tfFunction · 0.70
toggleFunction · 0.70

Tested by

no test coverage detected