From 3553809f27c51a92e950480959c95f69d91b34ef Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Thu, 7 May 2026 18:42:15 -0400 Subject: [PATCH] Add code field to archive content edit form and IDB - Expose archive_content.code in edit form (trusted + edit_mode only) - Add code to properties_to_save so it persists on every API load/save - Add code field + index to Archive_Content Dexie interface (schema v2) - Minor: center "Add" button rows in archive and content list components Co-Authored-By: Claude Sonnet 4.6 --- .../ae_archives__archive_content.ts | 1 + src/lib/ae_archives/db_archives.ts | 24 ++++++++++++++++++- ...a_comp__archive_content_obj_id_edit.svelte | 16 +++++++++++++ ...e_idaa_comp__archive_content_obj_li.svelte | 2 +- .../ae_idaa_comp__archive_obj_li.svelte | 4 +--- 5 files changed, 42 insertions(+), 5 deletions(-) diff --git a/src/lib/ae_archives/ae_archives__archive_content.ts b/src/lib/ae_archives/ae_archives__archive_content.ts index 48c9de44..0f281470 100644 --- a/src/lib/ae_archives/ae_archives__archive_content.ts +++ b/src/lib/ae_archives/ae_archives__archive_content.ts @@ -299,6 +299,7 @@ export const properties_to_save = [ 'archive_id', 'archive_content_type', 'name', + 'code', 'description', 'content_html', 'content_json', diff --git a/src/lib/ae_archives/db_archives.ts b/src/lib/ae_archives/db_archives.ts index f83c7727..284677ad 100644 --- a/src/lib/ae_archives/db_archives.ts +++ b/src/lib/ae_archives/db_archives.ts @@ -90,6 +90,7 @@ export interface Archive_Content { archive_content_type: string; name: string; + code?: null | string; description?: null | string; content_html?: null | string; @@ -168,7 +169,28 @@ export class MySubClassedDexie extends Dexie { tmp_sort_1, tmp_sort_2, enable, hide, priority, sort, group, notes, created_on, updated_on, [group+priority+sort+updated_on]` }); - + // v2: add code index to content table + this.version(2).stores({ + archive: ` + id, archive_id, + code, + account_id, + name, + original_datetime, original_timezone, original_location, + tmp_sort_1, tmp_sort_2, + enable, hide, priority, sort, group, notes, created_on, updated_on`, + content: ` + id, archive_content_id, + archive_id, + archive_content_type, + name, + code, + hosted_file_id, + original_datetime, original_timezone, original_location, + [group+original_datetime], + tmp_sort_1, tmp_sort_2, + enable, hide, priority, sort, group, notes, created_on, updated_on, [group+priority+sort+updated_on]` + }); } } diff --git a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_id_edit.svelte b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_id_edit.svelte index 17320034..afdd9017 100644 --- a/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_id_edit.svelte +++ b/src/routes/idaa/(idaa)/archives/[archive_id]/ae_idaa_comp__archive_content_obj_id_edit.svelte @@ -117,6 +117,7 @@ if ($idaa_slct.archive_content_id) { // Initialized AFTER the init block above so new-item defaults are in place. interface ArchiveContentForm { name: string; + code: string; archive_content_type: string; filename: string; file_extension: string; @@ -134,6 +135,7 @@ interface ArchiveContentForm { function create_archive_content_form(obj: any, current_timezone = ''): ArchiveContentForm { return { name: obj?.name ?? '', + code: obj?.code ?? '', archive_content_type: obj?.archive_content_type ?? 'hosted_file', filename: obj?.filename ?? '', file_extension: obj?.file_extension ?? '', @@ -223,6 +225,7 @@ async function handle_submit_form(event: SubmitEvent) { } archive_content_do['name'] = archive_content_di.name; + archive_content_do['code'] = archive_content_di?.code?.trim() || null; // Check if the description_new_html exists and is a string if (typeof description_new_html === 'string') { @@ -888,6 +891,19 @@ $effect(() => {
+ {#if $ae_loc.edit_mode} + + {/if} {#if $ae_loc.trusted_access && $ae_loc.edit_mode}
+ class="mb-2 flex w-full max-w-(--breakpoint-lg) flex-row items-center justify-center px-2"> - {:else} - {/if}