manifest/nuxt/components/PojemForm.vue

95 lines
1.8 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
}
2024-01-19 13:35:03 +01:00
// @TODO tole raje v pojmi.vue oz nov_pojem.vue - page!
const etherNalozen = ev => {
2024-01-19 13:35:03 +01:00
if (props.pojem.nov) {
navigateTo('/manifest/dodaj/' + props.revisionId)
2024-01-19 13:35:03 +01:00
} else {
navigateTo('/manifest/' + props.revisionId)
2024-01-19 13:35:03 +01:00
}
//window.location.hash = props.revisionId
}
2023-06-15 20:45:38 +02:00
</script>
<template>
2024-01-19 13:35:03 +01:00
<form class="pojem" @submit.prevent="oddajPredlog">
<input name="naslov" type="text" v-model="naslov">
2023-06-15 20:45:38 +02:00
2024-01-19 13:35:03 +01:00
<EtherpadTextarea :onLoad="etherNalozen" :revisionId="props.revisionId" />
2023-06-15 20:45:38 +02:00
2024-01-19 13:35:03 +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
2024-01-19 13:35:03 +01:00
</form>
2023-06-15 20:45:38 +02:00
</template>
2024-01-17 20:35:42 +01:00
<style>
.etherpad-textarea {
2024-01-19 13:35:03 +01:00
width: 100%;
flex-grow: 1;
border-radius: 16px;
border: 2px solid var(--siva);
box-sizing: border-box;
2024-01-19 13:41:17 +01:00
min-height: 500px;
2024-01-17 20:35:42 +01:00
}
input {
border: 2px solid var(--siva);
border-radius: 8px;
padding: 15px;
}
.gumbi {
display: flex;
flex-direction: row;
justify-content: space-between;
}
2024-01-19 12:42:02 +01:00
.gumb,
.gumbi input,
.gumbi button {
text-transform: uppercase;
padding: 0;
margin: 0;
}
2024-01-17 20:35:42 +01:00
.pojem.form .gumb {
width: 50%;
}
.pojem input[type=submit] {
color: var(--roza);
}
</style>