mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-12-01 07:37:18 +01:00
Renders entire template when add the first note or delete the last
This commit is contained in:
@@ -299,10 +299,14 @@ View.prototype = {
|
||||
|
||||
self._notes.load(id);
|
||||
self._notes.removeActive().done(function () {
|
||||
if (self._notes.length == 0) {
|
||||
$(".notes-grid").isotope('remove', note.parent())
|
||||
.isotope('layout');
|
||||
self.showAll();
|
||||
self.renderNavigation();
|
||||
} else {
|
||||
self.render();
|
||||
}
|
||||
}).fail(function () {
|
||||
alert('Could not delete note, not found');
|
||||
});
|
||||
@@ -384,6 +388,7 @@ View.prototype = {
|
||||
};
|
||||
|
||||
self._notes.create(note).done(function() {
|
||||
if (self._notes.length > 1) {
|
||||
note = self._notes.getActive();
|
||||
var $notehtml = $("<div class=\"note-grid-item\">" +
|
||||
"<div class=\"quicknote noselect\" style=\"background-color:" + note.color + "\" data-id=\"" + note.id + "\">" +
|
||||
@@ -396,6 +401,10 @@ View.prototype = {
|
||||
.isotope( 'prepended', $notehtml);
|
||||
self._notes.unsetActive();
|
||||
self.renderNavigation();
|
||||
} else {
|
||||
self._notes.unsetActive();
|
||||
self.render();
|
||||
}
|
||||
}).fail(function () {
|
||||
alert('Could not create note');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user