OSDN Git Service

dfac77b14f8a514a9e5759acc7b700131458a21c
[pettanr/pettanr.git] / app / assets / javascripts / views / scroll_panels / summary.js.coffee
1 class Pettanr.Views.ScrollPanel.Summary extends Backbone.View\r
2   \r
3   initialize: (options) ->\r
4     @item = options.item\r
5     _this = this\r
6     @scroll = @item.scroll()\r
7     @scroll.fetch({cache: true}).done ->\r
8       _this.scroll_icon = _this.scroll.icon_view(true)\r
9       _this.panel = _this.item.panel()\r
10       _this.panel.fetch({cache: true}).done ->\r
11         _this.panel_icon = _this.panel.icon_view(true)\r
12         _this.author = _this.scroll.author()\r
13         _this.author.fetch({cache: true}).done ->\r
14           _this.author_name = _this.author.name_view(12)\r
15           _this.render()\r
16   \r
17   render: () ->\r
18     this.$el.html('')\r
19     if @author_name\r
20       this.$el.append(@scroll_icon.render().el)\r
21       this.$el.append(@panel_icon.render().el)\r
22       this.$el.append(@author_name.render().el)\r
23     this\r
24   \r