cleaning message/confirm usage

This commit is contained in:
les
2020-10-07 11:12:13 +02:00
parent a67751928c
commit 3616eeefe5
20 changed files with 53 additions and 287 deletions

View File

@@ -2,7 +2,7 @@
v-container
v-card-title {{$t('common.announcements')}}
v-card-subtitle(v-html="$t('admin.announcement_description')")
v-dialog(v-model='dialog' width='800')
v-dialog(v-model='dialog' width='800px')
v-card
v-card-title {{$t('admin.new_announcement')}}
v-card-text
@@ -72,18 +72,12 @@ export default {
this.setAnnouncements(cloneDeep(this.announcements.filter(a => a.visible)))
} catch (e) {}
},
remove (announcement) {
this.$root.$confirm(this.$t('admin.delete_announcement_confirm'),
this.$t('common.confirm'), {
confirmButtonText: this.$t('common.ok'),
cancelButtonText: this.$t('common.cancel'),
type: 'error'
})
.then(() => this.$axios.delete(`/announcements/${announcement.id}`))
async remove (announcement) {
const ret = await this.$root.$confirm('admin.delete_announcement_confirm')
if (!ret) return
this.$axios.delete(`/announcements/${announcement.id}`)
.then(() => {
this.$root.$message({
message: this.$t('admin.announcement_remove_ok')
})
this.$root.$message('admin.announcement_remove_ok')
this.announcements = this.announcements.filter(a => a.id !== announcement.id)
})
},

View File

@@ -45,13 +45,10 @@ export default {
} catch (e) {}
},
async remove (event) {
const ret = await this.$root.$confirm(this.$t('common.confirm'),
this.$t('event.remove_confirmation'))
const ret = await this.$root.$confirm('event.remove_confirmation')
if (!ret) { return }
await this.$axios.delete(`/event/${event.id}`)
this.$root.$message({
message: this.$t('admin.event_remove_ok')
})
this.$root.$message('admin.event_remove_ok')
}
}
}

View File

@@ -124,15 +124,11 @@ export default {
})
this.instance_url = ''
} catch (e) {
this.$root.$message({
type: 'error',
message: e
})
this.$root.$message(e, { color: 'error' })
}
},
async deleteInstance (instance) {
const ret = await this.$root.$confirm(this.$t('common.confirm'),
this.$t('admin.delete_trusted_instance_confirm'))
const ret = await this.$root.$confirm('admin.delete_trusted_instance_confirm')
if (!ret) { return }
this.setSetting({
key: 'trusted_instances',

View File

@@ -67,10 +67,10 @@ export default {
computed: mapState(['settings']),
methods: {
async deleteUser (user) {
const ret = await this.$root.$confirm(this.$t('common.confirm'), this.$t('admin.delete_user_confirm'))
const ret = await this.$root.$confirm('admin.delete_user_confirm')
if (!ret) { return }
await this.$axios.delete(`/user/${user.id}`)
this.$root.$message({ message: this.$t('admin.user_remove_ok') })
this.$root.$message('admin.user_remove_ok')
this.users_ = this.users_.filter(u => u.id !== user.id)
},
toggle (user) {
@@ -90,16 +90,10 @@ export default {
const user = await this.$axios.$post('/user', this.new_user)
this.new_user = { email: '', is_admin: false }
this.$root.$message({
type: 'success',
message: this.$t('admin.user_create_ok')
})
this.$root.$message('admin.user_create_ok', { color: 'success'})
this.users_.push(user)
} catch (e) {
this.$root.$message({
type: 'error',
message: this.$t(e)
})
this.$root.$message(e, { color: 'error' })
}
}
}