OSDN Git Service

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