From b1cbb19b2bd5d5411d0f3e19c5266b968ae92df7 Mon Sep 17 00:00:00 2001 From: life Date: Sun, 8 Feb 2015 18:41:47 +0800 Subject: [PATCH] starred --- node_modules/note.js | 25 ++++- note.html | 6 +- public/css/theme/basic.less | 66 +++++++++++- public/css/theme/default.css | 61 ++++++++++- public/css/theme/simple.css | 61 ++++++++++- public/css/theme/writting-overwrite.css | 61 ++++++++++- public/css/theme/writting.css | 61 ++++++++++- public/js/app/note.js | 135 +++++++++++++++++++++++- public/js/app/notebook.js | 11 +- public/js/app/page.js | 4 + 10 files changed, 455 insertions(+), 36 deletions(-) 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
-