OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[pettanr/pettanr.git] / app / assets / javascripts / models / sheet.js.coffee
1 class Pettanr.Sheet extends Peta.Root\r
2   url: '/sheets/'\r
3   \r
4   @singular: () ->\r
5     'Sheet'\r
6   \r
7   @plural: () ->\r
8     'Sheets'\r
9   \r
10   defaults: {\r
11     id: null,\r
12     visible: 0,\r
13     author_id: null\r
14   } \r
15   \r
16   author: () ->\r
17     new Pettanr.Author({id: @get('author_id')})\r
18   \r
19   is_visible: (operators) ->\r
20     switch super(operators)\r
21       when null\r
22         return true\r
23       when false\r
24         return false\r
25       else\r
26         @get('visible') > 0\r
27   \r
28   initialize: () ->\r
29     if @id\r
30       @url = @url + @id\r
31   \r
32 class Pettanr.Sheet.Collection extends Backbone.Collection\r
33   model: Pettanr.Sheet\r
34   url: '/sheets'\r