cleaning message/confirm usage
This commit is contained in:
@@ -61,10 +61,10 @@ export default {
|
||||
this.$root.$confirm = this.open
|
||||
},
|
||||
methods: {
|
||||
open (title, message, options) {
|
||||
open (message, options) {
|
||||
this.dialog = true
|
||||
this.title = title
|
||||
this.message = message
|
||||
this.title = option.title || 'Confirm'
|
||||
this.message = this.$t(message, options)
|
||||
this.options = Object.assign(this.options, options)
|
||||
return new Promise((resolve, reject) => {
|
||||
this.resolve = resolve
|
||||
|
||||
@@ -98,14 +98,10 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
copyLink () {
|
||||
this.$root.$message({
|
||||
message: this.$t('common.feed_url_copied')
|
||||
})
|
||||
this.$root.$message('common.feed_url_copied')
|
||||
},
|
||||
logout () {
|
||||
this.$root.$message({
|
||||
message: this.$t('common.logout_ok')
|
||||
})
|
||||
this.$root.$message('common.logout_ok')
|
||||
this.$auth.logout()
|
||||
},
|
||||
async createTrustedInstance () {
|
||||
@@ -123,11 +119,7 @@ export default {
|
||||
}
|
||||
this.setSetting({ key: 'trusted_instances', value: this.settings.trusted_instances.concat(trusted_instance) })
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
this.$root.$message({
|
||||
type: 'error',
|
||||
message: e
|
||||
})
|
||||
this.$root.$message(e, { color: 'error' })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,10 +29,11 @@ export default {
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.$root.$message = snackbar => {
|
||||
this.$root.$message = (message, opts) => {
|
||||
this.active = true
|
||||
this.message = snackbar.message
|
||||
this.color = snackbar.color || 'primary'
|
||||
this.message = this.$t(message, opts)
|
||||
this.color = opts.color || 'primary'
|
||||
this.icon = opts.icon || 'md-alert'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
},
|
||||
|
||||
@@ -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')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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' })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user