More quick updates and clean up
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
|
||||
<title>New SvelteKit Structure - OSIT's Æ Dev</title>
|
||||
<title>OSIT's Æ - Dev SvelteKit Structure</title>
|
||||
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
|
||||
@@ -43,6 +43,7 @@ export let ae_app_local_data_struct: key_val = {
|
||||
|
||||
'account_id': ae_account_id, // OSIT Demo _XY7DXtc9MY
|
||||
'site_domain': null, // https://example.com, https://dev.example.com, etc.
|
||||
'site_cfg_json': {},
|
||||
|
||||
'page_access_code_li': {'administrator': '11500', 'trusted': '19111', 'authenticated': '00000'},
|
||||
'administrator_passcode': '11500',
|
||||
|
||||
@@ -63,7 +63,7 @@ export async function load({ params, url }) { // params, route, url
|
||||
|
||||
.then(function (site_domain_results) {
|
||||
if (site_domain_results) {
|
||||
// console.log(`ae_ site_domain_results = `, site_domain_results);
|
||||
console.log(`ae_ site_domain_results = `, site_domain_results);
|
||||
|
||||
let ae_api_tmp = get(ae_api);
|
||||
|
||||
@@ -77,9 +77,10 @@ export async function load({ params, url }) { // params, route, url
|
||||
ae_loc_tmp['account_id'] = site_domain_results.account_id_random;
|
||||
ae_loc_tmp['site_id'] = site_domain_results.site_id_random;
|
||||
ae_loc_tmp['site_domain_id'] = site_domain_results.site_domain_id_random;
|
||||
ae_loc_tmp['enable'] = site_domain_results.enable;
|
||||
ae_loc_tmp['style_href'] = site_domain_results.style_href;
|
||||
ae_loc_tmp['google_tracking_id'] = site_domain_results.google_tracking_id;
|
||||
ae_loc_tmp['site_enable'] = site_domain_results.enable;
|
||||
ae_loc_tmp['site_style_href'] = site_domain_results.style_href;
|
||||
ae_loc_tmp['site_google_tracking_id'] = site_domain_results.google_tracking_id;
|
||||
ae_loc_tmp['site_cfg_json'] = site_domain_results.cfg_json;
|
||||
|
||||
// Get updated the data just in case.
|
||||
// ae_loc_tmp = get(ae_loc);
|
||||
|
||||
@@ -80,6 +80,19 @@ onMount(() => {
|
||||
<span class="fas fa-sync mx-1"></span>
|
||||
Reload and Clear Cache
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-sm variant-soft"
|
||||
title="Clear the browser storage for this page"
|
||||
on:click={() => {
|
||||
// $ae_loc.
|
||||
localStorage.clear();
|
||||
sessionStorage.clear();
|
||||
alert('Local and Session Storage cleared. You will probably want to refresh the page.');
|
||||
}}
|
||||
>
|
||||
<span class="fas fa-sync mx-1"></span>
|
||||
Clear Storage
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
@@ -5,12 +5,22 @@ import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import { get } from 'svelte/store';
|
||||
|
||||
|
||||
export async function load({ params, url }) { // route
|
||||
export async function load({ params, parent, url }) { // route
|
||||
// console.log(`Svelte Event Speakers layout.ts data = params:`, params);
|
||||
// console.log(`Svelte Event Speakers layout.ts data = route:`, route);
|
||||
// console.log(`Svelte Event Speakers layout.ts data = url:`, url);
|
||||
|
||||
let data = await parent();
|
||||
console.log(`Svelte Events Speakers layout.ts data = data:`, data);
|
||||
|
||||
data.ae_events_speakers_layout_ts = true;
|
||||
|
||||
|
||||
let event_id = url.searchParams.get('event_id');
|
||||
if (!event_id) {
|
||||
// event_id = $ae_loc.site_cfg_json.slct__event_id;
|
||||
event_id = data.ae_loc.site_cfg_json.slct__event_id;
|
||||
}
|
||||
|
||||
await handle_load_ae_obj_id__event({event_id: event_id, try_cache: false})
|
||||
.then(function (event_obj_results) {
|
||||
@@ -38,17 +48,97 @@ export async function load({ params, url }) { // route
|
||||
return event_obj_results;
|
||||
})
|
||||
|
||||
let data_struct = {
|
||||
params: params,
|
||||
sections: [
|
||||
{ slug: 'new', title: 'New Speaker' },
|
||||
{ slug: 'manage', title: 'Manage' },
|
||||
{ slug: 'test', title: 'Test' },
|
||||
],
|
||||
url: url,
|
||||
|
||||
};
|
||||
return data_struct;
|
||||
let ds_code_li = {}; //: key_val; // = ae_loc_tmp.ds;
|
||||
// console.log(`ae_ ds_code_li = `, ds_code_li);
|
||||
let ds_code: string = '';
|
||||
let ds_type: null|string = null;
|
||||
|
||||
ds_code = 'hub__page__events_speakers__create_info_header';
|
||||
ds_type = 'text';
|
||||
|
||||
ds_code_li[ds_code] = await api.get_data_store_obj_w_code({
|
||||
api_cfg: get(ae_api),
|
||||
data_store_code: ds_code,
|
||||
data_type: ds_type,
|
||||
log_lvl: 2
|
||||
})
|
||||
.then( function (ds_results) {
|
||||
console.log(`ae_ Data Store ${ds_code} = `, ds_results);
|
||||
if (ds_results) {
|
||||
console.log(`ae_ Data Store ${ds_code} = `, ds_results);
|
||||
if (ds_type == 'json') {
|
||||
return ds_results.json;
|
||||
} else {
|
||||
return ds_results.text;
|
||||
}
|
||||
}
|
||||
})
|
||||
.finally(function (ds_code_val) {
|
||||
console.log(`ae_ ds_code_val = `, ds_code_val);
|
||||
|
||||
return ds_code_val;
|
||||
});
|
||||
|
||||
ds_code = 'hub__page__events_speakers__create_info';
|
||||
ds_type = 'text';
|
||||
|
||||
ds_code_li[ds_code] = await api.get_data_store_obj_w_code({
|
||||
api_cfg: get(ae_api),
|
||||
data_store_code: ds_code,
|
||||
data_type: ds_type,
|
||||
log_lvl: 2
|
||||
})
|
||||
.then( function (ds_results) {
|
||||
console.log(`ae_ Data Store ${ds_code} = `, ds_results);
|
||||
if (ds_results) {
|
||||
console.log(`ae_ Data Store ${ds_code} = `, ds_results);
|
||||
if (ds_type == 'json') {
|
||||
return ds_results.json;
|
||||
} else {
|
||||
return ds_results.text;
|
||||
}
|
||||
}
|
||||
})
|
||||
.finally(function (ds_code_val) {
|
||||
console.log(`ae_ ds_code_val = `, ds_code_val);
|
||||
|
||||
return ds_code_val;
|
||||
});
|
||||
|
||||
|
||||
let ae_loc_tmp = get(ae_loc);
|
||||
console.log(`ae_loc = `, ae_loc_tmp);
|
||||
|
||||
let ae_ds_tmp = ae_loc_tmp.ds;
|
||||
// Merge the new data into the existing data
|
||||
ae_ds_tmp = {
|
||||
...ae_ds_tmp,
|
||||
...ds_code_li,
|
||||
}
|
||||
|
||||
ae_loc_tmp = {
|
||||
...ae_loc_tmp,
|
||||
'ds': ae_ds_tmp,
|
||||
}
|
||||
console.log(`ae_loc = `, ae_loc_tmp);
|
||||
ae_loc.set(ae_loc_tmp);
|
||||
|
||||
// return data_struct;
|
||||
return data;
|
||||
|
||||
|
||||
// let data_struct = {
|
||||
// params: params,
|
||||
// sections: [
|
||||
// { slug: 'new', title: 'New Speaker' },
|
||||
// { slug: 'manage', title: 'Manage' },
|
||||
// { slug: 'test', title: 'Test' },
|
||||
// ],
|
||||
// url: url,
|
||||
|
||||
// };
|
||||
// return data_struct;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,12 +35,12 @@ export async function load({ params, url }) { // route
|
||||
|
||||
let loading_results = null;
|
||||
|
||||
ds_code = 'hub__page__events__create_info';
|
||||
ds_code = 'hub__page__events_speakers__create_info';
|
||||
ds_type = 'text';
|
||||
// loading_results = await handle_get_data_store_obj_w_code({ code: ds_code })
|
||||
// .then( function (ds_hub_page_events_create_info_results) {
|
||||
// if (ds_hub_page_events_create_info_results) {
|
||||
// console.log(`ae_ hub__page__events__create_info = `, ds_hub_page_events_create_info_results);
|
||||
// console.log(`ae_ hub__page__events_speakers__create_info = `, ds_hub_page_events_create_info_results);
|
||||
// // let ae_loc_tmp = get(ae_loc);
|
||||
|
||||
// ds_code_li[ds_code] = ds_hub_page_events_create_info_results;
|
||||
|
||||
@@ -25,7 +25,7 @@ import Edit_modal_event_presenter from '../10_edit_modal__event_presenter_obj.sv
|
||||
|
||||
|
||||
// Editing
|
||||
const modalComponentEditEventPresenterObj: ModalComponent = { ref: Edit_modal_event_presenter, props: {container_class_li: 'w-full p-4 space-y-4 card ae_modal_scrollfix'} };
|
||||
const modalComponentEditEventPresenterObj: ModalComponent = { ref: Edit_modal_event_presenter, props: {container_class_li: 'w-full p-4 space-y-4 card'} };
|
||||
|
||||
const modal_edit__event_presenter: ModalSettings = {
|
||||
type: 'component',
|
||||
@@ -65,6 +65,7 @@ $ae_loc.mod.events.show_edit__event_presenter_obj = false;
|
||||
$ae_loc.mod.events.show_view__event_presenter_obj = false;
|
||||
|
||||
let ae_event_presenter_get_promise: Promise<any>;
|
||||
let ae_event_obj_get_promise;
|
||||
|
||||
|
||||
onMount(() => {
|
||||
@@ -104,8 +105,6 @@ $: if ($slct_trigger == 'load__event_obj' && $slct.event_id) {
|
||||
handle_load_ae_obj_id__event({event_id: $slct.event_id, try_cache: false});
|
||||
}
|
||||
|
||||
let ae_event_obj_get_promise;
|
||||
|
||||
async function handle_load_ae_obj_id__event({event_id, try_cache=false}) {
|
||||
console.log(`*** handle_load_ae_obj_id__event() *** event_id=${event_id}`);
|
||||
|
||||
@@ -124,12 +123,12 @@ async function handle_load_ae_obj_id__event({event_id, try_cache=false}) {
|
||||
.then(function (event_obj_get_result) {
|
||||
if (event_obj_get_result) {
|
||||
$slct.event_obj = event_obj_get_result;
|
||||
console.log(`sponsorship object:`, $slct.event_obj);
|
||||
console.log(`event object:`, $slct.event_obj);
|
||||
}
|
||||
|
||||
// Auto show the selected sponsorship ID
|
||||
// Auto show the selected event_presenter ID
|
||||
// Is this pushState needed here?
|
||||
// Set the URL param "event_id" to the current sponsorship ID.
|
||||
// Set the URL param "event_id" to the current event_presenter ID.
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('event_id', $slct.event_id);
|
||||
// history.pushState({}, '', url);
|
||||
@@ -189,12 +188,12 @@ async function handle_load_ae_obj_id__event_presenter({event_presenter_id, try_c
|
||||
.then(function (event_presenter_get_result) {
|
||||
if (event_presenter_get_result) {
|
||||
$slct.event_presenter_obj = event_presenter_get_result;
|
||||
console.log(`sponsorship object:`, $slct.event_presenter);
|
||||
console.log(`event_presenter object:`, $slct.event_presenter);
|
||||
}
|
||||
|
||||
// Auto show the selected sponsorship ID
|
||||
// Auto show the selected event_presenter ID
|
||||
// Is this pushState needed here?
|
||||
// Set the URL param "event_presenter_id" to the current sponsorship ID.
|
||||
// Set the URL param "event_presenter_id" to the current event_presenter ID.
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('event_presenter_id', $slct.event_presenter_id);
|
||||
// history.pushState({}, '', url);
|
||||
@@ -235,32 +234,6 @@ $: if (testing) {
|
||||
// modalStore.clear();
|
||||
modalStore.trigger(modal_edit__event_presenter);
|
||||
}
|
||||
|
||||
|
||||
// KEEP and MOVE: This is the original function.
|
||||
// The name should be something like "example_id".
|
||||
function handle_url_and_message(name: string, value: null|string) {
|
||||
console.log(`*** handle_url_and_message() *** name=${name} value=${value}`);
|
||||
|
||||
if (value) {
|
||||
let location = window.location.href;
|
||||
const url = new URL(location);
|
||||
url.searchParams.set(name, value);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {name: value};
|
||||
window.parent.postMessage(message, "*");
|
||||
} else {
|
||||
let location = window.location.href;
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete(name);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {name: null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}
|
||||
// console.log('Message sent to parent (iframe):', message);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -268,8 +241,8 @@ function handle_url_and_message(name: string, value: null|string) {
|
||||
class="ae_events_speakers md:container h-full mx-auto flex flex-col items-center space-y-4"
|
||||
>
|
||||
|
||||
{#if $ae_loc.ds.hub__page__events__create_info_header}
|
||||
{@html $ae_loc.ds.hub__page__events__create_info_header}
|
||||
{#if $ae_loc.ds.hub__page__events_speakers__create_info_header}
|
||||
{@html $ae_loc.ds.hub__page__events_speakers__create_info_header}
|
||||
{:else}
|
||||
<header>
|
||||
<h1 class="h1">Information Goes Here</h1>
|
||||
@@ -313,13 +286,13 @@ function handle_url_and_message(name: string, value: null|string) {
|
||||
}}
|
||||
>
|
||||
<span class="fas fa-edit mx-1"></span>
|
||||
Start Sponsor Submission Form
|
||||
Start Speaker Submission Form
|
||||
</button>
|
||||
{/if}
|
||||
<!-- </section> -->
|
||||
|
||||
{#if $ae_loc.ds.hub__page__events__create_info}
|
||||
{@html $ae_loc.ds.hub__page__events__create_info}
|
||||
{#if $ae_loc.ds.hub__page__events_speakers__create_info}
|
||||
{@html $ae_loc.ds.hub__page__events_speakers__create_info}
|
||||
{:else}
|
||||
<section>
|
||||
<div class="alert alert-info">
|
||||
|
||||
@@ -65,6 +65,7 @@ $ae_loc.mod.sponsorships.show_edit__sponsorship_obj = false;
|
||||
$ae_loc.mod.sponsorships.show_view__sponsorship_obj = false;
|
||||
|
||||
let ae_sponsorship_obj_get_promise: Promise<any>;
|
||||
let ae_sponsorship_cfg_obj_get_promise;
|
||||
|
||||
|
||||
onMount(() => {
|
||||
@@ -104,8 +105,6 @@ $: if ($slct_trigger == 'load__sponsorship_cfg_obj' && $slct.sponsorship_cfg_id)
|
||||
handle_load_ae_obj_id__sponsorship_cfg({sponsorship_cfg_id: $slct.sponsorship_cfg_id, try_cache: false});
|
||||
}
|
||||
|
||||
let ae_sponsorship_cfg_obj_get_promise;
|
||||
|
||||
async function handle_load_ae_obj_id__sponsorship_cfg({sponsorship_cfg_id, try_cache=false}) {
|
||||
console.log(`*** handle_load_ae_obj_id__sponsorship_cfg() *** sponsorship_cfg_id=${sponsorship_cfg_id}`);
|
||||
|
||||
@@ -124,7 +123,7 @@ async function handle_load_ae_obj_id__sponsorship_cfg({sponsorship_cfg_id, try_c
|
||||
.then(function (sponsorship_cfg_obj_get_result) {
|
||||
if (sponsorship_cfg_obj_get_result) {
|
||||
$slct.sponsorship_cfg_obj = sponsorship_cfg_obj_get_result;
|
||||
console.log(`sponsorship object:`, $slct.sponsorship_cfg_obj);
|
||||
console.log(`sponsorship_cfg object:`, $slct.sponsorship_cfg_obj);
|
||||
}
|
||||
|
||||
// Auto show the selected sponsorship ID
|
||||
@@ -235,32 +234,6 @@ $: if (testing) {
|
||||
// modalStore.clear();
|
||||
modalStore.trigger(modal_edit__sponsorship_obj);
|
||||
}
|
||||
|
||||
|
||||
// KEEP and MOVE: This is the original function.
|
||||
// The name should be something like "example_id".
|
||||
function handle_url_and_message(name: string, value: null|string) {
|
||||
console.log(`*** handle_url_and_message() *** name=${name} value=${value}`);
|
||||
|
||||
if (value) {
|
||||
let location = window.location.href;
|
||||
const url = new URL(location);
|
||||
url.searchParams.set(name, value);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {name: value};
|
||||
window.parent.postMessage(message, "*");
|
||||
} else {
|
||||
let location = window.location.href;
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete(name);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
let message = {name: null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}
|
||||
// console.log('Message sent to parent (iframe):', message);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user