OSDN Git Service

add load icon
[pettanr/pettanr.git] / app / assets / javascripts / views / original_pictures / summary.js.coffee
1 class Pettanr.Views.OriginalPicture.Summary extends Pettanr.Views.Common.Summary\r
2   className: 'op-smy'\r
3   \r
4   initialize: (options) ->\r
5     super(options)\r
6     @item = options.item\r
7     #@item = new Pettanr.OriginalPicture({id: options.item.get('id')}) # with resource_picture\r
8     @load()\r
9   \r
10   load: () ->\r
11     @item.fetch({cache: false}).done =>\r
12       @visible = new Tag.Span({\r
13         class_name: 'state',\r
14         content: I18n.t('original_pictures.' + @item.state())\r
15       })\r
16       if ra = @item.get('resource_picture')\r
17         resource_picture = new Pettanr.ResourcePicture(ra)\r
18         @credit = resource_picture.credit_view(true)\r
19       @trigger('ready')\r
20   \r
21   render: () ->\r
22     this.$el.html('')\r
23     this.$el.append(@visible.render().el)\r
24     if @credit\r
25       this.$el.append(@credit.render().el)\r
26     rb = new Tag.RowBreak()\r
27     this.$el.append(rb.render().el)\r
28     this\r
29   \r