Bye bye spot.js

This commit is contained in:
2026-04-25 23:55:11 +02:00
parent 7dc2b28c44
commit b339d6d068
13 changed files with 270 additions and 470 deletions

View File

@@ -10,10 +10,10 @@ import SpotButton from './spotButton.vue';
export default {
name: 'upload',
components: { SpotButton, SpotIcon },
inject: ['spot', 'lang', 'projects', 'consts', 'user'],
inject: ['api', 'lang', 'projects', 'consts', 'user'],
data() {
return {
project: this.projects[this.spot.vars('default_project_codename')],
project: this.projects.getDefaultProject(),
files: [],
logs: [],
progress: 0,
@@ -21,8 +21,6 @@ export default {
};
},
mounted() {
this.spot.addPage('upload', {});
if(!this.project.editable) {
this.logs = [this.lang.get('upload_mode_archived', [this.project.name])];
return;
@@ -87,7 +85,10 @@ export default {
event.target.value = '';
},
addComment(oFile) {
this.spot.get2('add_comment', {id: oFile.id, content: oFile.content})
this.api.get('add_comment', {
id: oFile.id,
content: oFile.content
})
.then((asData) => {this.logs.push(this.lang.get('media_comment_update', asData.filename));})
.catch((sMsgId) => {this.logs.push(this.lang.get(sMsgId));});
},
@@ -97,7 +98,11 @@ export default {
navigator.geolocation.getCurrentPosition(
(position) => {
this.logs.push('Sending position...');
this.spot.get2('add_position', {'latitude':position.coords.latitude, 'longitude':position.coords.longitude, 'timestamp':Math.round(position.timestamp / 1000)})
this.api.get('add_position', {
'latitude': position.coords.latitude,
'longitude': position.coords.longitude,
'timestamp': Math.round(position.timestamp / 1000)
})
.then((asData) => {this.logs.push(this.lang.get('success'));})
.catch((sMsgId) => {this.logs.push(this.lang.get(sMsgId));});
},
@@ -122,20 +127,20 @@ export default {
<div class="section progress" v-if="progress > 0">
<div class="bar" :style="{width:progress+'%'}"></div>
</div>
<div class="section comment" v-for="file in files">
<img class="thumb" :src="file.thumbnail" />
<div class="form">
<input class="content" name="content" type="text" v-model="file.content" />
<input class="id" name="id" type="hidden" :value="file.id" />
<div class="section comment" v-for="file in files">
<img class="thumb" :src="file.thumbnail" />
<div class="form">
<input class="content" name="content" type="text" v-model="file.content" />
<input class="id" name="id" type="hidden" :value="file.id" />
<SpotButton :classes="'save'" :icon="'save'" :text="lang.get('save')" @click="addComment(file)" />
</div>
</div>
</div>
</div>
<h1>{{ lang.get('upload_pos_title') }}</h1>
<div class="section location">
<SpotButton :icon="'message'" :text="lang.get('new_position')" @click="addPosition()" />
</div>
<div class="section logs" v-if="logs.length > 0">
<p class="log" v-for="log in logs">{{ log }}.</p>
</div>
</div>
<div class="section logs" v-if="logs.length > 0">
<p class="log" v-for="log in logs">{{ log }}.</p>
</div>
</div>
</template>