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.Cache.Retriever(Pettanr.Author, @get('author_id'))\r
18   \r
19   overwrite: (options) ->\r
20     operators = Pettanr.cache.operators\r
21     return false if not operators.author\r
22     @set('author_id', operators.author.id)\r
23   \r
24   is_visible: (operators = Pettanr.cache.operators) ->\r
25     switch super(operators)\r
26       when null\r
27         return true\r
28       when false\r
29         return false\r
30       else\r
31         @get('visible') > 0\r
32   \r
33   initialize: (attr = {}, options = {}) ->\r
34     super(attr, options)\r
35     if @id\r
36       @url = @url + @id\r
37   \r