OSDN Git Service

a29eabd68789c04b25fe663fb0c33f1ddaebede8
[pettanr/pettanr.git] / app / assets / javascripts / models / speech_balloon.js.coffee
1 class Pettanr.SpeechBalloon extends Peta.Element\r
2   url: '/speech_balloons/'\r
3   \r
4   @singular: () ->\r
5     'SpeechBalloon'\r
6   \r
7   @plural: () ->\r
8     'SpeechBalloons'\r
9   \r
10   defaults: {\r
11     id: null,\r
12     z: null,\r
13     t: null\r
14   } \r
15   \r
16   panel: () ->\r
17     new Pettanr.Panel({id: @get('panel_id')})\r
18   \r
19   speech_balloon_template: () ->\r
20     new Pettanr.SpeechBalloonTemplate({id: @get('speech_balloon_template_id')})\r
21   \r
22   @has_picture: () ->\r
23     false\r
24   \r
25   symbol_option: () ->\r
26     sbt = @speech_balloon_template()\r
27     sbt.fetch({cache: true}).done =>\r
28       sp = sbt.system_picture()\r
29       sp.fetch({cache: true}).done =>\r
30         @symbol_picture = sp.tmb_opt_img_tag()\r
31         @trigger('ready:symbol')\r
32   \r
33   filer_caption: () ->\r
34     @fetch({cache: true}).done =>\r
35       @caption_text = @get('caption')\r
36       @trigger('ready:caption')\r
37   \r
38   plain_scenario: () ->\r
39     @get('caption')\r
40   \r
41   element_face: () ->\r
42     new Pettanr.Views.SpeechBalloon.ElementFace({element: this})\r
43   \r
44   initialize: () ->\r
45     if @id\r
46       @url = @url + @id\r
47   \r