2023-06-15 20:45:38 +02:00
|
|
|
<script setup="setup">
|
2023-11-12 22:55:24 +01:00
|
|
|
|
2023-12-16 01:53:05 +01:00
|
|
|
const { etherFetch } = useEtherpadApi()
|
2023-11-12 22:55:24 +01:00
|
|
|
|
2023-06-15 20:45:38 +02:00
|
|
|
const store = usePojmiStore()
|
|
|
|
|
|
|
|
const props = defineProps({
|
2023-12-16 01:53:05 +01:00
|
|
|
revisionId: String,
|
|
|
|
pojem: Object,
|
2024-01-17 20:35:42 +01:00
|
|
|
onZapri: Function
|
2023-06-15 20:45:38 +02:00
|
|
|
})
|
|
|
|
|
2023-12-16 01:53:05 +01:00
|
|
|
let naslov = ref(props.pojem.naslov)
|
|
|
|
let email = ref('')
|
|
|
|
|
|
|
|
const oddajPredlog = async data => {
|
|
|
|
// @TODO vsebina pada v tekst, testirat
|
2024-01-24 17:37:41 +01:00
|
|
|
if (!naslov.value) {
|
|
|
|
alert("Manjka naslov pojma!")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-01-24 18:54:28 +01:00
|
|
|
const starNaslov = props.pojem.naslov
|
|
|
|
|
2023-12-16 01:53:05 +01:00
|
|
|
const resp = await etherFetch('/getText', { padID: props.revisionId })
|
2024-01-24 17:37:41 +01:00
|
|
|
const stvarjenje = store.ustvariPojem({
|
2023-12-16 01:53:05 +01:00
|
|
|
title: naslov.value,
|
|
|
|
email: email.value,
|
|
|
|
text: resp.data.text,
|
|
|
|
uuid: props.revisionId
|
|
|
|
})
|
2024-01-24 17:37:41 +01:00
|
|
|
console.log(stvarjenje)
|
2023-12-16 01:53:05 +01:00
|
|
|
alert("sprememba predlagana!")
|
2024-01-24 18:54:28 +01:00
|
|
|
|
|
|
|
stvarjenje.then(() => {
|
|
|
|
console.log('NOV NASLOV?', starNaslov, props.pojem.naslov)
|
|
|
|
if (starNaslov !== props.pojem.naslov) {
|
|
|
|
navigateTo('/manifest/' + encodeURIComponent(props.pojem.naslov))
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
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!
|
2023-11-12 22:55:24 +01:00
|
|
|
const etherNalozen = ev => {
|
2024-01-19 13:35:03 +01:00
|
|
|
if (props.pojem.nov) {
|
2024-01-24 17:37:41 +01:00
|
|
|
navigateTo('/manifest/dodaj/' + props.revisionId, {
|
|
|
|
replace: true
|
|
|
|
})
|
2024-01-19 13:35:03 +01:00
|
|
|
} else {
|
2024-01-24 18:54:28 +01:00
|
|
|
navigateTo('/manifest/' + encodeURIComponent(props.pojem.naslov) + '/uredi/' + props.revisionId, {
|
2024-01-24 17:37:41 +01:00
|
|
|
replace: true
|
|
|
|
})
|
2024-01-19 13:35:03 +01:00
|
|
|
}
|
|
|
|
//window.location.hash = props.revisionId
|
2023-11-12 22:55:24 +01:00
|
|
|
}
|
|
|
|
|
2023-06-15 20:45:38 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2024-01-24 17:37:41 +01:00
|
|
|
<form class="pojem" @submit.prevent>
|
|
|
|
<input name="naslov" type="text" placeholder="Naslov" 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">
|
2024-01-24 17:37:41 +01:00
|
|
|
<button class="gumb" @click="props.onZapri">
|
|
|
|
{{ props.zapriLabel ?? 'Zapri' }}
|
|
|
|
</button>
|
|
|
|
<button class="gumb oddaj" @click="oddajPredlog">
|
|
|
|
Predlagaj
|
|
|
|
</button>
|
2024-01-19 13:35:03 +01:00
|
|
|
</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>
|
2024-03-05 22:48:42 +01:00
|
|
|
form {
|
|
|
|
gap: 1rem;
|
|
|
|
}
|
|
|
|
|
2024-01-17 20:35:42 +01:00
|
|
|
.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%;
|
|
|
|
}
|
|
|
|
|
2024-01-24 17:37:41 +01:00
|
|
|
.pojem button.oddaj {
|
2024-01-17 20:35:42 +01:00
|
|
|
color: var(--roza);
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|