Compare commits

..

No commits in common. "0b6045f18167c6b3e26cbae1f1a9fb569ef7a1c0" and "16763e3d6942c92224cb8d8120593e5d27dbdf25" have entirely different histories.

16 changed files with 42 additions and 68 deletions

View File

@ -5,10 +5,11 @@ session:
url: url:
source: path_prefix source: path_prefix
prefixes: prefixes:
en: en en: ''
sl: sl sl: sl
hr: hr hr: hr
sr: sr sr: sr
'': null
domains: domains:
en: '' en: ''
sl: '' sl: ''

View File

@ -1,19 +1,12 @@
<script setup="setup"> <script setup="setup">
const store = useNastavitveStore()
const { $i18n } = useNuxtApp() const { izbraniJezik } = storeToRefs(store)
const nastavitveStore = useNastavitveStore()
const { izbraniJezik } = storeToRefs(nastavitveStore)
// Nastavi locale ko se jezik spremeni // Nastavi locale ko se jezik spremeni
watch(izbraniJezik, jezik => { watch(izbraniJezik, jezik => {
$i18n.setLocale(jezik) console.log('nov jezik', jezik)
useNuxtApp().$i18n.setLocale(jezik)
}) })
// V store nastavi prvotno stanje
nastavitveStore.izberiJezik($i18n.locale.value)
</script> </script>
<template> <template>

View File

@ -6,7 +6,6 @@ const { etherFetch } = useEtherpadApi()
const { poskrolaj } = useUi() const { poskrolaj } = useUi()
const store = usePojmiStore() const store = usePojmiStore()
const nastavitveStore = useNastavitveStore()
const route = useRoute() const route = useRoute()
const props = defineProps({ const props = defineProps({
@ -17,11 +16,6 @@ if (props.naslov && !(props.naslov in store.pojmi)) {
await store.naloziPojme() await store.naloziPojme()
} }
const { izbraniJezik } = storeToRefs(nastavitveStore)
watch(izbraniJezik, jezik => {
store.naloziPojme(jezik)
})
const pojem = computed(() => store.pojmi[props.naslov]) const pojem = computed(() => store.pojmi[props.naslov])
const revisionId = computed(() => pojem.value ? pojem.value.id : null) const revisionId = computed(() => pojem.value ? pojem.value.id : null)

View File

@ -1,18 +1,9 @@
import jsonapi from 'jsonapi-serializer' import jsonapi from 'jsonapi-serializer'
function idmap(arr, idattr = 'id') {
if (!arr) { return {} }
return arr.reduce((vse, i) => {
const id = i[idattr]
vse[id] = i
return vse
}, {})
}
export const useApi = () => { export const useApi = () => {
const { baseUrl, jsonapiPath } = useRuntimeConfig().public const { baseUrl, jsonapiPath } = useRuntimeConfig().public
const apiBaseUrl = `${baseUrl}${jsonapiPath}`
const headers = { const headers = {
'Content-Type': 'application/vnd.api+json' 'Content-Type': 'application/vnd.api+json'
} }
@ -25,18 +16,20 @@ export const useApi = () => {
return idmap(ds.map(mapfun), idAttr) return idmap(ds.map(mapfun), idAttr)
} }
const jsonApiUrl = jezik => {
if (!jezik) {
jezik = 'sl'
}
return `${baseUrl}/${jezik}${jsonapiPath}`
}
return { return {
baseUrl: baseUrl, baseUrl: baseUrl,
jsonApiUrl, jsonApiUrl: apiBaseUrl,
headers, headers,
deserialize deserialize
} }
} }
export const idmap = (arr, idattr = 'id') => {
if (!arr) { return {} }
return arr.reduce((vse, i) => {
const id = i[idattr]
vse[id] = i
return vse
}, {})
}

View File

@ -0,0 +1,4 @@
{
"domov": "home",
"jugofuturizem": "yugofuturism"
}

View File

@ -1,7 +1,4 @@
{ {
"domov": "home", "domov": "home",
"jugofuturizem": "yugofuturism", "jugofuturizem": "yugofuturism"
"Nazaj": "Back",
"Vsak lahko prispeva k vsebinam manifesta. Predlaga lahko nov pojem ali ureja, dopolni ali predela obstoječe.": "Anyone can add content to the manifesto. You can suggest a new concept or edit, amend or adjust an existing one.",
"Dodaj nov pojem": "Add new concept"
} }

View File

@ -58,8 +58,8 @@ export default defineNuxtConfig({
}, },
i18n: { i18n: {
locales: [{ locales: [{
code: 'sl', code: 'si',
file: 'sl.json' file: 'si.json'
}, { }, {
code: 'en', code: 'en',
file: 'en.json' file: 'en.json'
@ -68,7 +68,7 @@ export default defineNuxtConfig({
file: 'hr.json' file: 'hr.json'
}], }],
langDir: 'lang', langDir: 'lang',
defaultLocale: 'sl', defaultLocale: 'si',
fallbackLocale: 'sl' fallbackLocale: 'si'
} }
}) })

View File

@ -1,20 +1,12 @@
<script setup="setup"> <script setup="setup">
const store = useStraniStore() const store = useStraniStore()
const nastavitveStore = useNastavitveStore()
const { izbraniJezik } = storeToRefs(nastavitveStore)
const stran = computed(() => store.strani['YuFu']) const stran = computed(() => store.strani['YuFu'])
useHead({meta: [{title: "jugofuturizem"}]}) useHead({meta: [{title: "jugofuturizem"}]})
await store.naloziStrani() await store.naloziStrani()
watch(izbraniJezik, jezik => {
store.naloziStrani(jezik)
})
</script> </script>
<template> <template>
<section v-if="stran" class="stran" v-html="stran.tekst" /> <section class="stran" v-html="stran.tekst" />
</template> </template>

