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

@@ -88,17 +88,11 @@ export default {
this.$router.push(`/event/${id}`)
},
async confirm (id) {
try {
this.loading = true
await this.$axios.$get(`/event/confirm/${id}`)
this.loading = false
this.$root.$message({
message: this.$t('event.confirmed'),
type: 'success'
})
this.unconfirmedEvents = this.unconfirmedEvents.filter(e => e.id !== id)
} catch (e) {
}
this.loading = true
await this.$axios.$get(`/event/confirm/${id}`)
this.loading = false
this.$root.$message('event.confirmed', { color: 'succes' })
this.unconfirmedEvents = this.unconfirmedEvents.filter(e => e.id !== id)
}
},
head () {

View File

@@ -65,7 +65,7 @@ export default {
this.loading = true
await this.$axios.$post('/user/recover', { email: this.email })
this.loading = false
this.$root.$message({ message: this.$t('login.check_email'), color: 'success' })
this.$root.$message('login.check_email', { color: 'success' })
},
async submit (e) {
e.preventDefault()
@@ -78,9 +78,9 @@ export default {
data.append('client_id', 'self')
await this.$auth.loginWith('local', { data })
this.loading = false
this.$root.$message({ message: this.$t('login.ok'), color: 'success' })
this.$root.$message('login.ok',{ color: 'success' })
} catch (e) {
this.$root.$message({ message: this.$t('login.error'), color: 'error' })
this.$root.$message('login.error',{ color: 'error' })
this.loading = false
return
}

View File

@@ -67,13 +67,11 @@ export default {
const user = await this.$axios.$post('/user/register', this.user)
// this is the first user registered
const first_user = user && user.is_admin && user.is_active
this.$root.$message({
message: first_user ? this.$t('register.first_user') : this.$t('register.complete')
})
this.$root.$message(first_user ? 'register.first_user': 'register.complete')
this.$router.replace('/')
} catch (e) {
const error = get(e, 'response.data.errors[0].message', String(e))
this.$root.$message({ message: this.$t(error), color: 'error' })
this.$root.$message(error, { color: 'error' })
}
this.loading = false
}

View File

@@ -25,10 +25,7 @@ export default {
methods: {
...mapActions(['setSetting']),
save () {
this.$root.$message({
type: 'success',
message: this.$t('common.done')
})
this.$root.$message('commmon.done', { color: 'success' })
this.setSetting({ key: 'about', value: this.about })
}
},

View File

@@ -447,15 +447,15 @@ export default {
this.updateMeta()
this.$router.replace('/')
this.loading = false
this.$root.$message({ type: 'success', message: this.$auth.loggedIn ? this.$t('event.added') : this.$t('event.added_anon') })
this.$root.$message(this.$auth.loggedIn ? 'event.added' : 'event.added_anon', { color: 'success' })
} catch (e) {
console.error(e.response)
switch (e.request.status) {
case 413:
this.$root.$message({ type: 'error', message: this.$t('event.image_too_big') })
this.$root.$message('event.image_too_big', { color: 'error' })
break
default:
this.$root.$message({ type: 'error', message: e.response.data })
this.$root.$message(e.response.data, { color: 'error' })
}
this.loading = false
}
@@ -477,26 +477,5 @@ export default {
.container {
max-width: 1400px;
}
/* #edit_page
i {
font-size: 1.3em;
}
#picker {
max-width: 600px;
}
#edit_page .el-form-item {
display: inline-flex;
}
.el-upload,
.el-upload-dragger {
overflow: hidden;
text-align: center;
margin: 0 auto;
max-width: 80%;
font-size: 2em;
} */
</style>

View File

@@ -243,22 +243,22 @@ export default {
},
async blockUser (resource) {
try {
const ret = await this.$root.$confirm(this.$t('common.confirm'), this.$t('admin.user_block_confirm', { user: resource.ap_user.ap_id }))
const ret = await this.$root.$confirm('admin.user_block_confirm', { user: resource.ap_user.ap_id })
if (!ret) { return }
await this.$axios.post('/instances/toggle_user_block', { ap_id: resource.ap_user.ap_id })
this.$root.$message({ message: this.$t('admin.user_blocked', { user: resource.ap_user.ap_id }), type: 'success' })
this.$root.$message('admin.user_blocked', { user: resource.ap_user.ap_id, color: 'success' })
} catch (e) { }
},
async deleteResource (resource) {
try {
const ret = await this.$root.$confirm(this.$t('common.confirm'), this.$t('admin.delete_resource_confirm'))
const ret = await this.$root.$confirm('admin.delete_resource_confirm')
if (!ret) { return }
await this.$axios.delete(`/resources/${resource.id}`)
this.event.resources = this.event.resources.filter(r => r.id !== resource.id)
} catch (e) { }
},
copyLink () {
this.$root.$message({ message: this.$t('common.copied'), type: 'success' })
this.$root.$message('common.copied', { color: 'success' })
},
// TOFIX
resource_filter (value) {
@@ -285,163 +285,5 @@ export default {
margin: 0 auto;
max-height: 83vh;
}
}
// time {
// margin: 0rem 0rem 0rem 1rem;
// display: inline-block;
// }
// #arrow {
// position: absolute;
// top: 1em;
// right: 1em;
// }
// .el-header {
// height: auto !important;
// position: sticky;
// padding-top: .4em;
// top: 0px;
// border-bottom: 1px solid lightgray;
// z-index: 1;
// overflow: hidden;
// }
// .embedDialog {
// .el-dialog {
// min-height: 500px;
// max-width: 1000px;
// width: 100%;
// }
// }
// .followDialog {
// .el-dialog {
// min-height: 300px;
// max-width: 600px;
// width: 100%;
// .el-dialog__body {
// word-break: normal !important;
// }
// }
// }
// .head {
// z-index: 1;
// position: sticky;
// top: 0px;
// padding-top: 10px;
// padding-bottom: 10px;
// background-color: white;
// border-bottom: 1px solid #e6e6e6;
// }
// .menu {
// border-right: none;
// background-color: transparent;
// }
// div.menu {
// border-left: 1px solid #e6e6e6;
// p {
// margin: 1rem 0rem 1rem 1rem;
// }
// }
// .title {
// display: table-cell;
// padding-right: 70px;
// height: 2.1em;
// font-size: 1.6rem;
// color: #404246;
// line-height: 1;
// vertical-align: middle;
// }
// pre {
// white-space: pre-line;
// word-break: break-word;
// font-size: 1em;
// font-family: inherit;
// p:empty {
// min-height: 1em;
// }
// // font-family: BlinkMacSystemFont, -apple-system, Segoe UI, Roboto, Oxygen,
// // Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, Helvetica, Arial,
// // sans-serif !important;
// }
// .main_image {
// width: 100%;
// transition: height .100s;
// height: auto;
// img {
// // object-fit: contain;
// margin: 0 auto;
// max-height: 88vh;
// }
// .loading {
// display: flex;
// justify-content: center;
// align-items: center;
// font-size: 30px;
// margin: 0 auto;
// height: 100px;
// }
// }
// #resources {
// img {
// max-width: 100%;
// }
// .card-header {
// border-left: 3px solid transparent;
// }
// .card-header:hover {
// border-left: 3px solid #888;
// }
// .invisible {
// visibility: visible !important;
// }
// .disabled {
// opacity: 0.5;
// }
// .previewImage {
// display: flex;
// flex-flow: wrap;
// justify-content: space-evenly;
// img {
// margin-left: 5px;
// margin-top: 5px;
// object-fit: cover;
// min-height: 100px;
// max-width: 45%;
// border-radius: 5px;
// border: 1px solid #ccc;
// }
// }
// }
// .nextprev {
// font-size: 10px;
// margin-bottom: 5px;
// }
// }
// @media only screen and (max-width: 768px) {
// #eventDetail {
// .menu {
// border: 0px !important;
// }
// .title {
// // font-size: 1.1em;
// line-height: 1.4em;
// color: black;
// }
// }
// }
</style>

View File

@@ -28,7 +28,7 @@ export default {
},
methods: {
copyLink () {
this.$root.$message({ message: this.$t('common.copied'), type: 'success' })
this.$root.$message('common.copied', { color: 'success' })
}
}
}

View File

@@ -129,8 +129,7 @@ export default {
},
methods: {
copyLink () {
// Message({ message: this.$t('common.copied'), type: 'success', showClose: true })
this.$root.$message({ message: this.$t('common.feed_url_copied') })
this.$root.$message('common.feed_url_copied')
},
add_notification () {
if (!this.notification.email) {

View File

@@ -38,15 +38,10 @@ export default {
async change_password () {
try {
await this.$axios.$post('/user/recover_password', { recover_code: this.code, password: this.new_password })
this.$root.$message({
message: this.$t('common.password_updated')
})
this.$root.$message('common.password_updated')
this.$router.replace('/login')
} catch (e) {
this.$root.$message({
type: 'warning',
message: e
})
this.$root.$message(e, { color: 'warning' })
}
}
},

View File

@@ -34,16 +34,10 @@ export default {
async change_password () {
try {
await this.$axios.$post('/user/recover_password', { recover_code: this.code, password: this.new_password })
this.$root.$message({
type: 'success',
message: this.$t('common.password_updated')
})
this.$root.$message('common.password_updated', { color: 'success' })
this.$router.replace('/login')
} catch (e) {
this.$root.$message({
type: 'warning',
message: e
})
this.$root.$message(e, { color: 'warning' })
}
}
}

View File

@@ -33,16 +33,10 @@ export default {
async change_password () {
try {
await this.$axios.$post('/user/recover_password', { recover_code: this.code, password: this.new_password })
this.$root.$message({
type: 'success',
message: this.$t('common.password_updated')
})
this.$root.$message('common.password_updated', { color: 'succes' })
this.$router.replace('/login')
} catch (e) {
this.$root.$message({
type: 'warning',
message: e
})
this.$root.$message(e, { color: 'warning' })
}
}
}