Support multiline descriptions for entities
Use a textarea for editing the description and preserve linebreaks when it's displayed in the UI using a new preWrap class for this purpose.
This commit is contained in:
parent
96681bfd37
commit
37edf122a1
8 changed files with 43 additions and 36 deletions
|
@ -83,3 +83,7 @@ label>* {
|
||||||
label + label {
|
label + label {
|
||||||
margin-block-start: 0.5rem;
|
margin-block-start: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.preWrap {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<p v-if=event.host>
|
<p v-if=event.host>
|
||||||
Host: {{ event.host }}
|
Host: {{ event.host }}
|
||||||
</p>
|
</p>
|
||||||
<p>{{ event.description ?? "No description provided" }}</p>
|
<p class="preWrap">{{ event.description ?? "No description provided" }}</p>
|
||||||
<p v-if="event.interested">
|
<p v-if="event.interested">
|
||||||
{{ event.interested }} interested
|
{{ event.interested }} interested
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<template>
|
<template>
|
||||||
<section class="shift">
|
<section class="shift">
|
||||||
<h3>{{ shift.name }}</h3>
|
<h3>{{ shift.name }}</h3>
|
||||||
<p>{{ shift.description ?? "No description provided" }}</p>
|
<p class="preWrap">{{ shift.description ?? "No description provided" }}</p>
|
||||||
|
|
||||||
<h4>Timeslots</h4>
|
<h4>Timeslots</h4>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -39,11 +39,11 @@
|
||||||
>
|
>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input
|
<textarea
|
||||||
type="text"
|
rows="1"
|
||||||
:disabled="!canEdit(event)"
|
:disabled="!canEdit(event)"
|
||||||
v-model="event.description"
|
v-model="event.description"
|
||||||
>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input
|
<input
|
||||||
|
@ -82,10 +82,10 @@
|
||||||
>
|
>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input
|
<textarea
|
||||||
type="text"
|
rows="1"
|
||||||
v-model="newEventDescription"
|
v-model="newEventDescription"
|
||||||
>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input
|
<input
|
||||||
|
@ -116,7 +116,7 @@
|
||||||
<td>{{ event.id }}</td>
|
<td>{{ event.id }}</td>
|
||||||
<td>{{ event.name }}</td>
|
<td>{{ event.name }}</td>
|
||||||
<td>{{ event.host }}</td>
|
<td>{{ event.host }}</td>
|
||||||
<td>{{ event.description }}</td>
|
<td class="preWrap">{{ event.description }}</td>
|
||||||
<td>{{ event.crew ? "" : "Yes"}}</td>
|
<td>{{ event.crew ? "" : "Yes"}}</td>
|
||||||
<td>{{ event.slots.size ? event.slots.size : "" }}</td>
|
<td>{{ event.slots.size ? event.slots.size : "" }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -28,10 +28,10 @@
|
||||||
>
|
>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input
|
<textarea
|
||||||
type="text"
|
rows="1"
|
||||||
v-model="location.description"
|
v-model="location.description"
|
||||||
>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button
|
<button
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<td>{{ location.id }}</td>
|
<td>{{ location.id }}</td>
|
||||||
<td>{{ location.name }}</td>
|
<td>{{ location.name }}</td>
|
||||||
<td>{{ location.description }}</td>
|
<td class="preWrap">{{ location.description }}</td>
|
||||||
</template>
|
</template>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-if='edit'>
|
<tr v-if='edit'>
|
||||||
|
@ -63,10 +63,10 @@
|
||||||
>
|
>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input
|
<textarea
|
||||||
type="text"
|
rows="1"
|
||||||
v-model="newLocationDescription"
|
v-model="newLocationDescription"
|
||||||
>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td colspan="1">
|
<td colspan="1">
|
||||||
<button
|
<button
|
||||||
|
|
|
@ -28,10 +28,10 @@
|
||||||
>
|
>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input
|
<textarea
|
||||||
type="text"
|
rows="1"
|
||||||
v-model="role.description"
|
v-model="role.description"
|
||||||
>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button
|
<button
|
||||||
|
@ -55,10 +55,10 @@
|
||||||
>
|
>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input
|
<textarea
|
||||||
type="text"
|
rows="1"
|
||||||
v-model="newRoleDescription"
|
v-model="newRoleDescription"
|
||||||
>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button
|
<button
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
>
|
>
|
||||||
<td>{{ role.id }}</td>
|
<td>{{ role.id }}</td>
|
||||||
<td>{{ role.name }}</td>
|
<td>{{ role.name }}</td>
|
||||||
<td>{{ role.description }}</td>
|
<td class="preWrap">{{ role.description }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</template>
|
</template>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -37,10 +37,10 @@
|
||||||
</td>
|
</td>
|
||||||
<td>{{ shift.slots.size ? shift.slots.size : "" }}</td>
|
<td>{{ shift.slots.size ? shift.slots.size : "" }}</td>
|
||||||
<td>
|
<td>
|
||||||
<input
|
<textarea
|
||||||
type="text"
|
rows="1"
|
||||||
v-model="shift.description"
|
v-model="shift.description"
|
||||||
>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button
|
<button
|
||||||
|
@ -71,10 +71,10 @@
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>
|
<td>
|
||||||
<input
|
<textarea
|
||||||
type="text"
|
rows="1"
|
||||||
v-model="newShiftDescription"
|
v-model="newShiftDescription"
|
||||||
>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button
|
<button
|
||||||
|
@ -98,7 +98,7 @@
|
||||||
<td>{{ shift.name }}</td>
|
<td>{{ shift.name }}</td>
|
||||||
<td>{{ shift.roleId }}</td>
|
<td>{{ shift.roleId }}</td>
|
||||||
<td>{{ shift.slots.size ? shift.slots.size : "" }}</td>
|
<td>{{ shift.slots.size ? shift.slots.size : "" }}</td>
|
||||||
<td>{{ shift.description }}</td>
|
<td class="preWrap">{{ shift.description }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</template>
|
</template>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -9,7 +9,7 @@ const locations = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
name: "Stage",
|
name: "Stage",
|
||||||
description: "Inside the main building.",
|
description: "Inside the main building.\n\nMind the gap.",
|
||||||
updatedAt: "d-1 18:21",
|
updatedAt: "d-1 18:21",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ let eventId = 1;
|
||||||
const events = [
|
const events = [
|
||||||
{
|
{
|
||||||
name: "Arcade",
|
name: "Arcade",
|
||||||
description: "Play retro games!",
|
description: "Play retro games!\n\nWe have anything from C64 to PS5.",
|
||||||
slots: [
|
slots: [
|
||||||
"d1 12:00 4h clubhouse",
|
"d1 12:00 4h clubhouse",
|
||||||
"d2 12:00 4h clubhouse",
|
"d2 12:00 4h clubhouse",
|
||||||
|
@ -158,13 +158,14 @@ const events = [
|
||||||
const idMedic = 1;
|
const idMedic = 1;
|
||||||
const idSecurity = 2;
|
const idSecurity = 2;
|
||||||
const roles = [
|
const roles = [
|
||||||
{ id: idMedic, name: "Medic", updatedAt: "d-2 12:34" },
|
{ id: idMedic, name: "Medic", description: "Helping those in need.\n\nAsk lead if in doubt.", updatedAt: "d-2 12:34" },
|
||||||
{ id: idSecurity, name: "Security", updatedAt: "d-2 12:39" },
|
{ id: idSecurity, name: "Security", description: "Keeping the con safe", updatedAt: "d-2 12:39" },
|
||||||
]
|
]
|
||||||
|
|
||||||
const shifts = [
|
const shifts = [
|
||||||
{
|
{
|
||||||
name: "Medic Early",
|
name: "Medic Early",
|
||||||
|
description: "Not much happens early.\n\nPrefer strolling outside to be visible.",
|
||||||
roleId: idMedic,
|
roleId: idMedic,
|
||||||
slots: [
|
slots: [
|
||||||
"d1 12:00 4h",
|
"d1 12:00 4h",
|
||||||
|
@ -357,16 +358,18 @@ export function generateDemoSchedule(): ApiSchedule {
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
roles: roles.map(
|
roles: roles.map(
|
||||||
({ id, name, updatedAt }) => ({
|
({ id, name, description, updatedAt }) => ({
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
|
description,
|
||||||
updatedAt: toIso(toDate(origin, ...(updatedAt.split(" ")) as [string, string])),
|
updatedAt: toIso(toDate(origin, ...(updatedAt.split(" ")) as [string, string])),
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
shifts: shifts.map(
|
shifts: shifts.map(
|
||||||
({ id, name, roleId, slots }) => ({
|
({ id, name, description, roleId, slots }) => ({
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
|
description,
|
||||||
roleId,
|
roleId,
|
||||||
slots: slots.map(shorthand => toShift(origin, shorthand, shiftSlotIdToAssigned)),
|
slots: slots.map(shorthand => toShift(origin, shorthand, shiftSlotIdToAssigned)),
|
||||||
updatedAt: toIso(toDate(origin, "d-1", "13:23")),
|
updatedAt: toIso(toDate(origin, "d-1", "13:23")),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue