OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[pettanr/pettanr.git] / app / assets / javascripts / models / folder.js.coffee
1 class Pettanr.Folder extends Peta.Owner\r
2   url: ''\r
3   \r
4   @singular: () ->\r
5     'Folder'\r
6   \r
7   @plural: () ->\r
8     'Folders'\r
9   \r
10   defaults: {\r
11     id: null,\r
12     name: 'no name'\r
13   } \r
14   \r
15   caption: () ->\r
16     @get('name').replace(/\/$/, '').split('/').pop()\r
17   \r
18   is_remote: () ->\r
19     if @get('category_id') == 10\r
20       true\r
21     else\r
22       false\r
23   \r
24   remote_name: () ->\r
25     Pettanr.to_s(@get('controller_name')) + '/' + Pettanr.to_s(@get('action_name'))\r
26   \r
27   initialize: () ->\r
28     if @id\r
29       @url = @url + @id\r
30   \r
31 class Pettanr.FolderWatch extends Pettanr.Folder\r
32   url: 'watch/'\r
33   initialize: () ->\r
34     if @id\r
35       @url = @url + @id\r
36 class Pettanr.Folder.Collection extends Backbone.Collection\r
37   model: Pettanr.Folder\r
38   url: 'folders'\r
39 class Pettanr.Folder.Root extends Backbone.Collection\r
40   model: Pettanr.Folder\r
41   url: '/folders/root'\r
42 class Pettanr.Folder.Children extends Backbone.Collection\r
43   model: Pettanr.Folder\r
44   initialize: (options) ->\r
45     @url = '/folders/' + options.id.toString()\r