OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[pettanr/pettanr.git] / app / assets / javascripts / models / speech_balloon.js.coffee
index e1dc8ce..23e821b 100644 (file)
@@ -1,4 +1,6 @@
 class Pettanr.SpeechBalloon extends Peta.Element\r
+  url: '/speech_balloons/'\r
+  \r
   @singular: () ->\r
     'SpeechBalloon'\r
   \r
@@ -11,16 +13,29 @@ class Pettanr.SpeechBalloon extends Peta.Element
     t: null\r
   } \r
   \r
+  panel: () ->\r
+    new Pettanr.Panel({id: @get('panel_id')})\r
+  \r
+  speech_balloon_template: () ->\r
+    new Pettanr.SpeechBalloonTemplate({id: @get('speech_balloon_template_id')})\r
+  \r
   @has_picture: () ->\r
     false\r
   \r
-  @symbol_option: () ->\r
-    @speech_balloon_template.symbol_option\r
+  symbol_option: (cb) ->\r
+    sbt = @speech_balloon_template()\r
+    sbt.fetch({cache: true}).done ->\r
+      sp = sbt.system_picture()\r
+      sp.fetch({cache: true}).done ->\r
+        cb(sp.tmb_opt_img_tag())\r
+  \r
+  plain_scenario: () ->\r
+    @get('caption')\r
+  \r
+  element_face: () ->\r
+    new Pettanr.Views.SpeechBalloon.ElementFace({element: this})\r
   \r
   initialize: () ->\r
     if @id\r
       @url = @url + @id\r
   \r
-class Pettanr.SpeechBalloon.Collection extends Backbone.Collection\r
-  model: Pettanr.SpeechBalloon\r
-  url: '/speech_balloons'\r