Ideenbox (0.33.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 9m16s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 9m12s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 9m52s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 9m47s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 10m4s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 10m6s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 8m6s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 56s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 8m56s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m53s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 9m16s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 9m12s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 9m52s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 9m47s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 10m4s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 10m6s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 8m6s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 56s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 8m56s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m53s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
bd7536ab82
commit
858e248d26
160 changed files with 1543 additions and 348 deletions
67
plugins-core/ideen/resources/js/components/IdeaDialog.vue
Normal file
67
plugins-core/ideen/resources/js/components/IdeaDialog.vue
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<script setup>
|
||||
import { watch } from 'vue';
|
||||
import { useForm } from '@inertiajs/vue3';
|
||||
import { LoaderCircle } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
import FormField from '@/components/FormField.vue';
|
||||
|
||||
/**
|
||||
* Idee einreichen bzw. (solange sie neu ist) bearbeiten.
|
||||
*/
|
||||
const props = defineProps({
|
||||
idea: { type: Object, default: null },
|
||||
});
|
||||
|
||||
const open = defineModel('open', { type: Boolean, default: false });
|
||||
const form = useForm({ title: '', body: '', anonymous: false });
|
||||
|
||||
watch(open, (value) => {
|
||||
if (!value) return;
|
||||
|
||||
form.clearErrors();
|
||||
form.defaults({ title: props.idea?.title ?? '', body: props.idea?.body ?? '', anonymous: false });
|
||||
form.reset();
|
||||
});
|
||||
|
||||
function submit() {
|
||||
const options = { preserveScroll: true, onSuccess: () => (open.value = false) };
|
||||
props.idea ? form.put(`/ideen/${props.idea.id}`, options) : form.post('/ideen', options);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Dialog v-model:open="open">
|
||||
<DialogContent class="sm:max-w-xl">
|
||||
<DialogHeader>
|
||||
<DialogTitle>{{ idea ? 'Idee bearbeiten' : 'Idee einreichen' }}</DialogTitle>
|
||||
<DialogDescription>Was ließe sich verbessern? Beschreiben Sie kurz das Problem und Ihren Vorschlag.</DialogDescription>
|
||||
</DialogHeader>
|
||||
<form id="idea-form" class="grid gap-5" @submit.prevent="submit">
|
||||
<FormField id="idea-title" label="Titel" :error="form.errors.title">
|
||||
<Input id="idea-title" v-model="form.title" maxlength="160" placeholder="z. B. Fahrradständer mit Überdachung" />
|
||||
</FormField>
|
||||
<FormField id="idea-body" label="Beschreibung" :error="form.errors.body">
|
||||
<Textarea id="idea-body" v-model="form.body" rows="7" maxlength="5000" placeholder="Was ist heute schwierig? Was schlagen Sie vor? Wem würde es helfen?" />
|
||||
</FormField>
|
||||
<label v-if="!idea" class="flex items-start justify-between gap-4 rounded-md border p-3 text-sm">
|
||||
<span>
|
||||
<span class="font-medium">Anonym einreichen</span>
|
||||
<span class="block text-xs text-muted-foreground">Ihr Name wird nicht gespeichert – auch nicht für das Gremium. Dann können Sie die Idee später nicht mehr bearbeiten und bekommen keine Rückmeldung per Benachrichtigung.</span>
|
||||
</span>
|
||||
<Switch v-model="form.anonymous" />
|
||||
</label>
|
||||
</form>
|
||||
<DialogFooter>
|
||||
<Button variant="ghost" @click="open = false">Abbrechen</Button>
|
||||
<Button type="submit" form="idea-form" :disabled="form.processing">
|
||||
<LoaderCircle v-if="form.processing" class="animate-spin" />
|
||||
{{ idea ? 'Speichern' : 'Einreichen' }}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</template>
|
||||
17
plugins-core/ideen/resources/js/components/StatusBadge.vue
Normal file
17
plugins-core/ideen/resources/js/components/StatusBadge.vue
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<script setup>
|
||||
defineProps({
|
||||
status: { type: String, required: true },
|
||||
label: { type: String, required: true },
|
||||
});
|
||||
|
||||
const styles = {
|
||||
new: 'bg-brand-soft text-brand-text',
|
||||
review: 'bg-accent2/15 text-accent2-text',
|
||||
done: 'bg-brand text-brand-foreground',
|
||||
rejected: 'bg-muted text-muted-foreground',
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span class="inline-flex shrink-0 items-center rounded px-1.5 py-0.5 text-[11px] font-medium" :class="styles[status]">{{ label }}</span>
|
||||
</template>
|
||||
55
plugins-core/ideen/resources/js/components/SupportButton.vue
Normal file
55
plugins-core/ideen/resources/js/components/SupportButton.vue
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { router } from '@inertiajs/vue3';
|
||||
import { ThumbsUp } from '@lucide/vue';
|
||||
|
||||
/**
|
||||
* „Unterstützen“ mit Zähler – schaltet sofort um, der Server bestätigt im Hintergrund.
|
||||
*/
|
||||
const props = defineProps({
|
||||
idea: { type: Object, required: true },
|
||||
disabled: { type: Boolean, default: false },
|
||||
large: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const supported = ref(!!props.idea.supported);
|
||||
const count = ref(props.idea.supports);
|
||||
watch(() => [props.idea.supported, props.idea.supports], ([s, c]) => {
|
||||
supported.value = !!s;
|
||||
count.value = c;
|
||||
});
|
||||
|
||||
function toggle() {
|
||||
const next = !supported.value;
|
||||
supported.value = next;
|
||||
count.value += next ? 1 : -1;
|
||||
router.visit(`/ideen/${props.idea.id}/unterstuetzen`, {
|
||||
method: next ? 'post' : 'delete',
|
||||
preserveScroll: true,
|
||||
preserveState: true,
|
||||
onError: () => {
|
||||
supported.value = !next;
|
||||
count.value += next ? -1 : 1;
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<button
|
||||
type="button"
|
||||
:disabled="disabled"
|
||||
:aria-pressed="supported"
|
||||
:title="disabled ? 'Ihre eigene Idee' : supported ? 'Unterstützung zurücknehmen' : 'Idee unterstützen'"
|
||||
class="flex shrink-0 flex-col items-center justify-center rounded-md border tabular-nums transition-colors disabled:cursor-default disabled:opacity-70"
|
||||
:class="[
|
||||
large ? 'min-w-20 gap-1 px-3 py-2.5' : 'size-14 gap-0.5',
|
||||
supported ? 'border-brand bg-brand text-brand-foreground' : 'bg-card hover:border-brand/50 hover:bg-brand-soft',
|
||||
]"
|
||||
@click="toggle"
|
||||
>
|
||||
<ThumbsUp :class="[large ? 'size-5' : 'size-4', supported ? 'fill-current' : '']" />
|
||||
<span class="text-sm font-semibold">{{ count }}</span>
|
||||
<span v-if="large" class="text-[11px]">{{ supported ? 'Unterstützt' : 'Unterstützen' }}</span>
|
||||
</button>
|
||||
</template>
|
||||
Loading…
Add table
Add a link
Reference in a new issue