OSDN Git Service

change: cache system
[pettanr/pettanr.git] / app / assets / javascripts / models / comic.js.coffee
index 4dc49b7..de7a441 100644 (file)
@@ -1,15 +1,38 @@
 class Pettanr.Comic extends Peta.Binder\r
-  @single: () ->\r
+  url: '/comics/'\r
+  \r
+  @singular: () ->\r
     'Comic'\r
   \r
   @plural: () ->\r
     'Comics'\r
   \r
   defaults: {\r
-    id: 11\r
+    id: null,\r
+    visible: 0,\r
+    author_id: null\r
   } \r
   \r
+  author: () ->\r
+    new Pettanr.Cache.Retriever(Pettanr.Author, @get('author_id'))\r
+  \r
+  is_visible: (operators) ->\r
+    switch super(operators)\r
+      when null\r
+        return true\r
+      when false\r
+        return false\r
+      else\r
+        @get('visible') > 0\r
+  \r
+  overwrite: (options) ->\r
+    operators = options.operators\r
+    return false if not operators.author\r
+    @set('author_id', operators.author.id)\r
+  \r
+  symbol_filename: () ->\r
+  \r
   initialize: () ->\r
-    confirm("Welcome to Panel")\r
+    if @id\r
+      @url = @url + @id\r
   \r
-\r