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,
isMarkerVisible: this.isMarkerVisible
},
project: {
...this.$data,
toggleFeedPanel: this.toggleFeedPanel
}
project: this
};
},
inject: ['spot', 'projects', 'user'],

View File

@@ -7,6 +7,7 @@
import { LngLat } from 'maplibre-gl';
import autosize from 'autosize';
import { registerRuntimeCompiler } from 'vue';
export default {
components: {
@@ -28,7 +29,9 @@
anchorVisible: ['message', 'media', 'post'].includes(this.options.type),
anchorTitle: this.spot.lang('copy_to_clipboard'),
anchorIcon: 'link',
popupRequested: false
popupRequested: false,
postMessage: '',
sending: false
};
},
computed: {
@@ -50,7 +53,7 @@
return '#'+[asHash.page, asHash.items[0], this.options.type, this.options.id].join(this.spot.consts.hash_sep);
},
modeHisto() {
return (this.project.currProject.mode==this.spot.consts.modes.histo);
return (this.project.currProject.mode == this.spot.consts.modes.histo);
},
relTime() {
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: {
copyAnchor() {
copyTextToClipboard(this.spot.consts.server+this.spot.hash());
@@ -86,6 +89,27 @@
closeMarkerPopup() {
if(!this.popupRequested) this.map.closeMarkerPopup();
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() {
@@ -144,9 +168,9 @@
</p>
</div>
<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" />
<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>
<div v-else-if="options.type == 'archived'">
<p><spotIcon :icon="'success'" /></p>

View File

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