OSDN Git Service

fix profiler
[pettanr/pettanr.git] / app / assets / javascripts / models / balloon.js.coffee
1 class Pettanr.Balloon extends Peta.Element\r
2   url: '/balloons/'\r
3   \r
4   @singular: () ->\r
5     'Balloon'\r
6   \r
7   @plural: () ->\r
8     'Balloons'\r
9   \r
10   defaults: {\r
11     id: null,\r
12     x: 0,\r
13     y: 0,\r
14     width: 100,\r
15     height: 100,\r
16     r: 0\r
17   } \r
18   \r
19   speech_balloon: () ->\r
20     new Pettanr.SpeechBalloon({id: @get('speech_balloon_id')})\r
21   \r
22   r_url: () ->\r
23     '/system_pictures/' + @system_picture().filename()\r
24   \r
25   symbol_option: (cb) ->\r
26     sb = @speech_balloon()\r
27     sb.fetch().done ->\r
28       sbt = sb.speech_balloon_template()\r
29       sbt.fetch().done ->\r
30         sp = sbt.system_picture()\r
31         sp.fetch().done ->\r
32           cb(sp.tmb_opt_img_tag())\r
33   \r
34   style: () ->\r
35     {\r
36       width: Pettanr.to_s(@get('width')) + 'px', \r
37       height: Pettanr.to_s(@get('height')) + 'px',\r
38       top: Pettanr.to_s(@get('y')) + 'px',\r
39       left: Pettanr.to_s(@get('x')) + 'px'\r
40     }\r
41   \r
42   initialize: () ->\r
43     if @id\r
44       @url = @url + @id\r
45   \r
46 class Pettanr.Balloon.Collection extends Backbone.Collection\r
47   model: Pettanr.Balloon\r
48   url: '/balloons'\r
49 \r