diff --git a/backend/server/adventures/views.py b/backend/server/adventures/views.py index 8cfbcfe..cd64725 100644 --- a/backend/server/adventures/views.py +++ b/backend/server/adventures/views.py @@ -80,6 +80,18 @@ class AdventureViewSet(viewsets.ModelViewSet): serializer = self.get_serializer(adventure) return Response(serializer.data) + def perform_create(self, serializer): + adventure = serializer.save(user_id=self.request.user) + if adventure.collection: + adventure.is_public = adventure.collection.is_public + adventure.save() + + def perform_update(self, serializer): + adventure = serializer.save() + if adventure.collection: + adventure.is_public = adventure.collection.is_public + adventure.save() + def perform_create(self, serializer): serializer.save(user_id=self.request.user) diff --git a/frontend/src/lib/components/AdventureCard.svelte b/frontend/src/lib/components/AdventureCard.svelte index 1958b59..5d519cc 100644 --- a/frontend/src/lib/components/AdventureCard.svelte +++ b/frontend/src/lib/components/AdventureCard.svelte @@ -127,11 +127,14 @@

{adventure.name}

- {#if adventure.type == 'visited'} -
Visited
- {:else} -
Planned
- {/if} +
+ {#if adventure.type == 'visited'} +
Visited
+ {:else} +
Planned
+ {/if} +
{adventure.is_public ? 'Public' : 'Private'}
+
{#if adventure.location && adventure.location !== ''}
diff --git a/frontend/src/lib/components/CollectionCard.svelte b/frontend/src/lib/components/CollectionCard.svelte index 4860a76..cd6d314 100644 --- a/frontend/src/lib/components/CollectionCard.svelte +++ b/frontend/src/lib/components/CollectionCard.svelte @@ -14,7 +14,7 @@ const dispatch = createEventDispatcher(); - export let type: String; + export let type: String | undefined | null; // export let type: String; diff --git a/frontend/src/routes/collections/+page.svelte b/frontend/src/routes/collections/+page.svelte index 9e0f35a..113e761 100644 --- a/frontend/src/routes/collections/+page.svelte +++ b/frontend/src/routes/collections/+page.svelte @@ -179,7 +179,12 @@ {#if currentView == 'cards'}
{#each collections as collection} - + {/each}
{/if} @@ -229,8 +234,7 @@ class="radio radio-primary" />
-

Order By

- +