X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fmodels%2Fsheet.js.coffee;h=959a8707c1b6291aebb1d049ff9d33cbfe49876e;hb=28197aecf803b9332afeebb4db14fb7042606f5e;hp=d4ee92d8c594e6375e9b299a925e86bdd29e7673;hpb=26485fdc94aad6e87484cfe8c31a71996dbee375;p=pettanr%2Fpettanr.git diff --git a/app/assets/javascripts/models/sheet.js.coffee b/app/assets/javascripts/models/sheet.js.coffee index d4ee92d8..959a8707 100644 --- a/app/assets/javascripts/models/sheet.js.coffee +++ b/app/assets/javascripts/models/sheet.js.coffee @@ -1,25 +1,36 @@ -class Sheet extends Item - @single: () -> +class Pettanr.Sheet extends Peta.Root + url: '/sheets/' + + @singular: () -> 'Sheet' @plural: () -> 'Sheets' defaults: { - id: 11 + id: null, + visible: 0, + author_id: null } + author: () -> + new Pettanr.Cache.Retriever(Pettanr.Author, @get('author_id')) + + overwrite: (options) -> + operators = options.operators + return false if not operators.author + @set('author_id', operators.author.id) + + is_visible: (operators) -> + switch super(operators) + when null + return true + when false + return false + else + @get('visible') > 0 + initialize: () -> - confirm("Welcome to Panel") - - @test: () -> - confirm( @single()) - confirm( @plural() ) - confirm( @class_name() ) - confirm( @element_name() ) - confirm( @table_name() ) - - - test: () -> - -@Panel = Panel + if @id + @url = @url + @id +