X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fmodels%2Fcomic.js.coffee;h=de7a4416411345e332958b8b13e4dc135858e0b7;hb=28197aecf803b9332afeebb4db14fb7042606f5e;hp=4dc49b71b6ddeedb598e392e835a41357933410e;hpb=70027b80e56b5fbea8d63d520fbbf92050959f28;p=pettanr%2Fpettanr.git diff --git a/app/assets/javascripts/models/comic.js.coffee b/app/assets/javascripts/models/comic.js.coffee index 4dc49b71..de7a4416 100644 --- a/app/assets/javascripts/models/comic.js.coffee +++ b/app/assets/javascripts/models/comic.js.coffee @@ -1,15 +1,38 @@ class Pettanr.Comic extends Peta.Binder - @single: () -> + url: '/comics/' + + @singular: () -> 'Comic' @plural: () -> 'Comics' defaults: { - id: 11 + id: null, + visible: 0, + author_id: null } + author: () -> + new Pettanr.Cache.Retriever(Pettanr.Author, @get('author_id')) + + is_visible: (operators) -> + switch super(operators) + when null + return true + when false + return false + else + @get('visible') > 0 + + overwrite: (options) -> + operators = options.operators + return false if not operators.author + @set('author_id', operators.author.id) + + symbol_filename: () -> + initialize: () -> - confirm("Welcome to Panel") + if @id + @url = @url + @id -