diff --git a/src/components/project.vue b/src/components/project.vue index 6e98b58..0151b18 100644 --- a/src/components/project.vue +++ b/src/components/project.vue @@ -93,10 +93,7 @@ export default { closeMarkerPopup: this.closeMarkerPopup, isMarkerVisible: this.isMarkerVisible }, - project: { - ...this.$data, - toggleFeedPanel: this.toggleFeedPanel - } + project: this }; }, inject: ['spot', 'projects', 'user'], diff --git a/src/components/projectPost.vue b/src/components/projectPost.vue index 7b88798..e2a22b0 100644 --- a/src/components/projectPost.vue +++ b/src/components/projectPost.vue @@ -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 @@

- + - +

diff --git a/src/components/spotButton.vue b/src/components/spotButton.vue index 7842893..04cb57f 100644 --- a/src/components/spotButton.vue +++ b/src/components/spotButton.vue @@ -8,10 +8,11 @@ export default { props: { classes: String, text: String, - icon: String + icon: String, + iconClasses: String } } \ No newline at end of file