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)
|
serializer = self.get_serializer(adventure)
|
||||||
return Response(serializer.data)
|
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):
|
def perform_create(self, serializer):
|
||||||
serializer.save(user_id=self.request.user)
|
serializer.save(user_id=self.request.user)
|
||||||
|
|
||||||
|
|
|
@ -127,11 +127,14 @@
|
||||||
<h2 class="card-title break-words text-wrap">
|
<h2 class="card-title break-words text-wrap">
|
||||||
{adventure.name}
|
{adventure.name}
|
||||||
</h2>
|
</h2>
|
||||||
{#if adventure.type == 'visited'}
|
<div>
|
||||||
<div class="badge badge-primary">Visited</div>
|
{#if adventure.type == 'visited'}
|
||||||
{:else}
|
<div class="badge badge-primary">Visited</div>
|
||||||
<div class="badge badge-secondary">Planned</div>
|
{:else}
|
||||||
{/if}
|
<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 !== ''}
|
{#if adventure.location && adventure.location !== ''}
|
||||||
<div class="inline-flex items-center">
|
<div class="inline-flex items-center">
|
||||||
<MapMarker class="w-5 h-5 mr-1" />
|
<MapMarker class="w-5 h-5 mr-1" />
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
export let type: String;
|
export let type: String | undefined | null;
|
||||||
|
|
||||||
// export let type: String;
|
// export let type: String;
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,12 @@
|
||||||
{#if currentView == 'cards'}
|
{#if currentView == 'cards'}
|
||||||
<div class="flex flex-wrap gap-4 mr-4 justify-center content-center">
|
<div class="flex flex-wrap gap-4 mr-4 justify-center content-center">
|
||||||
{#each collections as collection}
|
{#each collections as collection}
|
||||||
<CollectionCard {collection} on:delete={deleteCollection} on:edit={editCollection} />
|
<CollectionCard
|
||||||
|
type=""
|
||||||
|
{collection}
|
||||||
|
on:delete={deleteCollection}
|
||||||
|
on:edit={editCollection}
|
||||||
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -229,8 +234,7 @@
|
||||||
class="radio radio-primary"
|
class="radio radio-primary"
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
<p class="text-md font-semibold mt-2 mb-2">Order By</p>
|
|
||||||
<label for="name">Name</label>
|
|
||||||
<input
|
<input
|
||||||
type="radio"
|
type="radio"
|
||||||
name="order_by"
|
name="order_by"
|
||||||
|
@ -238,6 +242,7 @@
|
||||||
class="radio radio-primary"
|
class="radio radio-primary"
|
||||||
checked
|
checked
|
||||||
value="name"
|
value="name"
|
||||||
|
hidden
|
||||||
/>
|
/>
|
||||||
<button type="submit" class="btn btn-primary mt-4">Filter</button>
|
<button type="submit" class="btn btn-primary mt-4">Filter</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue