fix on note delete, select first
This commit is contained in:
@@ -224,16 +224,9 @@ angular.module('app.frontend')
|
||||
if(confirm("Are you sure you want to delete this note?")) {
|
||||
this.remove()(this.note);
|
||||
this.showMenu = false;
|
||||
this.notifyDelete();
|
||||
}
|
||||
}
|
||||
|
||||
this.notifyDelete = function() {
|
||||
$timeout(function() {
|
||||
$rootScope.$broadcast("noteDeleted");
|
||||
}.bind(this), 500);
|
||||
}
|
||||
|
||||
this.clickedEditNote = function() {
|
||||
this.editorMode = 'edit';
|
||||
this.focusEditor(100);
|
||||
|
||||
@@ -153,6 +153,12 @@ angular.module('app.frontend')
|
||||
this.$apply(fn);
|
||||
};
|
||||
|
||||
$scope.notifyDelete = function() {
|
||||
$timeout(function() {
|
||||
$rootScope.$broadcast("noteDeleted");
|
||||
}.bind(this), 0);
|
||||
}
|
||||
|
||||
$scope.deleteNote = function(note) {
|
||||
|
||||
modelManager.setItemToBeDeleted(note);
|
||||
@@ -163,6 +169,7 @@ angular.module('app.frontend')
|
||||
|
||||
if(note.dummy) {
|
||||
modelManager.removeItemLocally(note);
|
||||
$scope.notifyDelete();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -170,8 +177,11 @@ angular.module('app.frontend')
|
||||
if(authManager.offline()) {
|
||||
// when deleting items while ofline, we need to explictly tell angular to refresh UI
|
||||
setTimeout(function () {
|
||||
$scope.notifyDelete();
|
||||
$scope.safeApply();
|
||||
}, 50);
|
||||
} else {
|
||||
$scope.notifyDelete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ angular.module('app.frontend')
|
||||
scope: {
|
||||
addNew: "&",
|
||||
selectionMade: "&",
|
||||
remove: "&",
|
||||
tag: "=",
|
||||
removeTag: "&"
|
||||
},
|
||||
|
||||
@@ -112,7 +112,7 @@ angular.module('app.frontend')
|
||||
}.bind(this))
|
||||
.catch(function(response){
|
||||
console.log("Registration error", response);
|
||||
callback(null);
|
||||
callback(response.data);
|
||||
})
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"tags" => "tags"}
|
||||
|
||||
%notes-section{"remove-tag" => "notesRemoveTag", "add-new" => "notesAddNew", "selection-made" => "notesSelectionMade",
|
||||
"tag" => "selectedTag", "remove" => "deleteNote"}
|
||||
"tag" => "selectedTag"}
|
||||
|
||||
%editor-section{"note" => "selectedNote", "remove" => "deleteNote", "save" => "saveNote", "update-tags" => "updateTagsForNote"}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user