OSDN Git Service

fix: view system2
[pettanr/pettanr.git] / app / assets / javascripts / views / speech_balloons / summary.js.coffee
index eb8fafd..cc212b2 100644 (file)
@@ -1,14 +1,29 @@
-class Pettanr.Views.SpeechBalloon.Summary extends Backbone.View\r
+class Pettanr.Views.SpeechBalloon.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
+    super(options)\r
     @item = options.item\r
+    @item.get_parent('panel', this, {\r
+      success: (@panel) =>\r
+        @panel_icon = new Pettanr.Views.Common.Icon({item: @panel, half: true})\r
+        @listenTo(@panel_icon, 'click', @panel_click)\r
+        @panel.get_parent('author', this, {\r
+          success: (@author) =>\r
+            @author_icon_with_caption = @author.icon_with_caption_view(true, 'name', 12)\r
+            @listenTo(@author_icon_with_caption, 'click', @author_click)\r
+            @trigger('ready')\r
+        })\r
+    })\r
   \r
   render: () ->\r
     this.$el.html('')\r
-    _this = this\r
-    panel = @item.panel()\r
-    panel.fetch().done ->\r
-      panel_icon = new Pettanr.Views.Common.Icon({item: panel, half: true})\r
-      _this.$el.append(panel_icon.render().el)\r
+    this.$el.append(@panel_icon.render().el)\r
+    this.$el.append(@author_icon_with_caption.render().el)\r
     this\r
   \r
+  panel_click: () ->\r
+    @trigger('http_get', @panel_icon.url())\r
+  \r
+  author_click: () ->\r
+    @trigger('http_get', @author_icon_with_caption.url())\r
+  \r