1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-01-24 14:26:58 +02:00

simplified rules ui

This commit is contained in:
Gani Georgiev 2023-03-04 13:05:55 +02:00
parent a67c14c368
commit e8d61e7b45
2 changed files with 3 additions and 17 deletions

View File

@ -77,22 +77,17 @@
<RuleField label="List/Search rule" formKey="listRule" {collection} bind:rule={collection.listRule} />
<hr class="m-t-sm m-b-sm" />
<RuleField label="View rule" formKey="viewRule" {collection} bind:rule={collection.viewRule} />
{#if !collection?.isView}
<hr class="m-t-sm m-b-sm" />
<RuleField label="Create rule" formKey="createRule" {collection} bind:rule={collection.createRule} />
<hr class="m-t-sm m-b-sm" />
<RuleField label="Update rule" formKey="updateRule" {collection} bind:rule={collection.updateRule} />
<hr class="m-t-sm m-b-sm" />
<RuleField label="Delete rule" formKey="deleteRule" {collection} bind:rule={collection.deleteRule} />
{/if}
{#if collection?.isAuth}
<hr class="m-t-sm m-b-sm" />
<RuleField
label="Manage rule"
formKey="options.manageRule"

View File

@ -53,7 +53,7 @@
</div>
{:else}
<Field
class="form-field rule-field m-0 {required ? 'requied' : ''} {isAdminOnly ? 'disabled' : ''}"
class="form-field rule-field {required ? 'requied' : ''} {isAdminOnly ? 'disabled' : ''}"
name={formKey}
let:uniqueId
>
@ -93,20 +93,11 @@
bind:value={rule}
baseCollection={collection}
disabled={isAdminOnly}
placeholder={!isAdminOnly ? "Leave empty to grant everyone access..." : ""}
/>
<div class="help-block">
<slot {isAdminOnly}>
<p>
{#if isAdminOnly}
Only admins will be able to perform this action (
<button type="button" class="link-primary" on:click={unlock}>unlock to change</button>
).
{:else}
Leave empty to grant everyone access.
{/if}
</p>
</slot>
<slot {isAdminOnly} />
</div>
</Field>
{/if}