aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorArne Schauf <git@asw.io>2018-03-04 01:48:51 +0100
committerArne Schauf <git@asw.io>2018-03-04 01:48:51 +0100
commit0b40910284d40409c8d70eafea717382ba8461f3 (patch)
treefc22be0bcd308bbf6e4ab806bd3945920766b4c0 /src
parentc018fd90ee1c3f307fa45c337375df5d9e659735 (diff)
downloadparry-ui-0b40910284d40409c8d70eafea717382ba8461f3.tar.gz
parry-ui-0b40910284d40409c8d70eafea717382ba8461f3.zip
fix a few things
Diffstat (limited to 'src')
-rw-r--r--src/components/UploadVoter.vue2
-rw-r--r--src/pages/UploadCreate.vue10
-rw-r--r--src/pages/UploadDetail.vue41
-rw-r--r--src/pages/UploadList.vue33
4 files changed, 37 insertions, 49 deletions
diff --git a/src/components/UploadVoter.vue b/src/components/UploadVoter.vue
index 035aa11..65a5453 100644
--- a/src/components/UploadVoter.vue
+++ b/src/components/UploadVoter.vue
@@ -40,7 +40,7 @@
methods: {
vote (impact) {
let that = this
- this.$http.post(`/uploads/${this.upload._id}/vote`, {vote: {impact: impact}}).then(response => that.$emit('voted'))
+ this.$http.post(`/uploads/${this.upload._id}/vote`, {impact: impact}).then(response => that.$emit('voted'))
},
},
}
diff --git a/src/pages/UploadCreate.vue b/src/pages/UploadCreate.vue
index 53a6a36..e1d027d 100644
--- a/src/pages/UploadCreate.vue
+++ b/src/pages/UploadCreate.vue
@@ -225,12 +225,10 @@
return
}
let params = {
- upload: {
- title: this.title,
- description: this.description,
- files: this.files.map(el => el._id),
- pic: this.pic,
- },
+ title: this.title,
+ description: this.description,
+ files: this.files.map(el => el._id),
+ pic: this.pic,
}
this.$http.post('/uploads', params)
.then((response) => {
diff --git a/src/pages/UploadDetail.vue b/src/pages/UploadDetail.vue
index 53de013..b2042b6 100644
--- a/src/pages/UploadDetail.vue
+++ b/src/pages/UploadDetail.vue
@@ -95,7 +95,7 @@
</q-btn>
<div class="group"
v-else
- v-for="fid of upload.file"
+ v-for="fid of upload.files"
:key="fid._id">
<q-btn loader
no-caps
@@ -106,12 +106,12 @@
<span slot="loading">Downloading...</span>
</q-btn>
<span v-if="downloadProgresses[fid._id]">
- <q-transition enter="fadeIn" leave="fadeOut" mode="out-in">
+ <transition enter-active-class="animated fadeIn" leave-active-class="animated fadeOut" mode="out-in">
<span key="sizeDownloaded" v-if="downloadProgresses[fid._id].percentage < 100">
{{ downloadProgresses[fid._id].loaded|prettyBytes }} / {{ downloadProgresses[fid._id].total|prettyBytes }}
</span>
<span key="downloadDone" v-else><i class="fa fa-check fa-2x text-positive"></i></span>
- </q-transition>
+ </transition>
</span>
</div>
</q-card-main>
@@ -137,10 +137,7 @@
</template>
<script>
- import {
- Dialog,
- openURL,
- } from 'quasar'
+ import { openURL } from 'quasar'
import UploadVoter from 'components/UploadVoter'
import FileSaver from 'file-saver'
@@ -174,25 +171,25 @@
let that = this
this.$http.get(`/uploads/${this.routeId}`).then(response => {
that.upload = response.data
+ }).catch((error) => {
+ if (error.response.status === 404) {
+ that.$router.push({name: 'upload-list'})
+ }
})
},
- deleteUpload () {
+ deleteUpload (upload) {
let that = this
- Dialog.create({
+ this.$q.dialog({
title: 'Delete mod?',
- message: `Do you really want to delete the mod ${this.upload.title}?<br>This cannot be undone!`,
- buttons: [
- 'Cancel',
- {
- label: '<i class="fa fa-trash-o"></i> Yes, delete!',
- color: 'negative',
- outline: true,
- handler () {
- that.$http.delete(`/uploads/${that.routeId}`).then(response => that.$router.push({name: 'upload-list'}))
- }
- }
- ]
- })
+ message: `Do you really want to delete the mod "${upload.title}"? This cannot be undone!`,
+ ok: {
+ label: 'Yes, delete!',
+ icon: 'fa-trash',
+ color: 'negative',
+ outline: true,
+ },
+ cancel: 'Cancel',
+ }).then(() => that.$http.delete(`/uploads/${upload._id}`).then(response => that.refresh()))
},
downloadMedia (mediaId, filename, done) {
console.log({mediaId, done})
diff --git a/src/pages/UploadList.vue b/src/pages/UploadList.vue
index ee1723b..a37d8a1 100644
--- a/src/pages/UploadList.vue
+++ b/src/pages/UploadList.vue
@@ -25,10 +25,10 @@
<q-btn color="negative"
outline
small
- icon="fa-trash-o"
+ icon="fa-trash"
label="Delete"
- v-if="props.row.author.username === $store.state.user.decodedToken.username"
- @click="deleteUpload(cell.row)" />
+ v-if="$route.params.uploadId !== props.row._id && props.row.author.username === $store.state.user.decodedToken.username"
+ @click="deleteUpload(props.row)" />
</q-td>
<q-td slot='body-cell-voting' slot-scope="props" :props='props'>
{{ props.value.sum }} <i class="fa" :class="{'fa-caret-up text-positive': props.value.sum > 0, 'fa-caret-down text-negative': props.value.sum < 0, 'fa-sort text-dark': props.value.sum === 0}"></i>
@@ -39,9 +39,6 @@
</template>
<script>
- import {
- Dialog,
- } from 'quasar'
import moment from 'moment'
export default {
@@ -111,21 +108,17 @@
},
deleteUpload (upload) {
let that = this
- Dialog.create({
+ this.$q.dialog({
title: 'Delete mod?',
- message: `Do you really want to delete the mod ${upload.title}?<br>This cannot be undone!`,
- buttons: [
- 'Cancel',
- {
- label: '<i class="fa fa-trash-o"></i> Yes, delete!',
- color: 'negative',
- outline: true,
- handler () {
- that.$http.delete(`/uploads/${upload._id}`).then(response => that.refresh())
- }
- }
- ]
- })
+ message: `Do you really want to delete the mod "${upload.title}"? This cannot be undone!`,
+ ok: {
+ label: 'Yes, delete!',
+ icon: 'fa-trash',
+ color: 'negative',
+ outline: true,
+ },
+ cancel: 'Cancel',
+ }).then(() => that.$http.delete(`/uploads/${upload._id}`).then(response => that.refresh()))
},
},
}