Starting real work on the IDAA BB (posts). Can at least view them and their comments now.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
/** @type {import('./$types').PageData} */
|
||||
export let data: any;
|
||||
let log_lvl = 2;
|
||||
let log_lvl = 1;
|
||||
// console.log(`ae_idaa_bb +page.svelte data:`, data);
|
||||
|
||||
import { browser } from '$app/environment';
|
||||
@@ -26,7 +26,13 @@ $: lq__post_obj_li = liveQuery(async () => {
|
||||
let results = await db_posts.post
|
||||
.where('account_id')
|
||||
.equals($slct.account_id)
|
||||
.sortBy('name');
|
||||
// .orderBy('updated_on')
|
||||
// .toArray()
|
||||
.reverse()
|
||||
.sortBy('updated_on');
|
||||
// .sortBy('updated_on, created_on');
|
||||
// .sortBy('[updated_on+created_on]');
|
||||
// .sortBy('[created_on+updated_on]');
|
||||
|
||||
return results;
|
||||
});
|
||||
@@ -38,12 +44,23 @@ $: lq__post_obj = liveQuery(async () => {
|
||||
return results;
|
||||
});
|
||||
|
||||
$: lq__post_comment_obj_li = liveQuery(async () => {
|
||||
let results = await db_posts.comment
|
||||
.where('post_id')
|
||||
.equals($idaa_slct.post_id)
|
||||
.reverse()
|
||||
.sortBy('updated_on');
|
||||
// .sortBy('title');
|
||||
|
||||
return results;
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<section
|
||||
class="
|
||||
ae_idaa__recovery_meetings
|
||||
ae_idaa__bb
|
||||
container h-full mx-auto
|
||||
flex flex-col gap-1
|
||||
py-1 px-2 pb-16
|
||||
@@ -53,29 +70,59 @@ $: lq__post_obj = liveQuery(async () => {
|
||||
"
|
||||
>
|
||||
|
||||
<!-- <h1>Bulletin Board {$lq__post_obj_li?.length}</h1> -->
|
||||
|
||||
<h1>Bulletin Board {$lq__post_obj_li?.length}</h1>
|
||||
{#if $lq__post_obj_li && $lq__post_obj_li?.length }
|
||||
<Comp__post_obj_li
|
||||
lq__post_obj_li={lq__post_obj_li}
|
||||
/>
|
||||
{:else}
|
||||
<p>No posts available to show.</p>
|
||||
{/if}
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<!-- Main modal -->
|
||||
<!-- Modal: Post (Bulletin Board) view ID -->
|
||||
<Modal
|
||||
title="{$lq__post_obj?.title} - {$lq__post_obj?.id}"
|
||||
bind:open={$idaa_slct.post_id}
|
||||
bind:open={$idaa_sess.bb.show__modal_view}
|
||||
autoclose={false}
|
||||
size="xl"
|
||||
outsideclose={true}
|
||||
placement="top-center"
|
||||
size="lg"
|
||||
class="bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200 rounded-lg border-gray-200 dark:border-gray-700 divide-gray-200 dark:divide-gray-700 shadow-md relative flex flex-col mx-auto w-full divide-y"
|
||||
>
|
||||
|
||||
<svelte:fragment slot="header">
|
||||
|
||||
<div class="flex flex-row items-center justify-between w-full">
|
||||
<h3 class="text-lg font-semibold">
|
||||
{#if $ae_loc.trusted_access || $lq__post_obj?.external_person_id === $idaa_loc.novi_uuid}
|
||||
<button
|
||||
on:click={() => {
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('post_id', $lq__post_obj?.post_id_random);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
$idaa_sess.bb.show__modal_view = false;
|
||||
$idaa_sess.bb.show__modal_edit = true;
|
||||
}}
|
||||
class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition"
|
||||
title={`Edit meeting: ${$lq__post_obj?.title}`}
|
||||
>
|
||||
<span class="fas fa-edit m-1"></span> Edit
|
||||
</button>
|
||||
{/if}
|
||||
{$lq__post_obj?.title}
|
||||
</h3>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
|
||||
<Comp__post_obj_id_view
|
||||
lq__post_obj={lq__post_obj}
|
||||
lq__post_comment_obj_li={lq__post_comment_obj_li}
|
||||
/>
|
||||
|
||||
</Modal>
|
||||
@@ -6,9 +6,8 @@ type key_val = {
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
import { ae, api, Element_modal_v3 } from 'aether_npm_lib';
|
||||
|
||||
import { slct, slct_trigger, ae_app } from './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';
|
||||
|
||||
// *** Import Aether core components
|
||||
|
||||
@@ -19,53 +18,53 @@ import Edit_post_obj from './10_edit__post_obj.svelte';
|
||||
import View_post_obj from './ae_idaa_comp__post_obj_id_view.svelte';
|
||||
|
||||
// *** Export/Exposed variables and functions for component
|
||||
export let account_id: string = $ae_app.account_id;
|
||||
export let post_id: string = $ae_app.posts.post_id;
|
||||
export let account_id: string = $ae_loc.account_id;
|
||||
export let post_id: string = $idaa_loc.bb.post_id;
|
||||
|
||||
export let novi_uuid: string = $ae_app.novi_uuid;
|
||||
export let novi_email: string = $ae_app.novi_email;
|
||||
export let novi_full_name: string = $ae_app.novi_full_name;
|
||||
export let novi_admin_li: string = $ae_app.novi_admin_li;
|
||||
export let novi_trusted_li: string = $ae_app.novi_trusted_li;
|
||||
export let novi_uuid: string = $idaa_loc.novi_uuid;
|
||||
export let novi_email: string = $idaa_loc.novi_email;
|
||||
export let novi_full_name: string = $idaa_loc.novi_full_name;
|
||||
export let novi_admin_li: string = $idaa_loc.novi_admin_li;
|
||||
export let novi_trusted_li: string = $idaa_loc.novi_trusted_li;
|
||||
|
||||
// *** Set initial variables
|
||||
$ae_app.novi_uuid = novi_uuid;
|
||||
$ae_app.novi_email = decodeURIComponent(novi_email);
|
||||
$ae_app.novi_full_name = decodeURIComponent(novi_full_name);
|
||||
$ae_app.novi_admin_li = novi_admin_li;
|
||||
$ae_app.novi_trusted_li = novi_trusted_li;
|
||||
$idaa_loc.novi_uuid = novi_uuid;
|
||||
$idaa_loc.novi_email = decodeURIComponent(novi_email);
|
||||
$idaa_loc.novi_full_name = decodeURIComponent(novi_full_name);
|
||||
$idaa_loc.novi_admin_li = novi_admin_li;
|
||||
$idaa_loc.novi_trusted_li = novi_trusted_li;
|
||||
|
||||
$ae_app.posts.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$idaa_loc.bb.show_main__options = true;
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
|
||||
// NOTE: Check if the novi_uuid is in the novi_admin_li list
|
||||
if ($ae_app.novi_uuid && $ae_app.novi_admin_li) {
|
||||
if ($ae_app.novi_admin_li.includes($ae_app.novi_uuid)) {
|
||||
$ae_app.access_type = 'administrator';
|
||||
$ae_app.administrator_access = true;
|
||||
$ae_app.trusted_access = true;
|
||||
if ($idaa_loc.novi_uuid && $idaa_loc.novi_admin_li) {
|
||||
if ($idaa_loc.novi_admin_li.includes($idaa_loc.novi_uuid)) {
|
||||
$ae_loc.access_type = 'administrator';
|
||||
$ae_loc.administrator_access = true;
|
||||
$ae_loc.trusted_access = true;
|
||||
}
|
||||
}
|
||||
// NOTE: Check if the novi_uuid is in the novi_trusted_li list
|
||||
if ($ae_app.novi_uuid && $ae_app.novi_trusted_li) {
|
||||
if ($ae_app.novi_trusted_li.includes($ae_app.novi_uuid)) {
|
||||
$ae_app.access_type = 'trusted';
|
||||
$ae_app.trusted_access = true;
|
||||
if ($idaa_loc.novi_uuid && $idaa_loc.novi_trusted_li) {
|
||||
if ($idaa_loc.novi_trusted_li.includes($idaa_loc.novi_uuid)) {
|
||||
$ae_loc.access_type = 'trusted';
|
||||
$ae_loc.trusted_access = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($ae_app.administrator_access) {
|
||||
$ae_app.posts.enabled = 'enabled';
|
||||
$ae_app.posts.hidden = 'not_hidden';
|
||||
$ae_app.events.limit = 150;
|
||||
} else if ($ae_app.trusted_access) {
|
||||
$ae_app.posts.enabled = 'enabled';
|
||||
$ae_app.posts.hidden = 'not_hidden';
|
||||
$ae_app.events.limit = 75;
|
||||
if ($ae_loc.administrator_access) {
|
||||
$idaa_loc.bb.enabled = 'enabled';
|
||||
$idaa_loc.bb.hidden = 'not_hidden';
|
||||
$idaa_loc.bb.limit = 150;
|
||||
} else if ($ae_loc.trusted_access) {
|
||||
$idaa_loc.bb.enabled = 'enabled';
|
||||
$idaa_loc.bb.hidden = 'not_hidden';
|
||||
$idaa_loc.bb.limit = 75;
|
||||
} else {
|
||||
$ae_app.posts.enabled = 'enabled';
|
||||
$ae_app.posts.hidden = 'not_hidden';
|
||||
$ae_app.events.limit = 50;
|
||||
$idaa_loc.bb.enabled = 'enabled';
|
||||
$idaa_loc.bb.hidden = 'not_hidden';
|
||||
$idaa_loc.bb.limit = 50;
|
||||
}
|
||||
|
||||
let idaa_post_obj_li_get_promise;
|
||||
@@ -93,10 +92,10 @@ if (post_id) {
|
||||
// url.searchParams.set('post_id', $slct.post_id);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
$ae_app.events.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = false;
|
||||
$ae_app.posts.show_view__post_id = true;
|
||||
$idaa_loc.bb.show_main__options = true;
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
$idaa_loc.bb.show_edit__post_id = false;
|
||||
$idaa_loc.bb.show_view__post_id = true;
|
||||
}
|
||||
|
||||
if (!$ae_app.client_content) {
|
||||
@@ -149,10 +148,10 @@ $: if ($slct_trigger == 'load__post_obj_li' && $slct.account_id) {
|
||||
async function handle_load_idaa_post_obj_li({account_id, try_cache=false}) {
|
||||
console.log('*** handle_load_idaa_post_obj_li() ***');
|
||||
|
||||
let enabled = $ae_app.posts.enabled;
|
||||
let hidden = $ae_app.posts.hidden;
|
||||
let limit = $ae_app.posts.limit;
|
||||
let offset = $ae_app.posts.offset;
|
||||
let enabled = $idaa_loc.bb.enabled;
|
||||
let hidden = $idaa_loc.bb.hidden;
|
||||
let limit = $idaa_loc.bb.limit;
|
||||
let offset = $idaa_loc.bb.offset;
|
||||
|
||||
let params = {};
|
||||
|
||||
@@ -200,19 +199,19 @@ $: if ($slct_trigger == 'load__post_obj' && $slct.post_id) {
|
||||
// let message = {'post_id': $slct.post_id};
|
||||
// window.parent.postMessage(message, "*");
|
||||
|
||||
// $ae_app.posts.show_main__options = false;
|
||||
// $ae_app.posts.show_list__post_li = false;
|
||||
// $ae_app.posts.show_view__post_id = true;
|
||||
// $ae_app.posts.show_edit__post_id = false;
|
||||
// $idaa_loc.bb.show_main__options = false;
|
||||
// $idaa_loc.bb.show_list__post_li = false;
|
||||
// $idaa_loc.bb.show_view__post_id = true;
|
||||
// $idaa_loc.bb.show_edit__post_id = false;
|
||||
}
|
||||
|
||||
async function handle_load_post_id_obj({post_id, try_cache=false}) {
|
||||
console.log('*** handle_load_post_id_obj() ***');
|
||||
|
||||
// let enabled = $ae_app.posts.enabled;
|
||||
// let hidden = $ae_app.posts.hidden;
|
||||
// let limit = $ae_app.posts.limit;
|
||||
// let offset = $ae_app.posts.offset;
|
||||
// let enabled = $idaa_loc.bb.enabled;
|
||||
// let hidden = $idaa_loc.bb.hidden;
|
||||
// let limit = $idaa_loc.bb.limit;
|
||||
// let offset = $idaa_loc.bb.offset;
|
||||
|
||||
let params = {};
|
||||
|
||||
@@ -255,10 +254,10 @@ $: if ($slct_trigger == 'load__post_comment_obj_li' && $slct.post_id) {
|
||||
async function handle_load_post_comment_obj_li({post_id, try_cache=false}) {
|
||||
console.log('*** handle_load_post_comment_obj_li() ***');
|
||||
|
||||
let enabled = $ae_app.posts.enabled;
|
||||
let hidden = $ae_app.posts.hidden;
|
||||
let limit = $ae_app.posts.limit;
|
||||
let offset = $ae_app.posts.offset;
|
||||
let enabled = $idaa_loc.bb.enabled;
|
||||
let hidden = $idaa_loc.bb.hidden;
|
||||
let limit = $idaa_loc.bb.limit;
|
||||
let offset = $idaa_loc.bb.offset;
|
||||
|
||||
let params = {};
|
||||
|
||||
@@ -300,9 +299,9 @@ function handle_post_obj_created(event) {
|
||||
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = false;
|
||||
$ae_app.posts.show_view__post_id = false;
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
$idaa_loc.bb.show_edit__post_id = false;
|
||||
$idaa_loc.bb.show_view__post_id = false;
|
||||
}
|
||||
|
||||
function handle_post_obj_updated(event) {
|
||||
@@ -314,9 +313,9 @@ function handle_post_obj_updated(event) {
|
||||
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = false;
|
||||
$ae_app.posts.show_view__post_id = false;
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
$idaa_loc.bb.show_edit__post_id = false;
|
||||
$idaa_loc.bb.show_view__post_id = false;
|
||||
}
|
||||
|
||||
function handle_post_obj_deleted(event) {
|
||||
@@ -328,9 +327,9 @@ function handle_post_obj_deleted(event) {
|
||||
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = false;
|
||||
$ae_app.posts.show_view__post_id = false;
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
$idaa_loc.bb.show_edit__post_id = false;
|
||||
$idaa_loc.bb.show_view__post_id = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -342,39 +341,39 @@ function handle_post_obj_deleted(event) {
|
||||
|
||||
<section class="ae_section ae_meta">
|
||||
<p>
|
||||
Novi: {$ae_app.novi_full_name}
|
||||
Novi: {$idaa_loc.novi_full_name}
|
||||
<span class="details">
|
||||
(
|
||||
{$ae_app.novi_email}
|
||||
{#if $ae_app.administrator_access}
|
||||
{$idaa_loc.novi_email}
|
||||
{#if $ae_loc.administrator_access}
|
||||
<span class="access_type administrator_access">Administrator</span>
|
||||
{:else if $ae_app.trusted_access}
|
||||
{:else if $ae_loc.trusted_access}
|
||||
<span class="access_type trusted_access">Trusted</span>
|
||||
{/if}
|
||||
<span class="novi_uuid">UUID: {$ae_app.novi_uuid}</span>
|
||||
<span class="novi_uuid">UUID: {$idaa_loc.novi_uuid}</span>
|
||||
)
|
||||
</span>
|
||||
</p>
|
||||
<!-- <p>Page height: {window.innerHeight}</p> -->
|
||||
</section>
|
||||
|
||||
{#if $ae_app.posts.show_main__options}
|
||||
{#if $idaa_loc.bb.show_main__options}
|
||||
<section class="ae_section ae_options ae_row post_obj__options">
|
||||
|
||||
{#if $ae_app.trusted_access && $ae_app.posts.hidden == 'not_hidden'}
|
||||
{#if $ae_loc.trusted_access && $idaa_loc.bb.hidden == 'not_hidden'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.posts.hidden = 'all';
|
||||
$idaa_loc.bb.hidden = 'all';
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-info"
|
||||
>
|
||||
<span class="fas fa-eye"></span> Show Hidden Posts
|
||||
</button>
|
||||
{:else if $ae_app.trusted_access && $ae_app.posts.hidden == 'all'}
|
||||
{:else if $ae_loc.trusted_access && $idaa_loc.bb.hidden == 'all'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.posts.hidden = 'not_hidden';
|
||||
$idaa_loc.bb.hidden = 'not_hidden';
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-info"
|
||||
@@ -383,13 +382,13 @@ function handle_post_obj_deleted(event) {
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
{#if $ae_app.administrator_access}
|
||||
{#if $ae_app.posts.enabled == 'enabled'}
|
||||
{#if $ae_loc.administrator_access}
|
||||
{#if $idaa_loc.bb.enabled == 'enabled'}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.posts.hidden = 'all';
|
||||
$ae_app.posts.enabled = 'all';
|
||||
$ae_app.posts.limit = 500;
|
||||
$idaa_loc.bb.hidden = 'all';
|
||||
$idaa_loc.bb.enabled = 'all';
|
||||
$idaa_loc.bb.limit = 500;
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
}}
|
||||
class="ae_btn btn_xs ae_smallest btn btn-xs btn-warning"
|
||||
@@ -399,7 +398,7 @@ function handle_post_obj_deleted(event) {
|
||||
{:else}
|
||||
<button
|
||||
on:click={() => {
|
||||
$ae_app.posts.enabled = 'enabled';
|
||||
$idaa_loc.bb.enabled = 'enabled';
|
||||
$slct_trigger = 'load__post_obj_li';
|
||||
}}
|
||||
class="ae_btn btn_xs ae_smallest btn btn-xs btn-warning"
|
||||
@@ -419,10 +418,10 @@ function handle_post_obj_deleted(event) {
|
||||
url.searchParams.delete('post_id');
|
||||
history.pushState({}, '', url);
|
||||
|
||||
$ae_app.posts.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = true;
|
||||
$ae_app.posts.show_view__post_id = false;
|
||||
$idaa_loc.bb.show_main__options = true;
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
$idaa_loc.bb.show_edit__post_id = true;
|
||||
$idaa_loc.bb.show_view__post_id = false;
|
||||
}}
|
||||
class="btn_new_bb_post btn btn-secondary"
|
||||
>
|
||||
@@ -432,7 +431,7 @@ function handle_post_obj_deleted(event) {
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
{#if $ae_app.posts.show_list__post_obj_li}
|
||||
{#if $idaa_loc.bb.show_list__post_obj_li}
|
||||
<section class="bb_post_list">
|
||||
{#if $slct.post_obj_li}
|
||||
<!-- <ul> -->
|
||||
@@ -468,10 +467,10 @@ function handle_post_obj_deleted(event) {
|
||||
let message = {'post_id': idaa_post_obj.post_id_random};
|
||||
window.parent.postMessage(message, "*");
|
||||
|
||||
$ae_app.posts.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
// $ae_app.posts.show_edit__post_id = false;
|
||||
$ae_app.posts.show_view__post_id = true;
|
||||
$idaa_loc.bb.show_main__options = true;
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
// $idaa_loc.bb.show_edit__post_id = false;
|
||||
$idaa_loc.bb.show_view__post_id = true;
|
||||
}}
|
||||
class="btn btn-primary"
|
||||
title={`View: ${idaa_post_obj.title}`}
|
||||
@@ -485,17 +484,17 @@ function handle_post_obj_deleted(event) {
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
{#if $ae_app.trusted_access || idaa_post_obj.external_person_id === $ae_app.novi_uuid || idaa_post_obj.email === $ae_app.novi_email}
|
||||
{#if $ae_loc.trusted_access || idaa_post_obj.external_person_id === $idaa_loc.novi_uuid || idaa_post_obj.email === $idaa_loc.novi_email}
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.post_id = idaa_post_obj.post_id_random;
|
||||
$slct.post_obj = idaa_post_obj;
|
||||
$slct_trigger = 'load__post_obj';
|
||||
|
||||
$ae_app.posts.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = true;
|
||||
// $ae_app.posts.show_view__post_id = false;
|
||||
$idaa_loc.bb.show_main__options = true;
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
$idaa_loc.bb.show_edit__post_id = true;
|
||||
// $idaa_loc.bb.show_view__post_id = false;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-secondary"
|
||||
title={`Edit post: ${idaa_post_obj.title}`}
|
||||
@@ -509,7 +508,7 @@ function handle_post_obj_deleted(event) {
|
||||
$slct.post_id = idaa_post_obj.post_id_random;
|
||||
$slct.post_obj = idaa_post_obj;
|
||||
|
||||
$ae_app.posts.show_post_comment_crud = true;
|
||||
$idaa_loc.bb.show_post_comment_crud = true;
|
||||
}}
|
||||
class="ae_btn btn_md btn_outline_warning"
|
||||
title={`New comment on: ${idaa_post_obj.title}`}
|
||||
@@ -527,7 +526,7 @@ function handle_post_obj_deleted(event) {
|
||||
{:else if (idaa_post_obj.full_name)}
|
||||
<div class="post__posted_by">
|
||||
Posted by: <span class="fas fa-user"></span> <span class="post__full_name">{idaa_post_obj.full_name}
|
||||
{#if $ae_app.trusted_access && idaa_post_obj.email}
|
||||
{#if $ae_loc.trusted_access && idaa_post_obj.email}
|
||||
(<a href="mailto:{idaa_post_obj.email}?subject=IDAA BB Post">{idaa_post_obj.email}</a>)
|
||||
{/if}
|
||||
</div>
|
||||
@@ -568,16 +567,16 @@ function handle_post_obj_deleted(event) {
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $ae_app.posts.show_edit__post_id}
|
||||
{#if $idaa_loc.bb.show_edit__post_id}
|
||||
<Element_modal_v3
|
||||
show = { true }
|
||||
modal_cover_body = { false }
|
||||
report_client_dimensions = { true }
|
||||
on:close={ () => {
|
||||
$ae_app.posts.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
$ae_app.posts.show_edit__post_id = false;
|
||||
// $ae_app.posts.show_view__post_id = false;
|
||||
$idaa_loc.bb.show_main__options = true;
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
$idaa_loc.bb.show_edit__post_id = false;
|
||||
// $idaa_loc.bb.show_view__post_id = false;
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('post_id');
|
||||
@@ -604,7 +603,7 @@ function handle_post_obj_deleted(event) {
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $ae_app.posts.show_view__post_id && $slct.post_obj}
|
||||
{#if $idaa_loc.bb.show_view__post_id && $slct.post_obj}
|
||||
<Element_modal_v3
|
||||
show = { true }
|
||||
modal_cover_body = { false }
|
||||
@@ -614,11 +613,11 @@ function handle_post_obj_deleted(event) {
|
||||
$slct.post_comment_obj = {}; // NOTE: Reset in case the post comment was being edited.
|
||||
$slct.post_comment_obj_li = [];
|
||||
|
||||
$ae_app.posts.show_main__options = true;
|
||||
$ae_app.posts.show_list__post_obj_li = true;
|
||||
// $ae_app.posts.show_edit__post_id = false;
|
||||
$ae_app.posts.show_view__post_id = false;
|
||||
$ae_app.posts.show_edit__post_comment = false;
|
||||
$idaa_loc.bb.show_main__options = true;
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
// $idaa_loc.bb.show_edit__post_id = false;
|
||||
$idaa_loc.bb.show_view__post_id = false;
|
||||
$idaa_loc.bb.show_edit__post_comment = false;
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('post_id');
|
||||
|
||||
@@ -24,9 +24,9 @@ if ($slct.post_comment_id) {
|
||||
title: null,
|
||||
content: null,
|
||||
anonymous: false,
|
||||
external_person_id: $ae_app.novi_uuid,
|
||||
full_name: $ae_app.novi_full_name,
|
||||
email: $ae_app.novi_email,
|
||||
external_person_id: $idaa_loc.novi_uuid,
|
||||
full_name: $idaa_loc.novi_full_name,
|
||||
email: $idaa_loc.novi_email,
|
||||
|
||||
sort: null,
|
||||
// notes: null,
|
||||
@@ -302,13 +302,13 @@ async function handle_delete_post_comment_obj({post_comment_id, method='disable'
|
||||
</fieldset>
|
||||
|
||||
<label for="external_person_id"><span class="fas fa-link"></span> Linked with Novi ID
|
||||
{#if !$ae_app.trusted_access}
|
||||
{#if !$ae_loc.trusted_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
<input
|
||||
type="text"
|
||||
id="external_person_id"
|
||||
name="external_person_id"
|
||||
value={($slct.post_comment_obj.external_person_id ? $slct.post_comment_obj.external_person_id : $ae_app.novi_uuid)}
|
||||
value={($slct.post_comment_obj.external_person_id ? $slct.post_comment_obj.external_person_id : $idaa_loc.novi_uuid)}
|
||||
readonly={true}
|
||||
class="ae_width_lg"
|
||||
>
|
||||
@@ -327,7 +327,7 @@ async function handle_delete_post_comment_obj({post_comment_id, method='disable'
|
||||
</label>
|
||||
|
||||
<label for="full_name">Your name
|
||||
{#if !$ae_app.trusted_access}
|
||||
{#if !$ae_loc.trusted_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
{:else}
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
@@ -336,13 +336,13 @@ async function handle_delete_post_comment_obj({post_comment_id, method='disable'
|
||||
type="text"
|
||||
id="full_name"
|
||||
name="full_name"
|
||||
value={($slct.post_comment_obj.full_name ? $slct.post_comment_obj.full_name : $ae_app.novi_full_name)}
|
||||
value={($slct.post_comment_obj.full_name ? $slct.post_comment_obj.full_name : $idaa_loc.novi_full_name)}
|
||||
>
|
||||
</label>
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
{#if $ae_loc.trusted_access}
|
||||
<label for="email">Your email
|
||||
{#if !$ae_app.trusted_access}
|
||||
{#if !$ae_loc.trusted_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
{:else}
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
@@ -350,15 +350,15 @@ async function handle_delete_post_comment_obj({post_comment_id, method='disable'
|
||||
<input
|
||||
type="text"
|
||||
name="email"
|
||||
value={($slct.post_comment_obj.email ? $slct.post_comment_obj.email : $ae_app.novi_email)}
|
||||
readonly={!$ae_app.trusted_access}
|
||||
value={($slct.post_comment_obj.email ? $slct.post_comment_obj.email : $idaa_loc.novi_email)}
|
||||
readonly={!$ae_loc.trusted_access}
|
||||
>
|
||||
<span class="ae_highlight">Secondary link using the Novi email address</span>
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
{#if $ae_loc.trusted_access}
|
||||
<section class="ae_section post_comment__admin_options"> <!-- BEGIN: section post_comment__admin_options -->
|
||||
|
||||
<h3>
|
||||
@@ -389,7 +389,7 @@ async function handle_delete_post_comment_obj({post_comment_id, method='disable'
|
||||
|
||||
<!-- <label>Group <input type="text" name="group" value={$slct.post_comment_obj.group} max="100" /></label> -->
|
||||
|
||||
{#if $ae_app.administrator_access}
|
||||
{#if $ae_loc.administrator_access}
|
||||
<label>Enable
|
||||
<input
|
||||
type="checkbox"
|
||||
@@ -400,7 +400,7 @@ async function handle_delete_post_comment_obj({post_comment_id, method='disable'
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
<!-- {#if $ae_app.trusted_access}
|
||||
<!-- {#if $ae_loc.trusted_access}
|
||||
<label>Internal Staff Notes
|
||||
<textarea id="notes" name="notes" class="ae_value post__notes tinymce_editor editor_basic_200" rows="2" cols="70" value={$slct.post_comment_obj.notes}></textarea>
|
||||
</label>
|
||||
@@ -416,7 +416,7 @@ async function handle_delete_post_comment_obj({post_comment_id, method='disable'
|
||||
<button type="submit" class="ae_btn btn btn-primary"><span class="fas fa-check"></span> Save Post Comment</button>
|
||||
|
||||
{#if $slct.post_comment_id}
|
||||
{#if $ae_app.administrator_access}
|
||||
{#if $ae_loc.administrator_access}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to delete this post comment?')) {return false;}
|
||||
@@ -430,7 +430,7 @@ async function handle_delete_post_comment_obj({post_comment_id, method='disable'
|
||||
>
|
||||
<span class="fas fa-minus"></span> Delete
|
||||
</button>
|
||||
{:else if $ae_app.trusted_access}
|
||||
{:else if $ae_loc.trusted_access}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to disable this post comment?')) {return false;}
|
||||
|
||||
@@ -23,13 +23,13 @@ if ($slct.post_id) {
|
||||
|
||||
if ($slct.post_obj) {
|
||||
// if (!$slct.post_obj.external_person_id) {
|
||||
// $slct.post_obj['external_person_id'] = $ae_app.novi_uuid;
|
||||
// $slct.post_obj['external_person_id'] = $idaa_loc.novi_uuid;
|
||||
// }
|
||||
// if (!$slct.post_obj.full_name) {
|
||||
// $slct.post_obj['full_name'] = $ae_app.novi_full_name;
|
||||
// $slct.post_obj['full_name'] = $idaa_loc.novi_full_name;
|
||||
// }
|
||||
// if (!$slct.post_obj.email) {
|
||||
// $slct.post_obj['email'] = $ae_app.novi_email;
|
||||
// $slct.post_obj['email'] = $idaa_loc.novi_email;
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
@@ -39,9 +39,9 @@ if ($slct.post_id) {
|
||||
content: '',
|
||||
topic_id: null,
|
||||
anonymous: false,
|
||||
external_person_id: $ae_app.novi_uuid,
|
||||
full_name: $ae_app.novi_full_name,
|
||||
email: $ae_app.novi_email,
|
||||
external_person_id: $idaa_loc.novi_uuid,
|
||||
full_name: $idaa_loc.novi_full_name,
|
||||
email: $idaa_loc.novi_email,
|
||||
|
||||
sort: null,
|
||||
notes: null,
|
||||
@@ -367,7 +367,7 @@ async function handle_delete_post_obj({post_id, method='disable'}) {
|
||||
<option value={18}>Contacts/ sponsorship in my area</option>
|
||||
<option value={19}>Professional positions</option>
|
||||
<option value={21}
|
||||
disabled={!$ae_app.trusted_access}
|
||||
disabled={!$ae_loc.trusted_access}
|
||||
>
|
||||
Announcement
|
||||
</option>
|
||||
@@ -402,13 +402,13 @@ async function handle_delete_post_obj({post_id, method='disable'}) {
|
||||
</fieldset>
|
||||
|
||||
<label for="external_person_id"><span class="fas fa-link"></span> Linked with Novi ID
|
||||
{#if !$ae_app.trusted_access}
|
||||
{#if !$ae_loc.trusted_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
<input
|
||||
type="text"
|
||||
id="external_person_id"
|
||||
name="external_person_id"
|
||||
value={($slct.post_obj.external_person_id ? $slct.post_obj.external_person_id : $ae_app.novi_uuid)}
|
||||
value={($slct.post_obj.external_person_id ? $slct.post_obj.external_person_id : $idaa_loc.novi_uuid)}
|
||||
readonly={true}
|
||||
class="ae_width_lg"
|
||||
>
|
||||
@@ -427,7 +427,7 @@ async function handle_delete_post_obj({post_id, method='disable'}) {
|
||||
</label>
|
||||
|
||||
<label for="full_name">Name
|
||||
{#if !$ae_app.trusted_access}
|
||||
{#if !$ae_loc.trusted_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
{:else}
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
@@ -436,14 +436,14 @@ async function handle_delete_post_obj({post_id, method='disable'}) {
|
||||
type="text"
|
||||
id="full_name"
|
||||
name="full_name"
|
||||
value={($slct.post_obj.full_name ? $slct.post_obj.full_name : $ae_app.novi_full_name)}
|
||||
readonly={!$ae_app.trusted_access}
|
||||
value={($slct.post_obj.full_name ? $slct.post_obj.full_name : $idaa_loc.novi_full_name)}
|
||||
readonly={!$ae_loc.trusted_access}
|
||||
>
|
||||
</label>
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
{#if $ae_loc.trusted_access}
|
||||
<label for="email">Email
|
||||
{#if !$ae_app.trusted_access}
|
||||
{#if !$ae_loc.trusted_access}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
{:else}
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
@@ -451,8 +451,8 @@ async function handle_delete_post_obj({post_id, method='disable'}) {
|
||||
<input
|
||||
type="text"
|
||||
name="email"
|
||||
value={($slct.post_obj.email ? $slct.post_obj.email : $ae_app.novi_email)}
|
||||
readonly={!$ae_app.trusted_access}
|
||||
value={($slct.post_obj.email ? $slct.post_obj.email : $idaa_loc.novi_email)}
|
||||
readonly={!$ae_loc.trusted_access}
|
||||
>
|
||||
<span class="ae_highlight">Secondary link using the Novi email address</span>
|
||||
</label>
|
||||
@@ -485,7 +485,7 @@ async function handle_delete_post_obj({post_id, method='disable'}) {
|
||||
</fieldset> -->
|
||||
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
{#if $ae_loc.trusted_access}
|
||||
<section class="ae_section post__admin_options"> <!-- BEGIN: section post__admin_options -->
|
||||
|
||||
<h3>
|
||||
@@ -516,7 +516,7 @@ async function handle_delete_post_obj({post_id, method='disable'}) {
|
||||
|
||||
<label>Group <input type="text" name="group" value={$slct.post_obj.group ? $slct.post_obj.group : ''} max="100" /></label>
|
||||
|
||||
{#if $ae_app.administrator_access}
|
||||
{#if $ae_loc.administrator_access}
|
||||
<label>Enable
|
||||
<input
|
||||
type="checkbox"
|
||||
@@ -527,7 +527,7 @@ async function handle_delete_post_obj({post_id, method='disable'}) {
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
{#if $ae_app.trusted_access}
|
||||
{#if $ae_loc.trusted_access}
|
||||
<label>Internal Staff Notes
|
||||
<textarea id="notes" name="notes" class="ae_value post__notes" rows="2" cols="70" value={$slct.post_obj.notes}></textarea>
|
||||
</label>
|
||||
@@ -543,7 +543,7 @@ async function handle_delete_post_obj({post_id, method='disable'}) {
|
||||
<button type="submit" class="ae_btn btn btn-primary"><span class="fas fa-check"></span> Save Post</button>
|
||||
|
||||
{#if $slct.post_id}
|
||||
{#if $ae_app.administrator_access}
|
||||
{#if $ae_loc.administrator_access}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to delete this post?')) {return false;}
|
||||
@@ -557,7 +557,7 @@ async function handle_delete_post_obj({post_id, method='disable'}) {
|
||||
>
|
||||
<span class="fas fa-minus"></span> Delete
|
||||
</button>
|
||||
{:else if $ae_app.trusted_access}
|
||||
{:else if $ae_loc.trusted_access}
|
||||
<button
|
||||
on:click={() => {
|
||||
if (!confirm('Are you sure you want to disable this post?')) {return false;}
|
||||
|
||||
@@ -7,13 +7,16 @@ import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||
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, idaa_trigger } from '$lib/ae_idaa_stores';
|
||||
|
||||
export let lq__post_obj: any;
|
||||
export let lq__post_comment_obj_li: any;
|
||||
|
||||
// import Edit_post_comment_obj from './10_edit__post_comment_obj.svelte';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
if ($idaa_slct.post_id) {
|
||||
console.log(`Post ID selected: ${$idaa_slct.post_id}`);
|
||||
console.log(`Post Object selected: ${$idaa_slct.post_obj}`)
|
||||
console.log(`Post Object selected: ${$lq__post_obj}`);
|
||||
|
||||
$idaa_trigger = 'load__post_obj';
|
||||
}
|
||||
@@ -33,10 +36,10 @@ function handle_post_comment_obj_created(event) {
|
||||
$idaa_trigger = 'load__post_obj';
|
||||
$idaa_trigger = 'load__post_comment_obj_li';
|
||||
|
||||
// $idaa_loc.posts.show_post_list = false;
|
||||
// $idaa_loc.posts.show_edit__post_id = false;
|
||||
// $idaa_loc.posts.show_view__post_id = true;
|
||||
$idaa_loc.posts.show_edit__post_comment = false;
|
||||
// $idaa_sess.bb.show_post_list = false;
|
||||
// $idaa_sess.bb.show_edit__post_id = false;
|
||||
// $idaa_sess.bb.show_view__post_id = true;
|
||||
$idaa_sess.bb.show_edit__post_comment = false;
|
||||
}
|
||||
function handle_post_comment_obj_updated(event) {
|
||||
console.log('*** handle_post_comment_obj_updated() ***');
|
||||
@@ -45,10 +48,10 @@ function handle_post_comment_obj_updated(event) {
|
||||
$idaa_trigger = 'load__post_obj';
|
||||
$idaa_trigger = 'load__post_comment_obj_li';
|
||||
|
||||
// $idaa_loc.posts.show_post_list = false;
|
||||
// $idaa_loc.posts.show_edit__post_id = false;
|
||||
// $idaa_loc.posts.show_view__post_id = true;
|
||||
$idaa_loc.posts.show_edit__post_comment = false;
|
||||
// $idaa_sess.bb.show_post_list = false;
|
||||
// $idaa_sess.bb.show_edit__post_id = false;
|
||||
// $idaa_sess.bb.show_view__post_id = true;
|
||||
$idaa_sess.bb.show_edit__post_comment = false;
|
||||
}
|
||||
function handle_post_comment_obj_deleted(event) {
|
||||
console.log('*** handle_post_comment_obj_deleted() ***');
|
||||
@@ -58,29 +61,33 @@ function handle_post_comment_obj_deleted(event) {
|
||||
$idaa_trigger = 'load__post_obj';
|
||||
$idaa_trigger = 'load__post_comment_obj_li';
|
||||
|
||||
// $idaa_loc.posts.show_post_list = false;
|
||||
// $idaa_loc.posts.show_edit__post_id = false;
|
||||
// $idaa_loc.posts.show_view__post_id = true;
|
||||
$idaa_loc.posts.show_edit__post_comment = false;
|
||||
// $idaa_sess.bb.show_post_list = false;
|
||||
// $idaa_sess.bb.show_edit__post_id = false;
|
||||
// $idaa_sess.bb.show_view__post_id = true;
|
||||
$idaa_sess.bb.show_edit__post_comment = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section
|
||||
bind:clientHeight={$ae_loc.iframe_height_modal_body}
|
||||
class="svelte_component ae_section ae_view post_obj view__post_obj"
|
||||
class="svelte_component ae_section ae_view post_obj view__post_obj space-y-2"
|
||||
>
|
||||
|
||||
<div class="post__header">
|
||||
<h2 class="post__title">
|
||||
{@html $idaa_slct.post_obj.title}
|
||||
{#if $idaa_slct.post_obj.topic_id}<span class="badge badge-info bg-info"><span class="fas fa-user-md"></span> {$idaa_slct.post_obj.topic_name}</span>{/if}
|
||||
<span class="h3">
|
||||
{@html $lq__post_obj?.title}
|
||||
</span>
|
||||
{#if $lq__post_obj?.topic_id}<span class="badge badge-info bg-info"><span class="fas fa-user-md"></span> {$lq__post_obj?.topic_name}</span>{/if}
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div class="post__content">{@html $idaa_slct.post_obj.content}</div>
|
||||
<div class="post__content">
|
||||
<pre class="post__content p-2 bg-white shadow-md rounded-lg text-wrap text-sm font-normal whitespace-pre-wrap">{@html $idaa_slct.post_obj.content}</pre>
|
||||
</div>
|
||||
|
||||
<section class="ae_section ae_meta post__meta">
|
||||
<section class="ae_section ae_meta post__meta text-sm text-gray-500 mt-4 flex flex-row gap-2 items-center justify-center">
|
||||
<div class="ae_group">
|
||||
{#if ($idaa_slct.post_obj.anonymous)}
|
||||
<div class="post__posted_by">
|
||||
@@ -119,9 +126,11 @@ function handle_post_comment_obj_deleted(event) {
|
||||
{/if}
|
||||
<button
|
||||
on:click={() => {
|
||||
$idaa_loc.posts.show_edit__post_comment = true;
|
||||
if (confirm('Are you sure you want to add a new comment?')) {
|
||||
$idaa_sess.bb.show_edit__post_comment = true;
|
||||
}
|
||||
}}
|
||||
class="btn btn-primary"
|
||||
class="btn btn-md variant-ghost-secondary hover:variant-filled-secondary transition"
|
||||
title={`New comment on: ${$idaa_slct.post_obj.title}`}
|
||||
>
|
||||
<span class="fas fa-plus m-1"></span> New Comment
|
||||
@@ -137,13 +146,13 @@ function handle_post_comment_obj_deleted(event) {
|
||||
// url.searchParams.set('post_id', $idaa_slct.post_obj.post_id_random);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// $idaa_loc.posts.show_main__options = false;
|
||||
// $idaa_loc.posts.show_list__post_li = false;
|
||||
$idaa_loc.posts.show_view__post_id = false;
|
||||
$idaa_loc.posts.show_edit__post_id = true;
|
||||
// $idaa_sess.bb.show_main__options = false;
|
||||
// $idaa_sess.bb.show_list__post_li = false;
|
||||
$idaa_sess.bb.show_view__post_id = false;
|
||||
$idaa_sess.bb.show_edit__post_id = true;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-xs btn-secondary"
|
||||
title={`Edit post: ${$idaa_slct.post_obj.name}`}
|
||||
class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition"
|
||||
title="Edit post for {$idaa_slct.post_obj.full_name} (ID: {$idaa_slct.post_obj.post_id}"
|
||||
>
|
||||
<span class="fas fa-edit m-1"></span> Edit
|
||||
</button>
|
||||
@@ -153,7 +162,7 @@ function handle_post_comment_obj_deleted(event) {
|
||||
|
||||
|
||||
|
||||
{#if $idaa_loc.posts.show_edit__post_comment}
|
||||
{#if $idaa_sess.bb.show_edit__post_comment}
|
||||
<section class="bb_post_comment_crud">
|
||||
|
||||
<Element_modal_v3
|
||||
@@ -163,10 +172,10 @@ function handle_post_comment_obj_deleted(event) {
|
||||
$idaa_slct.post_comment_id = null;
|
||||
$idaa_slct.post_comment_obj = {};
|
||||
|
||||
// $idaa_loc.posts.show_post_list = true;
|
||||
// $idaa_loc.posts.show_edit__post_id = false;
|
||||
// $idaa_loc.posts.show_view__post_id = false;
|
||||
$idaa_loc.posts.show_edit__post_comment = false;
|
||||
// $idaa_sess.bb.show_post_list = true;
|
||||
// $idaa_sess.bb.show_edit__post_id = false;
|
||||
// $idaa_sess.bb.show_view__post_id = false;
|
||||
$idaa_sess.bb.show_edit__post_comment = false;
|
||||
}}
|
||||
>
|
||||
<span slot="header_title">Comment on: {($idaa_slct.post_obj.title ? $idaa_slct.post_obj.title : '')}</span>
|
||||
@@ -180,13 +189,15 @@ function handle_post_comment_obj_deleted(event) {
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
{#if $idaa_slct.post_comment_obj_li.length}
|
||||
{#each $idaa_slct.post_comment_obj_li as idaa_post_comment_obj, index}
|
||||
{#if $lq__post_comment_obj_li?.length}
|
||||
{#each $lq__post_comment_obj_li as idaa_post_comment_obj, index}
|
||||
<hr />
|
||||
<div class="post_comment__content">{@html idaa_post_comment_obj.content}</div>
|
||||
<div class="post_comment__content">
|
||||
<pre class="post_comment__content p-2 bg-white shadow-md rounded-lg text-wrap text-sm font-normal whitespace-pre-wrap">{@html idaa_post_comment_obj.content}</pre>
|
||||
</div>
|
||||
|
||||
|
||||
<section class="ae_section ae_meta post_comment__meta">
|
||||
<section class="ae_section ae_meta post_comment__meta text-sm text-gray-500 mt-4 flex flex-row gap-2 items-center justify-center">
|
||||
<div class="ae_group">
|
||||
<span class="post_comment__posted_by `comment_by_container">
|
||||
<span class="comment_by_lable">Comment by:</span>
|
||||
@@ -210,17 +221,18 @@ function handle_post_comment_obj_deleted(event) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if $ae_loc.trusted_access || idaa_post_comment_obj.external_person_id === $ae_app.novi_uuid}
|
||||
{#if $ae_loc.trusted_access || idaa_post_comment_obj.external_person_id === $idaa_loc.novi_uuid}
|
||||
<div class="ae_options">
|
||||
<button on:click={() => {
|
||||
$idaa_slct.post_comment_id = idaa_post_comment_obj.post_comment_id_random;
|
||||
$idaa_slct.post_comment_obj = idaa_post_comment_obj;
|
||||
|
||||
// $idaa_loc.posts.show_post_comment_list = false;
|
||||
$idaa_loc.posts.show_edit__post_comment = true;
|
||||
// $idaa_loc.posts.show_view__post_id = false;
|
||||
// $idaa_sess.bb.show_post_comment_list = false;
|
||||
$idaa_sess.bb.show_edit__post_comment = true;
|
||||
// $idaa_sess.bb.show_view__post_id = false;
|
||||
}}
|
||||
class="ae_btn ae_smallest btn btn-secondary"
|
||||
class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition"
|
||||
title="Edit comment by {idaa_post_comment_obj?.full_name} (for post ID {$lq__post_obj?.id})"
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit Comment
|
||||
</button>
|
||||
|
||||
@@ -10,102 +10,86 @@ import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
|
||||
|
||||
export let lq__post_obj_li: any;
|
||||
|
||||
export let container_class_li = [];
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** List - Bulletin Board (Post) Obj');
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<!-- {#if $idaa_loc?.bb?.show_list__post_obj_li} -->
|
||||
<section class="bb_post_list">
|
||||
{#if $lq__post_obj_li}
|
||||
<!-- <ul> -->
|
||||
{#if $lq__post_obj_li && $lq__post_obj_li.length}
|
||||
|
||||
{#each $lq__post_obj_li as idaa_post_obj, index}
|
||||
<div
|
||||
id={`idaa_bb_post_id__${idaa_post_obj.post_id_random}`}
|
||||
class="container bb_post post_obj border border-1 rounded p-2 mb-2"
|
||||
class:post__hide={idaa_post_obj.hide}
|
||||
class:post__priority={idaa_post_obj.priority}
|
||||
class:post__group={idaa_post_obj.group}
|
||||
class="container bb_post post_obj border border-1 rounded p-2 mb-2 space-y-2"
|
||||
class:dim={idaa_post_obj.hide}
|
||||
class:bg-warning-100={!idaa_post_obj?.enable}
|
||||
>
|
||||
<header class="ae_header post__header">
|
||||
<h3 class="post__title">
|
||||
{@html idaa_post_obj.title}
|
||||
{#if idaa_post_obj.topic_id}<span class="badge badge-info bg-info"><span class="fas fa-user-md m-1"></span> {idaa_post_obj.topic_name}</span>{/if}
|
||||
|
||||
<header class="ae_header">
|
||||
<h3 class="post__title flex flex-row gap-2 items-center">
|
||||
<span class="post__title h3">{@html idaa_post_obj.title}</span>
|
||||
{#if idaa_post_obj.topic_name}<span class="badge badge-info variant-glass-secondary"><span class="fas fa-user-md m-1"></span> {idaa_post_obj.topic_name}</span>{/if}
|
||||
</h3>
|
||||
</header>
|
||||
|
||||
{#if idaa_post_obj.content}<div class="post__content">{@html idaa_post_obj.content}</div>{/if}
|
||||
{#if idaa_post_obj.content}<pre class="post__content p-2 bg-white shadow-md rounded-lg text-wrap text-sm font-normal whitespace-pre-wrap">{@html idaa_post_obj.content}</pre>{/if}
|
||||
|
||||
<div class="ae_options post_obj__options">
|
||||
<div class="ae_options flex flex-row gap-2 items-center justify-center">
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.post_id = idaa_post_obj.post_id_random;
|
||||
$slct.post_obj = idaa_post_obj;
|
||||
$idaa_slct.post_id = idaa_post_obj?.post_id;
|
||||
$idaa_slct.post_obj = idaa_post_obj;
|
||||
|
||||
// handle_load_post_comment_obj_li({post_id: $slct.post_id, try_cache: false});
|
||||
// handle_load_post_comment_obj_li({post_id: $idaa_slct.post_id, try_cache: false});
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.set('post_id', idaa_post_obj.post_id_random);
|
||||
url.searchParams.set('post_id', idaa_post_obj?.post_id);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {'post_id': idaa_post_obj.post_id_random};
|
||||
let message = {'post_id': idaa_post_obj?.post_id};
|
||||
window.parent.postMessage(message, "*");
|
||||
|
||||
$idaa_loc.bb.show_main__options = true;
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
// $idaa_loc.bb.show_edit__post_id = false;
|
||||
$idaa_loc.bb.show_view__post_id = true;
|
||||
// $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_edit = false;
|
||||
$idaa_sess.bb.show__modal_view = true;
|
||||
}}
|
||||
class="btn btn-md variant-ghost-primary hover:variant-filled-primary transition"
|
||||
title={`View: ${idaa_post_obj.title}`}
|
||||
title={`View: ${idaa_post_obj?.title}`}
|
||||
>
|
||||
<span class="fas fa-envelope-open m-1"></span> Open
|
||||
|
||||
{#if idaa_post_obj.post_comment_count}
|
||||
{#if idaa_post_obj?.post_comment_count}
|
||||
<span class="ae_badge ae_info post__post_comment_count">
|
||||
<span class="fas fa-comment"></span> {(idaa_post_obj.post_comment_count == 1 ? `${idaa_post_obj.post_comment_count} comment` : `${idaa_post_obj.post_comment_count} comments` )}
|
||||
<span class="fas fa-comment"></span> {(idaa_post_obj?.post_comment_count == 1 ? `${idaa_post_obj?.post_comment_count} comment` : `${idaa_post_obj?.post_comment_count} comments` )}
|
||||
</span>
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
{#if $ae_loc.trusted_access || idaa_post_obj.external_person_id === $idaa_loc.novi_uuid || idaa_post_obj.email === $idaa_loc.novi_email}
|
||||
<button
|
||||
on:click={() => {
|
||||
$slct.post_id = idaa_post_obj.post_id_random;
|
||||
$slct.post_obj = idaa_post_obj;
|
||||
$slct_trigger = 'load__post_obj';
|
||||
{#if $ae_loc.trusted_access || idaa_post_obj.external_person_id === $idaa_loc.novi_uuid}
|
||||
<button
|
||||
on:click={() => {
|
||||
$idaa_slct.post_id = idaa_post_obj.post_id;
|
||||
$idaa_slct.post_obj = idaa_post_obj;
|
||||
// $slct_trigger = 'load__post_obj';
|
||||
|
||||
$idaa_loc.bb.show_main__options = true;
|
||||
$idaa_loc.bb.show_list__post_obj_li = true;
|
||||
$idaa_loc.bb.show_edit__post_id = true;
|
||||
// $idaa_loc.bb.show_view__post_id = false;
|
||||
}}
|
||||
class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition"
|
||||
title={`Edit post: ${idaa_post_obj.title}`}
|
||||
>
|
||||
<span class="fas fa-edit m-1"></span> Edit Post
|
||||
</button>
|
||||
// $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_edit = true;
|
||||
$idaa_sess.bb.show__modal_view = false;
|
||||
}}
|
||||
class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition"
|
||||
title={`Edit post: ${idaa_post_obj.title}`}
|
||||
>
|
||||
<span class="fas fa-edit m-1"></span> Edit Post
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<!-- <button
|
||||
on:click={() => {
|
||||
$slct.post_id = idaa_post_obj.post_id_random;
|
||||
$slct.post_obj = idaa_post_obj;
|
||||
|
||||
$idaa_loc.bb.show_post_comment_crud = true;
|
||||
}}
|
||||
class="ae_btn btn_md btn_outline_warning"
|
||||
title={`New comment on: ${idaa_post_obj.title}`}
|
||||
>
|
||||
<span class="fas fa-plus"></span> New Comment
|
||||
</button> -->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="ae_section ae_footer ae_meta post__meta">
|
||||
<div class="ae_section ae_footer ae_meta post__meta text-sm text-gray-500 mt-4 flex flex-row gap-2 items-center justify-center">
|
||||
{#if (idaa_post_obj.anonymous)}
|
||||
<div class="post__posted_by">
|
||||
Posted by: <span class="fas fa-user-secret"></span> <span class="post__full_name">Anonymous</span>
|
||||
|
||||
Reference in New Issue
Block a user