mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-24 15:29:36 +02:00
collection update
This commit is contained in:
parent
e679eada06
commit
9e78a1bc4f
4 changed files with 29 additions and 9 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -127,11 +127,14 @@
|
|||
<h2 class="card-title break-words text-wrap">
|
||||
{adventure.name}
|
||||
</h2>
|
||||
<div>
|
||||
{#if adventure.type == 'visited'}
|
||||
<div class="badge badge-primary">Visited</div>
|
||||
{:else}
|
||||
<div class="badge badge-secondary">Planned</div>
|
||||
{/if}
|
||||
<div class="badge badge-neutral">{adventure.is_public ? 'Public' : 'Private'}</div>
|
||||
</div>
|
||||
{#if adventure.location && adventure.location !== ''}
|
||||
<div class="inline-flex items-center">
|
||||
<MapMarker class="w-5 h-5 mr-1" />
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
export let type: String;
|
||||
export let type: String | undefined | null;
|
||||
|
||||
// export let type: String;
|
||||
|
||||
|
|
|
@ -179,7 +179,12 @@
|
|||
{#if currentView == 'cards'}
|
||||
<div class="flex flex-wrap gap-4 mr-4 justify-center content-center">
|
||||
{#each collections as collection}
|
||||
<CollectionCard {collection} on:delete={deleteCollection} on:edit={editCollection} />
|
||||
<CollectionCard
|
||||
type=""
|
||||
{collection}
|
||||
on:delete={deleteCollection}
|
||||
on:edit={editCollection}
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
@ -229,8 +234,7 @@
|
|||
class="radio radio-primary"
|
||||
/>
|
||||
<br />
|
||||
<p class="text-md font-semibold mt-2 mb-2">Order By</p>
|
||||
<label for="name">Name</label>
|
||||
|
||||
<input
|
||||
type="radio"
|
||||
name="order_by"
|
||||
|
@ -238,6 +242,7 @@
|
|||
class="radio radio-primary"
|
||||
checked
|
||||
value="name"
|
||||
hidden
|
||||
/>
|
||||
<button type="submit" class="btn btn-primary mt-4">Filter</button>
|
||||
</form>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue