OSDN Git Service

cc212b2ff7ddf4e94a727965ece825a0c0a2a1ff
[pettanr/pettanr.git] / app / assets / javascripts / views / speech_balloons / summary.js.coffee
1 class Pettanr.Views.SpeechBalloon.Summary extends Pettanr.View.Summary\r
2   \r
3   initialize: (options) ->\r
4     super(options)\r
5     @item = options.item\r
6     @item.get_parent('panel', this, {\r
7       success: (@panel) =>\r
8         @panel_icon = new Pettanr.Views.Common.Icon({item: @panel, half: true})\r
9         @listenTo(@panel_icon, 'click', @panel_click)\r
10         @panel.get_parent('author', this, {\r
11           success: (@author) =>\r
12             @author_icon_with_caption = @author.icon_with_caption_view(true, 'name', 12)\r
13             @listenTo(@author_icon_with_caption, 'click', @author_click)\r
14             @trigger('ready')\r
15         })\r
16     })\r
17   \r
18   render: () ->\r
19     this.$el.html('')\r
20     this.$el.append(@panel_icon.render().el)\r
21     this.$el.append(@author_icon_with_caption.render().el)\r
22     this\r
23   \r
24   panel_click: () ->\r
25     @trigger('http_get', @panel_icon.url())\r
26   \r
27   author_click: () ->\r
28     @trigger('http_get', @author_icon_with_caption.url())\r
29   \r