X-Git-Url: http://git.osdn.net/view?p=pettanr%2Fpettanr.git;a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fmodels%2Fstory.js.coffee;h=606df47c5203c19802526c1786f6659ef9696586;hp=a67d8ae8c9ce84f98e43e29772b1296de009a672;hb=aa9eca25671c772ffec8f2f65aecc8a978a2f375;hpb=2e1fe642e8bf2e237f6bcfb605d4d26da96fe2e9 diff --git a/app/assets/javascripts/models/story.js.coffee b/app/assets/javascripts/models/story.js.coffee index a67d8ae8..606df47c 100644 --- a/app/assets/javascripts/models/story.js.coffee +++ b/app/assets/javascripts/models/story.js.coffee @@ -1,4 +1,5 @@ class Pettanr.Story extends Peta.Binder + @singular: () -> 'Story' @@ -11,7 +12,15 @@ class Pettanr.Story extends Peta.Binder author_id: null } - is_visible: (operators) -> + author: () -> + new Pettanr.Cache.Retriever(Pettanr.Author, @get('author_id')) + + overwrite: (options) -> + operators = Pettanr.cache.operators + return false if not operators.author + @set('author_id', operators.author.id) + + is_visible: (operators = Pettanr.cache.operators) -> switch super(operators) when null return true @@ -20,10 +29,6 @@ class Pettanr.Story extends Peta.Binder else @get('visible') > 0 - initialize: () -> - if @id - @url = @url + @id + initialize: (attr = {}, options = {}) -> + super(attr, options) -class Pettanr.Story.Collection extends Backbone.Collection - model: Pettanr.Story - url: '/stories'