OSDN Git Service

change: cache system
[pettanr/pettanr.git] / app / assets / javascripts / models / comic.js.coffee
1 class Pettanr.Comic extends Peta.Binder\r
2   url: '/comics/'\r
3   \r
4   @singular: () ->\r
5     'Comic'\r
6   \r
7   @plural: () ->\r
8     'Comics'\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   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   overwrite: (options) ->\r
29     operators = options.operators\r
30     return false if not operators.author\r
31     @set('author_id', operators.author.id)\r
32   \r
33   symbol_filename: () ->\r
34   \r
35   initialize: () ->\r
36     if @id\r
37       @url = @url + @id\r
38   \r