class Pettanr.Folder extends Peta.Owner url: '/folders/' @singular: () -> 'Folder' @plural: () -> 'Folders' defaults: { id: null, name: 'no name' } caption: () -> @get('name').replace(/\/$/, '').split('/').pop() filer_caption: () -> caption = _.escape(@caption()) @trigger('ready:caption', caption) is_remote: () -> if @get('category_id') == 10 true else false remote_name: () -> Pettanr.to_s(@get('controller_name')) + '/' + Pettanr.to_s(@get('action_name')) event_name: () -> a = if Pettanr.is_blank(@get('action_name')) 'index' else @get('action_name') Pettanr.to_s(@get('controller_name')) + '_' + a initialize: () -> if @id @url = @url + @id class Pettanr.FolderWatch extends Pettanr.Folder initialize: () -> super() @url = @url + '?ref=1' class Pettanr.Folder.Root extends Pettanr.Folder model: Pettanr.Folder url: '/folders/root?ref=1' class Pettanr.Folder.Children extends Backbone.Collection model: Pettanr.Folder initialize: (options) -> @url = '/folders/' + options.id.toString()