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) {
|
2024-05-31 17:44:04 +02:00
|
|
|
navigateTo(localePath({ name: 'pojem_poglej', params: { naslov: props.pojem.naslov }}))
|
2024-01-24 18:54:28 +01:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
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-04-01 21:20:07 +02:00
|
|
|
navigateTo(localePath({ name: 'pojem_dodaj', params: { guid: revisionId }}), {
|
2024-01-24 17:37:41 +01:00
|
|
|
replace: true
|
|
|
|
})
|
2024-01-19 13:35:03 +01:00
|
|
|
} else {
|
2024-04-01 21:20:07 +02:00
|
|
|
navigateTo(localePath({ name: 'pojem_uredi', params: {
|
2024-05-31 17:44:04 +02:00
|
|
|
naslov: props.pojem.naslov,
|
2024-04-01 21:20:07 +02:00
|
|
|
guid: props.revisionId
|
|
|
|
}}), { 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>
|
2024-04-01 17:57:34 +02:00
|
|
|
<input name="naslov" type="text" placeholder="Naslov" v-model="naslov" @keydown.enter.prevent>
|
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-04-01 17:57:34 +02:00
|
|
|
<input name="email" type="email" placeholder="E-poštni naslov" v-model="email" @keydown.enter="oddajPredlog">
|
2024-01-19 13:35:03 +01:00
|
|
|
<div class="gumbi">
|
2024-01-24 17:37:41 +01:00
|
|
|
<button class="gumb" @click="props.onZapri">
|
2024-04-01 21:23:23 +02:00
|
|
|
{{ props.zapriLabel ?? $t('Zapri') }}
|
2024-01-24 17:37:41 +01:00
|
|
|
</button>
|
|
|
|
<button class="gumb oddaj" @click="oddajPredlog">
|
2024-04-01 21:23:23 +02:00
|
|
|
{{ $t("Predlagaj") }}
|
2024-01-24 17:37:41 +01:00
|
|
|
</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>
|