Fix poster box

This commit is contained in:
2026-01-18 00:31:02 +01:00
parent 28f95162aa
commit 77216e6c2f
3 changed files with 33 additions and 11 deletions

View File

@@ -93,10 +93,7 @@ export default {
closeMarkerPopup: this.closeMarkerPopup, closeMarkerPopup: this.closeMarkerPopup,
isMarkerVisible: this.isMarkerVisible isMarkerVisible: this.isMarkerVisible
}, },
project: { project: this
...this.$data,
toggleFeedPanel: this.toggleFeedPanel
}
}; };
}, },
inject: ['spot', 'projects', 'user'], inject: ['spot', 'projects', 'user'],

View File

@@ -7,6 +7,7 @@
import { LngLat } from 'maplibre-gl'; import { LngLat } from 'maplibre-gl';
import autosize from 'autosize'; import autosize from 'autosize';
import { registerRuntimeCompiler } from 'vue';
export default { export default {
components: { components: {
@@ -28,7 +29,9 @@
anchorVisible: ['message', 'media', 'post'].includes(this.options.type), anchorVisible: ['message', 'media', 'post'].includes(this.options.type),
anchorTitle: this.spot.lang('copy_to_clipboard'), anchorTitle: this.spot.lang('copy_to_clipboard'),
anchorIcon: 'link', anchorIcon: 'link',
popupRequested: false popupRequested: false,
postMessage: '',
sending: false
}; };
}, },
computed: { computed: {
@@ -50,7 +53,7 @@
return '#'+[asHash.page, asHash.items[0], this.options.type, this.options.id].join(this.spot.consts.hash_sep); return '#'+[asHash.page, asHash.items[0], this.options.type, this.options.id].join(this.spot.consts.hash_sep);
}, },
modeHisto() { modeHisto() {
return (this.project.currProject.mode==this.spot.consts.modes.histo); return (this.project.currProject.mode == this.spot.consts.modes.histo);
}, },
relTime() { relTime() {
return this.modeHisto?(this.options.formatted_time || '').substr(0, 10):this.options.relative_time; return this.modeHisto?(this.options.formatted_time || '').substr(0, 10):this.options.relative_time;
@@ -60,7 +63,7 @@
} }
}, },
inject: ['spot', 'project', 'user', 'map', 'project'], inject: ['spot', 'project', 'user', 'map'],
methods: { methods: {
copyAnchor() { copyAnchor() {
copyTextToClipboard(this.spot.consts.server+this.spot.hash()); copyTextToClipboard(this.spot.consts.server+this.spot.hash());
@@ -86,6 +89,27 @@
closeMarkerPopup() { closeMarkerPopup() {
if(!this.popupRequested) this.map.closeMarkerPopup(); if(!this.popupRequested) this.map.closeMarkerPopup();
this.popupRequested = false; this.popupRequested = false;
},
send() {
if(this.postMessage != '' && this.user.name != '') {
this.sending = true;
this.spot.get2(
'add_post',
{
id_project: this.project.currProject.id,
name: this.user.name,
content: this.postMessage
}
)
.then(() => {
this.postMessage = '';
this.project.checkNewFeed();
this.sending = false;
})
.catch((sDesc) => {
this.sending = false;
});
}
} }
}, },
mounted() { mounted() {
@@ -144,9 +168,9 @@
</p> </p>
</div> </div>
<p v-else-if="options.type == 'poster'" class="message"> <p v-else-if="options.type == 'poster'" class="message">
<textarea ref="post" name="post" :placeholder="spot.lang('post_message')" class="autoExpand" rows="1" v-model="$parent.post"></textarea> <textarea ref="post" name="post" :placeholder="spot.lang('post_message')" class="autoExpand" rows="1" v-model="postMessage"></textarea>
<input type="text" name="name" :placeholder="spot.lang('post_name')" v-model="user.name" /> <input type="text" name="name" :placeholder="spot.lang('post_name')" v-model="user.name" />
<spotButton name="submit" :aria-label="spot.lang('send')" :title="spot.lang('send')" :icon="'send'" /> <spotButton name="submit" :aria-label="spot.lang('send')" :title="spot.lang('send')" :icon="'send'" @click="send()" :iconClasses="sending?'flicker':''" />
</p> </p>
<div v-else-if="options.type == 'archived'"> <div v-else-if="options.type == 'archived'">
<p><spotIcon :icon="'success'" /></p> <p><spotIcon :icon="'success'" /></p>

View File

@@ -8,10 +8,11 @@ export default {
props: { props: {
classes: String, classes: String,
text: String, text: String,
icon: String icon: String,
iconClasses: String
} }
} }
</script> </script>
<template> <template>
<button :class="classes"><SpotIcon :icon="icon" :text="text" /></button> <button :class="classes"><SpotIcon :icon="icon" :text="text" :classes="iconClasses" /></button>
</template> </template>