mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 06:55:46 +01:00
feat: add confirmation modal to topic event deletion
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
"delete": "Delete",
|
"delete": "Delete",
|
||||||
"delete-event": "Delete Event",
|
"delete-event": "Delete Event",
|
||||||
|
"delete-event-confirm": "Are you sure you want to delete this event?",
|
||||||
"purge": "Purge",
|
"purge": "Purge",
|
||||||
"restore": "Restore",
|
"restore": "Restore",
|
||||||
"move": "Move",
|
"move": "Move",
|
||||||
|
|||||||
@@ -53,12 +53,15 @@ define('forum/topic/threadTools', [
|
|||||||
topicContainer.on('click', '[component="topic/event/delete"]', function () {
|
topicContainer.on('click', '[component="topic/event/delete"]', function () {
|
||||||
const eventId = $(this).attr('data-topic-event-id');
|
const eventId = $(this).attr('data-topic-event-id');
|
||||||
const eventEl = $(this).parents('[component="topic/event"]');
|
const eventEl = $(this).parents('[component="topic/event"]');
|
||||||
|
bootbox.confirm('[[topic:delete-event-confirm]]', (ok) => {
|
||||||
|
if (ok) {
|
||||||
api.del(`/topics/${tid}/events/${eventId}`, {})
|
api.del(`/topics/${tid}/events/${eventId}`, {})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
eventEl.remove();
|
eventEl.remove();
|
||||||
})
|
})
|
||||||
.catch(app.alertError);
|
.catch(app.alertError);
|
||||||
return false;
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
// todo: should also use topicCommand, but no write api call exists for this yet
|
// todo: should also use topicCommand, but no write api call exists for this yet
|
||||||
|
|||||||
Reference in New Issue
Block a user