OSDN Git Service

v07
[pettanr/pettanr.git] / app / assets / javascripts / models / story.js.coffee
index 4d17170..9357443 100644 (file)
@@ -1,5 +1,4 @@
 class Pettanr.Story extends Peta.Binder\r
-  url: '/stories/'\r
   \r
   @singular: () ->\r
     'Story'\r
@@ -13,7 +12,12 @@ class Pettanr.Story extends Peta.Binder
     author_id: null\r
   } \r
   \r
-  is_visible: (operators) ->\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
@@ -22,10 +26,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