forked from turtl/js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboard.js
34 lines (28 loc) · 835 Bytes
/
board.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var Board = SyncModel.extend({
sync_type: 'board',
note_count: function()
{
return turtl.search.search({board: this.id()}).bind(this)
.spread(function(notes) {
var unique_notes = notes.filter(function(note, i) { return i == notes.lastIndexOf(note); });
return unique_notes.length;
});
},
get_space: function()
{
var space_id = this.get('space_id');
if(!space_id) return false;
return turtl.profile.get('spaces').get(space_id) || false;
},
move_spaces: function(new_space_id) {
this.set({space_id: new_space_id});
return this.save({custom_method: 'move-space'});
},
});
var Boards = SyncCollection.extend({
model: Board,
sync_type: 'board',
});
var BoardsFilter = Composer.FilterCollection.extend({
sortfn: function(a, b) { return a.get('title', '').localeCompare(b.get('title', '')); }
});