OSDN Git Service

fix: show's destroy button
[pettanr/pettanr.git] / app / assets / javascripts / models / sheet.js.coffee
1 class Pettanr.Sheet extends Peta.Root\r
2   \r
3   @singular: () ->\r
4     'Sheet'\r
5   \r
6   @plural: () ->\r
7     'Sheets'\r
8   \r
9   defaults: {\r
10     id: null,\r
11     visible: 0,\r
12     author_id: null\r
13   } \r
14   \r
15   author: () ->\r
16     new Pettanr.Cache.Retriever(Pettanr.Author, @get('author_id'))\r
17   \r
18   overwrite: (options) ->\r
19     operators = Pettanr.cache.operators\r
20     return false if not operators.author\r
21     @set('author_id', operators.author.id)\r
22   \r
23   is_visible: (operators = Pettanr.cache.operators) ->\r
24     switch super(operators)\r
25       when null\r
26         return true\r
27       when false\r
28         return false\r
29       else\r
30         @get('visible') > 0\r
31   \r
32   initialize: (attr = {}, options = {}) ->\r
33     super(attr, options)\r
34   \r