View File

@ -31,7 +31,7 @@ onMounted(() => {
<PojemForm <PojemForm
:pojem="{ nov: true }" :pojem="{ nov: true }"
:revisionId="revisionId" :revisionId="revisionId"
:zapriLabel="$t('Nazaj')" zapriLabel="Nazaj"
:onZapri="onZapri" /> :onZapri="onZapri" />
</section> </section>
</template> </template>

View File

@ -17,9 +17,9 @@ onMounted(() => {
</script> </script>
<template> <template>
<h3 class="navodila" ref="navodila">{{ $t('Vsak lahko prispeva k vsebinam manifesta. Predlaga lahko nov pojem ali ureja, dopolni ali predela obstoječe.') }}</h3> <h3 class="navodila" ref="navodila">Vsak lahko prispeva k vsebinam manifesta. Predlaga lahko nov pojem ali ureja, dopolni ali predela obstoječe.</h3>
<NuxtLink class="gumb" to="/manifest/dodaj"> <NuxtLink class="gumb" to="/manifest/dodaj">
{{ $t('Dodaj nov pojem') }} Dodaj Nov Pojem
</NuxtLink> </NuxtLink>
<NuxtLink <NuxtLink
v-for="pojem in Object.keys(store.pojmi)" v-for="pojem in Object.keys(store.pojmi)"

View File

Before

Width:  |  Height:  |  Size: 514 B

After

Width:  |  Height:  |  Size: 514 B

View File

@ -1,8 +1,8 @@
export const useNastavitveStore = defineStore('nastavitve', { export const useNastavitveStore = defineStore('nastavitve', {
state: () => ({ state: () => ({
izbraniJezik: 'sl', izbraniJezik: 'hr',
mozniJeziki: { mozniJeziki: {
sl: 'Slovensko', si: 'Slovensko',
hr: 'Hrvatski', hr: 'Hrvatski',
en: 'English' en: 'English'
} }
@ -11,6 +11,8 @@ export const useNastavitveStore = defineStore('nastavitve', {
izberiJezik(jezik) { izberiJezik(jezik) {
if (Object.keys(this.mozniJeziki).indexOf(jezik) >= 0) { if (Object.keys(this.mozniJeziki).indexOf(jezik) >= 0) {
this.izbraniJezik = jezik this.izbraniJezik = jezik
console.log(useNuxtApp().$i18n.availableLocales)
//useNuxtApp().$i18n.setLocale(jezik)
} }
} }
} }

View File

@ -3,10 +3,10 @@ export const usePojmiStore = defineStore('pojmi', {
pojmi: {} pojmi: {}
}), }),
actions: { actions: {
async naloziPojme(jezik) { async naloziPojme() {
const { jsonApiUrl, headers, deserialize } = useApi() const { jsonApiUrl, headers, deserialize } = useApi()
const data = await $fetch(`${jsonApiUrl(jezik)}/node/concept?sort=-changed`, { headers }) const data = await $fetch(`${jsonApiUrl}/node/concept?sort=-changed`, { headers })
this.pojmi = await deserialize(data, s => ({ this.pojmi = await deserialize(data, s => ({
id: s.id, id: s.id,
naslov: s.title, naslov: s.title,

View File

@ -3,10 +3,10 @@ export const useStraniStore = defineStore('strani', {
strani: {} strani: {}
}), }),
actions: { actions: {
async naloziStrani (jezik) { async naloziStrani () {
const { jsonApiUrl, headers, deserialize } = useApi() const { jsonApiUrl, headers, deserialize } = useApi()
const data = await $fetch(`${jsonApiUrl(jezik)}/node/page`, { headers }) const data = await $fetch(`${jsonApiUrl}/node/page`, { headers })
this.strani = await deserialize(data, s => ({ this.strani = await deserialize(data, s => ({
id: s.id, id: s.id,
naslov: s.title, naslov: s.title,

View File

@ -206,16 +206,14 @@ parameters:
# for more information about the topic in general. # for more information about the topic in general.
# Note: By default the configuration is disabled. # Note: By default the configuration is disabled.
cors.config: cors.config:
enabled: false enabled: true
# Specify allowed headers, like 'x-allowed-header'. # Specify allowed headers, like 'x-allowed-header'.
allowedHeaders: [] allowedHeaders: []
# Specify allowed request methods, specify ['*'] to allow all possible ones. # Specify allowed request methods, specify ['*'] to allow all possible ones.
allowedMethods: [] allowedMethods: []
# Configure requests allowed from specific origins. Do not include trailing # Configure requests allowed from specific origins. Do not include trailing
# slashes with URLs. # slashes with URLs.
allowedOrigins: ['*'] allowedOrigins: ['yufu.kompot.si', 'localhost']
# Configure requests allowed from origins, matching against regex patterns.
allowedOriginsPatterns: []
# Sets the Access-Control-Expose-Headers header. # Sets the Access-Control-Expose-Headers header.
exposedHeaders: false exposedHeaders: false
# Sets the Access-Control-Max-Age header. # Sets the Access-Control-Max-Age header.