OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[pettanr/pettanr.git] / app / assets / javascripts / models / system_picture.js.coffee
1 class Pettanr.SystemPicture extends Peta.SystemResource\r
2   url: '/system_pictures/'\r
3   \r
4   @singular: () ->\r
5     'SystemPicture'\r
6   \r
7   @plural: () ->\r
8     'SystemPictures'\r
9   \r
10   defaults: {\r
11     id: null\r
12   } \r
13   \r
14   filename: () ->\r
15     @get('id') + '.' + @get('ext')\r
16   \r
17   mime_type: () ->\r
18     'image/' + @get('ext')\r
19   \r
20   r_url: () ->\r
21     '/system_pictures/' + @filename()\r
22   \r
23   opt_img_tag: () ->\r
24     {src: @r_url(), width: @get('width'), height: @get('height')}\r
25   \r
26   tmb_opt_img_tag: () ->\r
27     wh = Pettanr.Imager.thumbnail_size(@get('width'), @get('height'))\r
28     {src: @r_url(), width: wh[0], height: wh[1]}\r
29   \r
30   symbol_option: () ->\r
31     @tmb_opt_img_tag()\r
32   \r
33   initialize: () ->\r
34     if @id\r
35       @url = @url + @id\r
36   \r
37 class Pettanr.SystemPicture.Collection extends Backbone.Collection\r
38   model: Pettanr.SystemPicture\r
39   url: '/system_pictures'\r