WII.. Finally add a confirmation before deleting a note.

This commit is contained in:
Matias De lellis
2019-02-12 15:08:03 -03:00
parent a69071d00a
commit 2245c7f00f

View File

@@ -359,6 +359,11 @@ View.prototype = {
event.stopPropagation(); event.stopPropagation();
self._notes.load(id); self._notes.load(id);
OC.dialogs.confirm(
t('quicknotes', 'Are you sure you want to delete the note?'),
t('quicknotes', 'Delete note'),
function(result) {
if (result) {
self._notes.removeActive().done(function () { self._notes.removeActive().done(function () {
if (self._notes.length() > 0) { if (self._notes.length() > 0) {
$(".notes-grid").isotope('remove', note.parent()) $(".notes-grid").isotope('remove', note.parent())
@@ -371,6 +376,10 @@ View.prototype = {
}).fail(function () { }).fail(function () {
alert('Could not delete note, not found'); alert('Could not delete note, not found');
}); });
}
},
true
);
}); });
/* /*
@@ -595,12 +604,20 @@ View.prototype = {
$('#app-navigation .note .delete').click(function () { $('#app-navigation .note .delete').click(function () {
var entry = $(this).closest('.note'); var entry = $(this).closest('.note');
entry.find('.app-navigation-entry-menu').removeClass('open'); entry.find('.app-navigation-entry-menu').removeClass('open');
OC.dialogs.confirm(
t('quicknotes', 'Are you sure you want to delete the note?'),
t('quicknotes', 'Delete note'),
function(result) {
if (result) {
self._notes.removeActive().done(function () { self._notes.removeActive().done(function () {
self.render(); self.render();
}).fail(function () { }).fail(function () {
alert('Could not delete note, not found'); alert('Could not delete note, not found');
}); });
}
},
true
);
}); });
// show a note // show a note