class Pettanr.Panel extends Peta.Root url: '/panels/' @singular: () -> 'Panel' @plural: () -> 'Panels' defaults: { id: null, border: 2, publish: 0 } author: () -> new Pettanr.Author({id: @get('author_id')}) pp: () -> new Pettanr.PanelPicture({id: @get('pp_id')}) is_visible: (operators) -> switch super(operators) when null # super return return true when false return false else return true if @isNew() @is_publish() is_usable: (operators) -> @is_visible(operators) is_publish: () -> @get('publish') > 0 initialize: (attr = {}, options = {}) -> @set(attr) if @get('id') @url = @url + @get('id') if options.with_elements @url = @url + '?with_elements=true' class Pettanr.Panels extends Backbone.Collection model: Pettanr.Panel url: '/panels/'