2023-05-03 21:31:01 +02:00
|
|
|
<script setup="setup">
|
2023-11-13 00:22:34 +01:00
|
|
|
|
|
|
|
const { etherpadApiUrl, etherpadPrefix } = useRuntimeConfig().public
|
|
|
|
|
2023-05-03 21:31:01 +02:00
|
|
|
const store = usePojmiStore()
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
naslov: String
|
|
|
|
})
|
|
|
|
|
|
|
|
const pojem = computed(() => store.pojmi[props.naslov])
|
2023-11-13 00:22:34 +01:00
|
|
|
const revisionId = computed(() => pojem.value.id)
|
2023-05-03 21:31:01 +02:00
|
|
|
|
|
|
|
await store.naloziPojme()
|
|
|
|
|
2023-11-13 00:22:34 +01:00
|
|
|
const urejanje = ref(false)
|
|
|
|
|
|
|
|
const urediPojem = async () => {
|
|
|
|
// Ustvari pad s tekstom pojma, ce se ne obstaja
|
|
|
|
const resp = await $fetch(`${etherpadApiUrl}/createPad?padID=${etherpadPrefix + revisionId.value}&text=` + pojem.value.tekst)
|
|
|
|
urejanje.value = true
|
|
|
|
}
|
|
|
|
|
2023-05-03 21:31:01 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<section class="pojem">
|
|
|
|
<h2>{{ pojem.naslov }}</h2>
|
|
|
|
<div class="tekst" v-html="pojem.tekst" />
|
2023-11-13 00:22:34 +01:00
|
|
|
<div class="gumb" @click="urediPojem">Uredi</div>
|
|
|
|
<div v-if="urejanje" class="pojem">
|
|
|
|
<PojemForm :revisionId="revisionId" />
|
|
|
|
</div>
|
2023-05-03 21:31:01 +02:00
|
|
|
</section>
|
|
|
|
</template>
|