OSDN Git Service

fix: show's destroy button
[pettanr/pettanr.git] / app / assets / javascripts / models / balloon.js.coffee
1 class Pettanr.Balloon extends Peta.Element\r
2   \r
3   @singular: () ->\r
4     'Balloon'\r
5   \r
6   @plural: () ->\r
7     'Balloons'\r
8   \r
9   defaults: {\r
10     id: null,\r
11     x: 0,\r
12     y: 0,\r
13     width: 100,\r
14     height: 100,\r
15     r: 0\r
16   } \r
17   \r
18   pick: () ->\r
19     # \r
20     speech_balloon_template = @templates.speech_balloon_template\r
21     {\r
22       speech_balloon_template_id: speech_balloon_template.get('id'),\r
23       speech_balloon_template_module_name: speech_balloon_template.get('module_name'),\r
24     }\r
25   \r
26   speech_balloon: () ->\r
27     new Pettanr.Cache.Retriever(Pettanr.SpeechBalloon, @get('speech_balloon_id'))\r
28   \r
29   system_picture: () ->\r
30     new Pettanr.Cache.Retriever(Pettanr.SystemPicture, @get('system_picture_id'))\r
31   \r
32   r_url: () ->\r
33     '/system_pictures/' + @system_picture().filename()\r
34   \r
35   symbol_option: () ->\r
36     retriever = @speech_balloon()\r
37     @listenTo(retriever, 'retrieve', @retrieve_speech_balloon)\r
38     retriever.retrieve()\r
39   \r
40   retrieve_speech_balloon: (speech_balloon) -> \r
41     retriever = speech_balloon.speech_balloon_template()\r
42     @listenTo(retriever, 'retrieve', @retrieve_speech_balloon_template)\r
43     retriever.retrieve()\r
44   \r
45   retrieve_speech_balloon_template: (speech_balloon_template) -> \r
46     retriever = speech_balloon_template.system_picture()\r
47     @listenTo(retriever, 'retrieve', @retrieve_system_picture)\r
48     retriever.retrieve()\r
49   \r
50   retrieve_system_picture: (system_picture) -> \r
51     @trigger('ready:symbol', system_picture.tmb_opt_img_tag())\r
52   \r
53   initialize: (attr, options) ->\r
54     super(attr, options)\r
55   \r