OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[pettanr/pettanr.git] / app / assets / javascripts / models / ground_picture.js.coffee
1 class Pettanr.GroundPicture extends Peta.Element\r
2   url: '/ground_pictures/'\r
3   \r
4   @singular: () ->\r
5     'GroundPicture'\r
6   \r
7   @plural: () ->\r
8     'GroundPictures'\r
9   \r
10   defaults: {\r
11     id: null,\r
12     x: 0,\r
13     y: 0,\r
14     repeat: 0\r
15   } \r
16   \r
17   @repeat_texts: () -> \r
18     ['repeat', 'repeat-x', 'repeat-y', 'no-repeat']\r
19   \r
20   panel: () ->\r
21     new Pettanr.Panel({id: @get('panel_id')})\r
22   \r
23   picture: () ->\r
24     new Pettanr.Picture({id: @get('picture_id')})\r
25   \r
26   @has_picture: () ->\r
27     true\r
28   \r
29   tmb_opt_img_tag: (picture) ->\r
30     new Pettanr.Image.SymbolPicture({\r
31       attr: {\r
32         src: picture.r_url(), \r
33         alt: @escape('caption')\r
34       },\r
35       picture: picture\r
36     })\r
37   \r
38   symbol_option: () ->\r
39     i = @picture()\r
40     i.fetch({cache: true}).done =>\r
41       @symbol_picture = i.tmb_opt_img_tag()\r
42       @trigger('ready:symbol')\r
43   \r
44   repeat_text: () ->\r
45     Pettanr.GroundPicture.repeat_texts()[@get('repeat')]\r
46   \r
47   element_face: () ->\r
48     new Pettanr.Views.GroundPicture.ElementFace({element: this})\r
49   \r
50   initialize: () ->\r
51     if @id\r
52       @url = @url + @id\r
53   \r