OSDN Git Service

fix:retrive
[pettanr/pettanr.git] / app / assets / javascripts / views / speech_balloons / element_face.js.coffee
index 42595c6..cbf9669 100644 (file)
@@ -7,20 +7,16 @@ class Pettanr.Views.SpeechBalloon.ElementSymbol extends Pettanr.View
   \r
   render: () ->\r
     this.$el.html('')\r
-    retriever = @element.speech_balloon_template()\r
-    @listenTo(retriever, 'retrieve', @retrieve_speech_balloon_template)\r
-    retriever.retrieve()\r
+    @element.get_parent('speech_balloon_template', this, {\r
+      success: (@speech_balloon_template) =>\r
+        @speech_balloon_template.get_parent('system_picture', this, {\r
+          success: (@system_picture) =>\r
+            img = @system_picture.tmb_opt_img_tag()\r
+            this.$el.html(img.render().el)\r
+        })\r
+    })\r
     this\r
   \r
-  retrieve_speech_balloon_template: (@speech_balloon_template) ->\r
-    retriever = @speech_balloon_template.system_picture()\r
-    @listenTo(retriever, 'retrieve', @retrieve_system_picture)\r
-    retriever.retrieve()\r
-  \r
-  retrieve_system_picture: (@system_picture) ->\r
-    img = @system_picture.tmb_opt_img_tag()\r
-    this.$el.html(img.render().el)\r
-  \r
 class Pettanr.Views.SpeechBalloon.ElementFace extends Pettanr.View\r
   tagName: 'div'\r
   className: 'elements-tab'\r