refactor(events): Centralize editable fields for event objects
- Implemented a whitelist for editable fields for the 'event' object type to prevent sending read-only fields in POST/PATCH requests. - Created a new file to define the editable fields. - Modified and to use this whitelist. - Removed the temporary cleaning logic from the event settings page. - Corrected Svelte 5 to in event settings components. - Updated Dexie interfaces for badge, badge_template, and device to use string IDs.
This commit is contained in:
@@ -72,8 +72,8 @@
|
||||
<summary class="summary">General Config (cfg_json)</summary>
|
||||
<div class="p-4">
|
||||
<div class="flex justify-end">
|
||||
<button class="btn btn-sm" on:click={() => (cfg_json_view = 'form')}>Form</button>
|
||||
<button class="btn btn-sm" on:click={() => (cfg_json_view = 'json')}>JSON</button>
|
||||
<button class="btn btn-sm" onclick={() => (cfg_json_view = 'form')}>Form</button>
|
||||
<button class="btn btn-sm" onclick={() => (cfg_json_view = 'json')}>JSON</button>
|
||||
</div>
|
||||
{#if cfg_json_view === 'form'}
|
||||
<Ae_comp_event_settings_form
|
||||
@@ -92,10 +92,9 @@
|
||||
event_obj.cfg_json = e.detail;
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
class="btn preset-tonal-primary"
|
||||
on:click={() => handle_save('cfg_json', event_obj.cfg_json)}>Save</button
|
||||
>
|
||||
<button
|
||||
class="btn preset-tonal-primary"
|
||||
onclick={() => handle_save('cfg_json', event_obj.cfg_json)}>Save</button>
|
||||
{/if}
|
||||
</div>
|
||||
</details>
|
||||
@@ -104,10 +103,10 @@
|
||||
<summary class="summary">Presentation Management (mod_pres_mgmt_json)</summary>
|
||||
<div class="p-4">
|
||||
<div class="flex justify-end">
|
||||
<button class="btn btn-sm" on:click={() => (pres_mgmt_json_view = 'form')}
|
||||
<button class="btn btn-sm" onclick={() => (pres_mgmt_json_view = 'form')}
|
||||
>Form</button
|
||||
>
|
||||
<button class="btn btn-sm" on:click={() => (pres_mgmt_json_view = 'json')}
|
||||
<button class="btn btn-sm" onclick={() => (pres_mgmt_json_view = 'json')}
|
||||
>JSON</button
|
||||
>
|
||||
</div>
|
||||
@@ -128,12 +127,11 @@
|
||||
event_obj.mod_pres_mgmt_json = e.detail;
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
class="btn preset-tonal-primary"
|
||||
on:click={() =>
|
||||
handle_save('mod_pres_mgmt_json', event_obj.mod_pres_mgmt_json)}
|
||||
>Save</button
|
||||
>
|
||||
<button
|
||||
class="btn preset-tonal-primary"
|
||||
onclick={() =>
|
||||
handle_save('mod_pres_mgmt_json', event_obj.mod_pres_mgmt_json)}
|
||||
>Save</button>
|
||||
{/if}
|
||||
</div>
|
||||
</details>
|
||||
@@ -142,8 +140,8 @@
|
||||
<summary class="summary">Badges (mod_badges_json)</summary>
|
||||
<div class="p-4">
|
||||
<div class="flex justify-end">
|
||||
<button class="btn btn-sm" on:click={() => (badges_json_view = 'form')}>Form</button>
|
||||
<button class="btn btn-sm" on:click={() => (badges_json_view = 'json')}>JSON</button>
|
||||
<button class="btn btn-sm" onclick={() => (badges_json_view = 'form')}>Form</button>
|
||||
<button class="btn btn-sm" onclick={() => (badges_json_view = 'json')}>JSON</button>
|
||||
</div>
|
||||
{#if badges_json_view === 'form'}
|
||||
<Ae_comp_event_settings_badges_form
|
||||
@@ -162,11 +160,10 @@
|
||||
event_obj.mod_badges_json = e.detail;
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
class="btn preset-tonal-primary"
|
||||
on:click={() => handle_save('mod_badges_json', event_obj.mod_badges_json)}
|
||||
>Save</button
|
||||
>
|
||||
<button
|
||||
class="btn preset-tonal-primary"
|
||||
onclick={() => handle_save('mod_badges_json', event_obj.mod_badges_json)}
|
||||
>Save</button>
|
||||
{/if}
|
||||
</div>
|
||||
</details>
|
||||
@@ -175,10 +172,10 @@
|
||||
<summary class="summary">Abstracts (mod_abstracts_json)</summary>
|
||||
<div class="p-4">
|
||||
<div class="flex justify-end">
|
||||
<button class="btn btn-sm" on:click={() => (abstracts_json_view = 'form')}
|
||||
<button class="btn btn-sm" onclick={() => (abstracts_json_view = 'form')}
|
||||
>Form</button
|
||||
>
|
||||
<button class="btn btn-sm" on:click={() => (abstracts_json_view = 'json')}
|
||||
<button class="btn btn-sm" onclick={() => (abstracts_json_view = 'json')}
|
||||
>JSON</button
|
||||
>
|
||||
</div>
|
||||
@@ -199,11 +196,10 @@
|
||||
event_obj.mod_abstracts_json = e.detail;
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
class="btn preset-tonal-primary"
|
||||
on:click={() => handle_save('mod_abstracts_json', event_obj.mod_abstracts_json)}
|
||||
>Save</button
|
||||
>
|
||||
<button
|
||||
class="btn preset-tonal-primary"
|
||||
onclick={() => handle_save('mod_abstracts_json', event_obj.mod_abstracts_json)}
|
||||
>Save</button>
|
||||
{/if}
|
||||
</div>
|
||||
</details>
|
||||
@@ -222,11 +218,10 @@
|
||||
event_obj.mod_exhibits_json = e.detail;
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
class="btn preset-tonal-primary"
|
||||
on:click={() => handle_save('mod_exhibits_json', event_obj.mod_exhibits_json)}
|
||||
>Save</button
|
||||
>
|
||||
<button
|
||||
class="btn preset-tonal-primary"
|
||||
onclick={() => handle_save('mod_exhibits_json', event_obj.mod_exhibits_json)}
|
||||
>Save</button>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
@@ -244,11 +239,10 @@
|
||||
event_obj.mod_meetings_json = e.detail;
|
||||
}}
|
||||
/>
|
||||
<button
|
||||
class="btn preset-tonal-primary"
|
||||
on:click={() => handle_save('mod_meetings_json', event_obj.mod_meetings_json)}
|
||||
>Save</button
|
||||
>
|
||||
<button
|
||||
class="btn preset-tonal-primary"
|
||||
onclick={() => handle_save('mod_meetings_json', event_obj.mod_meetings_json)}
|
||||
>Save</button>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
@@ -95,5 +95,5 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="btn preset-tonal-primary" on:click={save}>Save</button>
|
||||
<button class="btn preset-tonal-primary" onclick={save}>Save</button>
|
||||
</div>
|
||||
|
||||
@@ -86,5 +86,5 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="btn preset-tonal-primary" on:click={save}>Save</button>
|
||||
<button class="btn preset-tonal-primary" onclick={save}>Save</button>
|
||||
</div>
|
||||
|
||||
@@ -70,5 +70,5 @@
|
||||
<textarea class="textarea" bind:value={event_obj.notes}></textarea>
|
||||
</label>
|
||||
</div>
|
||||
<button class="btn preset-tonal-primary" on:click={save}>Save</button>
|
||||
<button class="btn preset-tonal-primary" onclick={save}>Save</button>
|
||||
</div>
|
||||
|
||||
@@ -28,5 +28,5 @@
|
||||
<input type="text" class="input" bind:value={cfg_json.med_name} />
|
||||
</label>
|
||||
</div>
|
||||
<button class="btn preset-tonal-primary" on:click={save}>Save</button>
|
||||
<button class="btn preset-tonal-primary" onclick={save}>Save</button>
|
||||
</div>
|
||||
|
||||
@@ -134,5 +134,5 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="btn preset-tonal-primary" on:click={save}>Save</button>
|
||||
<button class="btn preset-tonal-primary" onclick={save}>Save</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user