mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-24 15:29:36 +02:00
Make public from creation modal
This commit is contained in:
parent
28b68afb12
commit
132ad44c08
2 changed files with 25 additions and 0 deletions
|
@ -125,6 +125,9 @@
|
|||
let user_id = data[2];
|
||||
let image_url = data[3];
|
||||
let link = data[4];
|
||||
if (newAdventure.is_public) {
|
||||
navigator.clipboard.writeText(`${window.location.origin}/adventures/${id}`);
|
||||
}
|
||||
newAdventure.image = image_url;
|
||||
newAdventure.id = id;
|
||||
newAdventure.user_id = user_id;
|
||||
|
@ -370,6 +373,20 @@
|
|||
class="input input-bordered w-full max-w-xs mt-1"
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<label for="is_public">Public <Earth class="inline-block -mt-1 mb-1 w-6 h-6" /></label><br
|
||||
/>
|
||||
<input
|
||||
type="checkbox"
|
||||
class="toggle toggle-primary"
|
||||
id="is_public"
|
||||
name="is_public"
|
||||
bind:checked={newAdventure.is_public}
|
||||
/>
|
||||
</div>
|
||||
{#if newAdventure.is_public}
|
||||
<p>The link to this adventure will be copied to your clipboard once it is created!</p>
|
||||
{/if}
|
||||
<div class="mb-2">
|
||||
<input
|
||||
type="text"
|
||||
|
|
|
@ -83,6 +83,13 @@ export const actions: Actions = {
|
|||
let latitude = formData.get('latitude') as string | null;
|
||||
let longitude = formData.get('longitude') as string | null;
|
||||
let collection = formData.get('collection') as string | null;
|
||||
let is_public = formData.get('is_public') as string | null | boolean;
|
||||
|
||||
if (is_public) {
|
||||
is_public = true;
|
||||
} else {
|
||||
is_public = false;
|
||||
}
|
||||
|
||||
// check if latitude and longitude are valid
|
||||
if (latitude && longitude) {
|
||||
|
@ -127,6 +134,7 @@ export const actions: Actions = {
|
|||
formDataToSend.append('description', description || '');
|
||||
formDataToSend.append('latitude', latitude || '');
|
||||
formDataToSend.append('longitude', longitude || '');
|
||||
formDataToSend.append('is_public', is_public.toString());
|
||||
|
||||
if (!isNaN(Number(collection))) {
|
||||
if (collection !== null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue