mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-29 13:36:13 +00:00
notification: fix widget toggle read status
This commit is contained in:
parent
9ddfd194be
commit
1576507f7e
@ -1,7 +1,11 @@
|
|||||||
import {createApp} from "vue";
|
import {createApp} from "vue";
|
||||||
import NotificationReadToggle from "ChillMainAssets/vuejs/_components/Notification/NotificationReadToggle.vue";
|
import NotificationReadToggle from "ChillMainAssets/vuejs/_components/Notification/NotificationReadToggle.vue";
|
||||||
|
|
||||||
const App = {
|
window.addEventListener('DOMContentLoaded', function (e) {
|
||||||
|
document.querySelectorAll('.notification_toggle_read_status')
|
||||||
|
.forEach(function (el) {
|
||||||
|
console.log('app', el);
|
||||||
|
const App = {
|
||||||
template: '<notification-read-toggle ' +
|
template: '<notification-read-toggle ' +
|
||||||
':notificationId="notificationId" ' +
|
':notificationId="notificationId" ' +
|
||||||
':isRead="isRead"' +
|
':isRead="isRead"' +
|
||||||
@ -10,29 +14,22 @@ const App = {
|
|||||||
components: {
|
components: {
|
||||||
NotificationReadToggle,
|
NotificationReadToggle,
|
||||||
},
|
},
|
||||||
methods: {
|
|
||||||
onMarkRead() {
|
|
||||||
this.isRead = true;
|
|
||||||
},
|
|
||||||
onMarkUnread() {
|
|
||||||
this.isRead = false;
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', function (e) {
|
|
||||||
document.querySelectorAll('.notification_toggle_read_status')
|
|
||||||
.forEach(function (app) {
|
|
||||||
console.log('app', app);
|
|
||||||
const myApp = Object.assign(App, {
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
notificationId: +app.dataset.notificationId,
|
notificationId: +el.dataset.notificationId,
|
||||||
isRead: 1 === +app.dataset.notificationCurrentIsRead,
|
isRead: 1 === +el.dataset.notificationCurrentIsRead,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onMarkRead() {
|
||||||
|
this.isRead = false;
|
||||||
|
},
|
||||||
|
onMarkUnread() {
|
||||||
|
this.isRead = true;
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
|
|
||||||
createApp(myApp).mount(app);
|
createApp(App).mount(el);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -23,14 +23,12 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
markAsUnread() {
|
markAsUnread() {
|
||||||
makeFetch('POST', `/api/1.0/main/notification/${this.notificationId}/mark/unread`, []).then(response => {
|
makeFetch('POST', `/api/1.0/main/notification/${this.notificationId}/mark/unread`, []).then(response => {
|
||||||
console.log('marked as unread', this.notificationId);
|
|
||||||
this.$emit('markRead', { notificationId: this.notificationId });
|
this.$emit('markRead', { notificationId: this.notificationId });
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
markAsRead() {
|
markAsRead() {
|
||||||
makeFetch('POST', `/api/1.0/main/notification/${this.notificationId}/mark/read`, []).then(response => {
|
makeFetch('POST', `/api/1.0/main/notification/${this.notificationId}/mark/read`, []).then(response => {
|
||||||
console.log('marked as read', this.notificationId);
|
this.$emit('markUnread', { notificationId: this.notificationId });
|
||||||
this.$emit('markRead', { notificationId: this.notificationId });
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user