diff --git a/node_modules/note.js b/node_modules/note.js index 8ba27f95..a51c6dbb 100644 --- a/node_modules/note.js +++ b/node_modules/note.js @@ -109,20 +109,27 @@ var Note = { // 获取笔记列表 getNotes: function(notebookId, callback) { var me = this; - me._getNotes(notebookId, false, callback); + me._getNotes(notebookId, false, false, callback); }, // 获取trash笔记 getTrashNotes: function(callback) { var me = this; - me._getNotes('', true, callback); + me._getNotes('', true, false, callback); }, - _getNotes: function(notebookId, isTrash, callback) { + getStarNotes: function(callback) { + var me = this; + me._getNotes('', false, true, callback); + }, + _getNotes: function(notebookId, isTrash, isStar, callback) { var userId = User.getCurActiveUserId(); var query = { UserId: userId, IsTrash: false, LocalIsDelete: false, // 未删除的 }; + if(isStar) { + query['Star'] = true; + } if(notebookId) { query['NotebookId'] = notebookId; } @@ -179,6 +186,18 @@ var Note = { }); }, + // 加星或取消 + star: function(noteId, callback) { + var me = this; + me.getNote(noteId, function(note) { + if(note) { + var to = !note.Star; + Notes.update({_id: note._id}, {$set: {Star: to, UpdatedTime: new Date()}}); + callback(true, to); + } + }); + }, + // 笔记本下是否有笔记 hasNotes: function(notebookId, callback) { Notes.count({NotebookId: notebookId, IsTrash: false, LocalIsDelete: false}, function(err, n) { diff --git a/note.html b/note.html index b94adb16..9b7e4659 100755 --- a/note.html +++ b/note.html @@ -102,12 +102,12 @@ function log(o) {
- Started + Starred
-