OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[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   system_picture: () ->\r
23     new Pettanr.SystemPicture({id: @get('system_picture_id')})\r
24   \r
25   r_url: () ->\r
26     '/system_pictures/' + @system_picture().filename()\r
27   \r
28   symbol_option: (cb) ->\r
29     sb = @speech_balloon()\r
30     sb.fetch({cache: true}).done ->\r
31       sbt = sb.speech_balloon_template()\r
32       sbt.fetch({cache: true}).done ->\r
33         sp = sbt.system_picture()\r
34         sp.fetch({cache: true}).done ->\r
35           cb(sp.tmb_opt_img_tag())\r
36   \r
37   initialize: () ->\r
38     if @id\r
39       @url = @url + @id\r
40   \r
41 class Pettanr.Balloon.Collection extends Backbone.Collection\r
42   model: Pettanr.Balloon\r
43   url: '/balloons'\r
44 \r