OSDN Git Service

fix: show's destroy button
[pettanr/pettanr.git] / app / assets / javascripts / models / story.js.coffee
index a67d8ae..606df47 100644 (file)
@@ -1,4 +1,5 @@
 class Pettanr.Story extends Peta.Binder\r
+  \r
   @singular: () ->\r
     'Story'\r
   \r
@@ -11,7 +12,15 @@ class Pettanr.Story extends Peta.Binder
     author_id: null\r
   } \r
   \r
-  is_visible: (operators) ->\r
+  author: () ->\r
+    new Pettanr.Cache.Retriever(Pettanr.Author, @get('author_id'))\r
+  \r
+  overwrite: (options) ->\r
+    operators = Pettanr.cache.operators\r
+    return false if not operators.author\r
+    @set('author_id', operators.author.id)\r
+  \r
+  is_visible: (operators = Pettanr.cache.operators) ->\r
     switch super(operators)\r
       when null\r
         return true\r
@@ -20,10 +29,6 @@ class Pettanr.Story extends Peta.Binder
       else\r
         @get('visible') > 0\r
   \r
-  initialize: () ->\r
-    if @id\r
-      @url = @url + @id\r
+  initialize: (attr = {}, options = {}) ->\r
+    super(attr, options)\r
   \r
-class Pettanr.Story.Collection extends Backbone.Collection\r
-  model: Pettanr.Story\r
-  url: '/stories'\r