mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-21 05:49:37 +02:00
Fix max url length, adds line breaks to display, truncates long urls. Remove old seed command.
This commit is contained in:
parent
0fd9e04599
commit
78f56a3a5f
5 changed files with 46 additions and 4228 deletions
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 5.0.8 on 2024-09-17 14:18
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('adventures', '0005_collection_shared_with'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='adventure',
|
||||
name='link',
|
||||
field=models.URLField(blank=True, max_length=2083, null=True),
|
||||
),
|
||||
]
|
|
@ -43,7 +43,7 @@ class Adventure(models.Model):
|
|||
max_length=100), blank=True, null=True)
|
||||
description = models.TextField(blank=True, null=True)
|
||||
rating = models.FloatField(blank=True, null=True)
|
||||
link = models.URLField(blank=True, null=True)
|
||||
link = models.URLField(blank=True, null=True, max_length=2083)
|
||||
image = ResizedImageField(force_format="WEBP", quality=75, null=True, blank=True, upload_to='images/')
|
||||
date = models.DateField(blank=True, null=True)
|
||||
end_date = models.DateField(blank=True, null=True)
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -17,6 +17,7 @@
|
|||
let query: string = '';
|
||||
let places: OpenStreetMapPlace[] = [];
|
||||
let images: { id: string; image: string }[] = [];
|
||||
let warningMessage: string = '';
|
||||
|
||||
import Earth from '~icons/mdi/earth';
|
||||
import ActivityComplete from './ActivityComplete.svelte';
|
||||
|
@ -393,8 +394,10 @@
|
|||
if (data.id) {
|
||||
adventure = data as Adventure;
|
||||
isDetails = false;
|
||||
warningMessage = '';
|
||||
addToast('success', 'Adventure created');
|
||||
} else {
|
||||
warningMessage = Object.values(data)[0] as string;
|
||||
addToast('error', 'Failed to create adventure');
|
||||
}
|
||||
} else {
|
||||
|
@ -409,8 +412,10 @@
|
|||
if (data.id) {
|
||||
adventure = data as Adventure;
|
||||
isDetails = false;
|
||||
warningMessage = '';
|
||||
addToast('success', 'Adventure updated');
|
||||
} else {
|
||||
warningMessage = Object.values(data)[0] as string;
|
||||
addToast('error', 'Failed to update adventure');
|
||||
}
|
||||
}
|
||||
|
@ -726,6 +731,24 @@ it would also work to just use on:click on the MapLibre component itself. -->
|
|||
{/if}
|
||||
|
||||
<div class="mt-4">
|
||||
{#if warningMessage != ''}
|
||||
<div role="alert" class="alert alert-warning mb-2">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="h-6 w-6 shrink-0 stroke-current"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
|
||||
/>
|
||||
</svg>
|
||||
<span>Warning: {warningMessage}</span>
|
||||
</div>
|
||||
{/if}
|
||||
<button type="submit" class="btn btn-primary">Save & Next</button>
|
||||
<button type="button" class="btn" on:click={close}>Close</button>
|
||||
</div>
|
||||
|
|
|
@ -281,14 +281,16 @@
|
|||
class="text-sm text-muted-foreground hover:underline"
|
||||
target="_blank"
|
||||
>
|
||||
{adventure.link}
|
||||
{adventure.link.length > 45
|
||||
? `${adventure.link.slice(0, 45)}...`
|
||||
: adventure.link}
|
||||
</a>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{#if adventure.description}
|
||||
<div class="grid gap-2">
|
||||
<p class="text-sm text-muted-foreground">
|
||||
<p class="text-sm text-muted-foreground whitespace-pre-line">
|
||||
{adventure.description}
|
||||
</p>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue