Lots of little fixes. Can now save archives.

This commit is contained in:
Scott Idem
2024-11-08 15:43:47 -05:00
parent e6a9a5ceab
commit f4538720b2
10 changed files with 377 additions and 157 deletions

View File

@@ -20,6 +20,7 @@ import { posts_func } from '$lib/ae_posts/ae_posts_functions';
import Comp__post_obj_li from './ae_idaa_comp__post_obj_li.svelte';
import Comp__post_obj_id_view from './ae_idaa_comp__post_obj_id_view.svelte';
import Comp__post_options from './ae_idaa_comp__post_options.svelte';
$: lq__post_obj_li = liveQuery(async () => {
@@ -39,7 +40,7 @@ $: lq__post_obj_li = liveQuery(async () => {
$: lq__post_obj = liveQuery(async () => {
let results = await db_posts.post
.get($idaa_slct.post_id);
.get($idaa_slct.post_id ?? ''); // null or undefined does not reset things like '' does
return results;
});
@@ -47,7 +48,7 @@ $: lq__post_obj = liveQuery(async () => {
$: lq__post_comment_obj_li = liveQuery(async () => {
let results = await db_posts.comment
.where('post_id')
.equals($idaa_slct.post_id)
.equals($idaa_slct.post_id ?? '') // null or undefined does not reset things like '' does
.reverse()
.sortBy('updated_on');
// .sortBy('title');
@@ -57,7 +58,7 @@ $: lq__post_comment_obj_li = liveQuery(async () => {
$: lq__post_comment_obj = liveQuery(async () => {
let results = await db_posts.comment
.get($idaa_slct.post_comment_id);
.get($idaa_slct.post_comment_id ?? ''); // null or undefined does not reset things like '' does
return results;
});
@@ -77,6 +78,10 @@ $: lq__post_comment_obj = liveQuery(async () => {
"
>
<Comp__post_options
/>
<!-- <h1>Bulletin Board {$lq__post_obj_li?.length}</h1> -->
{#if $lq__post_obj_li && $lq__post_obj_li?.length }
@@ -93,8 +98,8 @@ $: lq__post_comment_obj = liveQuery(async () => {
<!-- Modal: Post (Bulletin Board) view ID -->
<Modal
title="{$lq__post_obj?.title} - {$lq__post_obj?.id}"
bind:open={$idaa_sess.bb.show__modal_view}
title="{$lq__post_obj?.title ?? 'New Post'} - {$lq__post_obj?.id ?? 'Not Saved Yet'}"
bind:open={$idaa_sess.bb.show__modal_view__post_id}
autoclose={false}
outsideclose={true}
placement="top-center"
@@ -130,7 +135,7 @@ $: lq__post_comment_obj = liveQuery(async () => {
{/if}
</button>
{/if}
{$lq__post_obj?.title}
{$lq__post_obj?.title ?? 'New Post'}
</h3>
</div>
</svelte:fragment>

View File

@@ -198,14 +198,12 @@ async function handle_delete_post_obj({post_id, method}: key_val) {
<!-- <h3 class="h3">Post</h3> -->
[{$idaa_slct.post_id}]
<input type="hidden" value={$idaa_slct.post_id} />
<section class="ae_section post__general_information border border-gray-200 rounded p-2 space-y-2"> <!-- BEGIN: section post__general_information -->
<label for="title">Title of BB Post:
<input type="text" id="title" name="title" required max="200" value={$idaa_slct.post_obj?.title} placeholder="Title of Post" autocomplete="off" class="input w-96" />
<input type="text" id="title" name="title" required max="200" value={$idaa_slct.post_obj?.title ?? ''} placeholder="Title of Post" autocomplete="off" class="input w-96" />
</label>
<label for="content" class="ae_label post__content">Content (post body):
@@ -227,7 +225,7 @@ async function handle_delete_post_obj({post_id, method}: key_val) {
<select
name="topic_id"
class="select w-96"
value={$idaa_slct.post_obj?.topic_id}
value={$idaa_slct.post_obj?.topic_id ?? ''}
>
<option value="">-- None --</option>
<option value={16}>Licensing/ monitoring/ credentialing issues</option>

View File

@@ -90,9 +90,9 @@ onDestroy(() => {
<div class="post__header">
<h2 class="post__title flex flex-row gap-2 items-center">
<span class="h3">
{@html $lq__post_obj?.title}
{@html $idaa_slct.post_obj?.title ?? 'New Post'} - {$idaa_slct.post_obj?.id ?? 'Not Yet Saved'}
</span>
{#if $lq__post_obj?.topic_id}<span class="badge badge-info variant-glass-secondary"><span class="fas fa-user-md m-1"></span> {$lq__post_obj?.topic_name}</span>{/if}
{#if $idaa_slct.post_obj?.topic_id}<span class="badge badge-info variant-glass-secondary"><span class="fas fa-user-md m-1"></span> {$idaa_slct.post_obj?.topic_name}</span>{/if}
</h2>
</div>

View File

@@ -53,8 +53,8 @@ onMount(() => {
// $idaa_sess.bb.show_main__options = true;
// $idaa_sess.bb.show_list__post_obj_li = true;
// $idaa_sess.bb.show_edit__post_id = false;
$idaa_sess.bb.show__modal_view = true;
$idaa_sess.bb.show__modal_edit = false;
$idaa_sess.bb.show__modal_view__post_id = idaa_post_obj?.post_id;
$idaa_sess.bb.show__modal_edit__post_id = false;
}}
class="btn btn-md variant-ghost-primary hover:variant-filled-primary transition"
title={`View: ${idaa_post_obj?.title}`}
@@ -78,7 +78,7 @@ onMount(() => {
// $idaa_sess.bb.show_main__options = true;
// $idaa_sess.bb.show_list__post_obj_li = true;
// $idaa_sess.bb.show_edit__post_id = true;
$idaa_sess.bb.show__modal_view = true;
$idaa_sess.bb.show__modal_view__post_id = idaa_post_obj.post_id;
$idaa_sess.bb.show__inline_edit__post_obj = true;
}}
class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition"

View File

@@ -0,0 +1,145 @@
<script lang="ts">
// *** Import Aether core variables and functions
import type { key_val } from '$lib/ae_stores';
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
let ae_promises: key_val = {};
let ae_tmp: key_val = {};
let ae_trigger: any = null;
let ae_triggers: key_val = {};
let search_submit_results: any = null;
</script>
<section class="ae_section ae_options filters_and_search flex flex-col gap-1 variant-ghost-success my-2 p-2 border rounded-md items-center justify-center">
<div class="ae_group ae_row flex flex-row flex-wrap gap-1 w-full items-center justify-center">
<!-- Max events select options -->
<span
class="flex flex-row gap-1 items-center justify-around"
>
<label
class="text-sm w-32 text-right"
for="qry_limit__events">
Max events:
</label>
<select
id="qry_limit__events"
bind:value={$idaa_loc.bb.qry__limit}
on:change={() => {
// search__event_presenter({
// api_cfg: $ae_api,
// post_id: $events_slct.post_id,
// agree: true,
// biography: null,
// ft_search_str: '',
// lk_search_str: '',
// params: {
// 'qry__enabled': 'enabled',
// 'qry__hidden': 'not_hidden',
// 'qry__limit': $idaa_loc.bb.qry__limit__events,},
// try_cache: false,
// log_lvl: log_lvl,
// });
}}
class="select w-20 text-sm"
>
<option value={25}>25</option>
<option value={50}>50</option>
<option value={75}>75</option>
<option value={100}>100</option>
<option value={200}>200</option>
<option value={500}>500</option>
</select>
</span>
{#if $ae_loc.trusted_access && !$idaa_loc.bb.qry__hidden || $idaa_loc.bb.qry__hidden == 'not_hidden'}
<button
on:click={() => {
$idaa_loc.bb.qry__hidden = 'all';
$idaa_loc.bb.qry__limit = 200;
ae_trigger = 'load__post_obj_li';
}}
class="btn_show_bb_post ae_btn btn btn-info btn-sm variant-ghost-secondary"
>
<span class="fas fa-eye m-1"></span> Show Hidden Posts
</button>
{:else if $ae_loc.trusted_access && $idaa_loc.bb.qry__hidden != 'not_hidden'}
<button
on:click={() => {
$idaa_loc.bb.qry__hidden = 'not_hidden';
$idaa_loc.bb.qry__limit = 100;
ae_trigger = 'load__post_obj_li';
}}
class="btn_hide_bb_post ae_btn btn btn-info btn-sm variant-ghost-secondary"
>
<span class="fas fa-eye-slash m-1"></span> Hide Hidden Posts
</button>
{/if}
{#if $ae_loc.administrator_access && !$idaa_loc.bb.qry__enabled || $idaa_loc.bb.qry__enabled == 'enabled'}
<button
on:click={() => {
$idaa_loc.bb.qry__hidden = 'all';
$idaa_loc.bb.qry__enabled = 'all';
$idaa_loc.bb.qry__limit = 500;
ae_trigger = 'load__post_obj_li';
}}
class="btn_show_bb_post ae_btn btn btn-warning btn-sm variant-ghost-secondary"
>
<span class="fas fa-eye m-1"></span> Show Disabled Posts
</button>
{:else if $ae_loc.administrator_access && $idaa_loc.bb.qry__enabled != 'enabled'}
<button
on:click={() => {
$idaa_loc.bb.qry__enabled = 'enabled';
ae_trigger = 'load__post_obj_li';
}}
class="btn_hide_bb_post ae_btn btn btn-warning btn-sm variant-ghost-secondary"
>
<span class="fas fa-eye-slash m-1"></span> Hide Disabled Posts
</button>
{/if}
{#if ($ae_loc.trusted_access && $ae_loc.edit_mode) || $idaa_loc.novi_uuid}
<button
disabled={!$ae_loc.trusted_access}
on:click={() => {
if (!confirm('Create new meeting?')) {
return false;
}
// $idaa_slct.post_id = '';
// $idaa_slct.post_id = undefined;
$idaa_slct.post_id = null;
$idaa_slct.post_obj = {};
// const url = new URL(location);
// url.searchParams.delete('post_id');
// history.pushState({}, '', url);
// $idaa_loc.bb.show_main__options = false;
// $idaa_loc.bb.show_list__post_obj_li = false;
// $idaa_loc.bb.show_view__post_obj = false;
// $idaa_loc.bb.show_edit__post_obj = true;
$idaa_sess.bb.show__modal_view__post_id = true;
$idaa_sess.bb.show__inline_edit__post_obj = true;
}}
class="btn_new_recovery_meeting btn btn-sm variant-ghost-warning hover:variant-filled-warning transition text-xs"
>
<span class="fas fa-plus m-1"></span> Create New Meeting
</button>
{/if}
</div>
</section> <!-- END: div filters_and_search -->