renamed private to protected

This commit is contained in:
Gani Georgiev
2023-04-15 13:27:42 +03:00
parent 8cb0d980ad
commit 177230a765
39 changed files with 113 additions and 125 deletions
+7 -15
View File
@@ -130,27 +130,19 @@
function bindTrigger(newTrigger) {
cleanup();
activeTrigger = newTrigger || container?.parentNode;
if (!activeTrigger) {
return;
}
container?.addEventListener("click", handleClickToggle);
activeTrigger.addEventListener("click", handleClickToggle);
activeTrigger.addEventListener("keydown", handleKeydownToggle);
activeTrigger = newTrigger || container?.parentNode;
activeTrigger?.addEventListener("click", handleClickToggle);
activeTrigger?.addEventListener("keydown", handleKeydownToggle);
}
function cleanup() {
clearTimeout(scrollTimeoutId);
if (!activeTrigger) {
return;
}
container?.removeEventListener("click", handleClickToggle);
activeTrigger.removeEventListener("click", handleClickToggle);
activeTrigger.removeEventListener("keydown", handleKeydownToggle);
activeTrigger?.removeEventListener("click", handleClickToggle);
activeTrigger?.removeEventListener("keydown", handleKeydownToggle);
}
onMount(() => {
@@ -167,7 +159,7 @@
on:focusin={handleFocusChange}
/>
<div bind:this={container} class="toggler-container">
<div bind:this={container} class="toggler-container" tabindex="-1">
{#if active}
<div
bind:this={containerChild}
@@ -273,25 +273,22 @@
<svelte:fragment slot="afterNonempty">
<div class="col-sm-4">
<Field class="form-field form-field-toggle m-0" name="schema.{key}.options.private" let:uniqueId>
<input type="checkbox" id={uniqueId} bind:checked={field.options.private} />
<Field
class="form-field form-field-toggle m-0"
name="schema.{key}.options.protected"
let:uniqueId
>
<input type="checkbox" id={uniqueId} bind:checked={field.options.protected} />
<label for={uniqueId}>
<span class="txt">Private</span>
<i
class="ri-information-line link-hint"
use:tooltip={{
text: `Only those with "View API" rule access will be able to preview or download the file(s).\nAuthenticated user can pass a file token via the "token" query param.`,
position: "top",
}}
/>
<span class="txt">Protected</span>
</label>
<a
href={import.meta.env.PB_PRIVATE_FILE_DOCS}
href={import.meta.env.PB_PROTECTED_FILE_DOCS}
class="toggle-info txt-sm txt-hint m-l-5"
target="_blank"
rel="noopener"
>
Learn more
(Learn more)
</a>
</Field>
</div>
+5 -5
View File
@@ -30,7 +30,7 @@ export function addCollection(collection) {
collections.update((list) => {
CommonHelper.pushOrReplaceByKey(list, collection, "id");
refreshPrivateFilesCollectionsCache();
refreshProtectedFilesCollectionsCache();
return CommonHelper.sortCollections(list);
});
@@ -47,7 +47,7 @@ export function removeCollection(collection) {
return current;
});
refreshPrivateFilesCollectionsCache();
refreshProtectedFilesCollectionsCache();
return list;
});
@@ -73,7 +73,7 @@ export async function loadCollections(activeId = null) {
activeCollection.set(items[0]);
}
refreshPrivateFilesCollectionsCache();
refreshProtectedFilesCollectionsCache();
} catch (err) {
ApiClient.errorResponseHandler(err);
}
@@ -81,11 +81,11 @@ export async function loadCollections(activeId = null) {
isCollectionsLoading.set(false);
}
function refreshPrivateFilesCollectionsCache() {
function refreshProtectedFilesCollectionsCache() {
privateFilesCollectionsCache.update((cache) => {
collections.update((current) => {
for (let c of current) {
cache[c.id] = !!c.schema?.find((f) => f.type == "file" && f.options?.private);
cache[c.id] = !!c.schema?.find((f) => f.type == "file" && f.options?.protected);
}
return current;