Tags menu
This commit is contained in:
@@ -46,6 +46,10 @@ angular.module('app.frontend')
|
||||
}
|
||||
}.bind(this), false);
|
||||
|
||||
$rootScope.$on("tag-changed", function(){
|
||||
this.loadTagsString();
|
||||
}.bind(this));
|
||||
|
||||
this.setNote = function(note, oldNote) {
|
||||
var currentEditor = this.customEditor;
|
||||
this.customEditor = null;
|
||||
|
||||
@@ -91,18 +91,19 @@ angular.module('app.frontend')
|
||||
|
||||
$scope.tagsSave = function(tag, callback) {
|
||||
if(!tag.title || tag.title.length == 0) {
|
||||
$scope.notesRemoveTag(tag);
|
||||
$scope.removeTag(tag);
|
||||
return;
|
||||
}
|
||||
tag.setDirty(true);
|
||||
syncManager.sync(callback);
|
||||
$rootScope.$broadcast("tag-changed");
|
||||
}
|
||||
|
||||
/*
|
||||
Notes Ctrl Callbacks
|
||||
*/
|
||||
|
||||
$scope.notesRemoveTag = function(tag) {
|
||||
$scope.removeTag = function(tag) {
|
||||
var validNotes = Note.filterDummyNotes(tag.notes);
|
||||
if(validNotes == 0) {
|
||||
modelManager.setItemToBeDeleted(tag);
|
||||
|
||||
@@ -4,8 +4,7 @@ angular.module('app.frontend')
|
||||
scope: {
|
||||
addNew: "&",
|
||||
selectionMade: "&",
|
||||
tag: "=",
|
||||
removeTag: "&"
|
||||
tag: "="
|
||||
},
|
||||
|
||||
templateUrl: 'frontend/notes.html',
|
||||
@@ -69,11 +68,6 @@ angular.module('app.frontend')
|
||||
this.selectFirstNote(createNew);
|
||||
}
|
||||
|
||||
this.selectedTagDelete = function() {
|
||||
this.showMenu = false;
|
||||
this.removeTag()(this.tag);
|
||||
}
|
||||
|
||||
this.selectFirstNote = function(createNew) {
|
||||
var visibleNotes = this.sortedNotes.filter(function(note){
|
||||
return note.visible;
|
||||
|
||||
@@ -9,7 +9,8 @@ angular.module('app.frontend')
|
||||
save: "&",
|
||||
tags: "=",
|
||||
allTag: "=",
|
||||
updateNoteTag: "&"
|
||||
updateNoteTag: "&",
|
||||
removeTag: "&"
|
||||
},
|
||||
templateUrl: 'frontend/tags.html',
|
||||
replace: true,
|
||||
@@ -32,7 +33,7 @@ angular.module('app.frontend')
|
||||
}
|
||||
}
|
||||
})
|
||||
.controller('TagsCtrl', function (modelManager) {
|
||||
.controller('TagsCtrl', function (modelManager, $timeout) {
|
||||
|
||||
var initialLoad = true;
|
||||
|
||||
@@ -98,6 +99,17 @@ angular.module('app.frontend')
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
this.selectedRenameTag = function($event, tag) {
|
||||
this.editingTag = tag;
|
||||
$timeout(function(){
|
||||
document.getElementById("tag-" + tag.uuid).focus();
|
||||
})
|
||||
}
|
||||
|
||||
this.selectedDeleteTag = function(tag) {
|
||||
this.removeTag()(tag);
|
||||
}
|
||||
|
||||
this.noteCount = function(tag) {
|
||||
var validNotes = Note.filterDummyNotes(tag.notes);
|
||||
return validNotes.length;
|
||||
|
||||
Reference in New Issue
Block a user