manifest/nuxt/components/PojemForm.vue

81 lines
1.6 KiB
Vue
Raw Normal View History

2023-06-15 20:45:38 +02:00
<script setup="setup">
const { etherFetch } = useEtherpadApi()
2023-06-15 20:45:38 +02:00
const store = usePojmiStore()
const props = defineProps({
revisionId: String,
pojem: Object,
2024-01-17 20:35:42 +01:00
urejanje: Object,
onZapri: Function
2023-06-15 20:45:38 +02:00
})
let naslov = ref(props.pojem.naslov)
let email = ref('')
const oddajPredlog = async data => {
// @TODO vsebina pada v tekst, testirat
const resp = await etherFetch('/getText', { padID: props.revisionId })
store.ustvariPojem({
title: naslov.value,
email: email.value,
text: resp.data.text,
uuid: props.revisionId
})
alert("sprememba predlagana!")
2024-01-17 22:20:56 +01:00
props.onZapri()
2023-06-15 20:45:38 +02:00
}
const etherNalozen = ev => {
navigateTo('/pojmi/' + props.revisionId)
//window.location.hash = props.revisionId
}
2023-06-15 20:45:38 +02:00
</script>
<template>
<form class="pojem" @submit.prevent="oddajPredlog">
<input name="naslov" type="text" v-model="naslov">
<EtherpadTextarea :onLoad="etherNalozen" :revisionId="props.revisionId" />
2023-06-15 20:45:38 +02:00
2024-01-17 20:35:42 +01:00
<input name="email" type="email" placeholder="E-poštni naslov" v-model="email">
<div class="gumbi">
<button class="gumb" @click="props.onZapri">Zapri</button>
<input class="gumb" type="submit" value="Predlagaj">
</div>
2024-01-17 22:20:56 +01:00
2023-06-15 20:45:38 +02:00
</form>
</template>
2024-01-17 20:35:42 +01:00
<style>
.etherpad-textarea {
width: 100%;
flex-grow: 1;
border-radius: 16px;
border: 2px solid var(--siva);
}
input {
border: 2px solid var(--siva);
border-radius: 8px;
padding: 15px;
}
.gumbi {
display: flex;
flex-direction: row;
justify-content: space-between;
}
.pojem.form .gumb {
width: 50%;
}
.pojem input[type=submit] {
color: var(--roza);
}
</style>