OSDN Git Service

fix: view
[pettanr/pettanr.git] / app / assets / javascripts / views / pictures / history.js.coffee
1 class Pettanr.Views.Picture.History extends Pettanr.View\r
2   tagName: 'div'\r
3   \r
4   constructor: (@item, options) ->\r
5     super(options)\r
6   \r
7   initialize: (options) ->\r
8     super(options)\r
9   \r
10   render: () ->\r
11     this.$el.html('')\r
12     r = new Pettanr.View.Button(@item.show_url(), @item.get('revision'), {\r
13       context: this, \r
14       click: () =>\r
15         @trigger('http_get', @item.show_url())\r
16     })\r
17     h = new Tag.H3({\r
18       content: Pettanr.AppHelper.t_m('Picture.revision') + ':'\r
19     })\r
20     d = new Tag.Div({\r
21       content: Pettanr.AppHelper.t_m('Picture.created_at') + ':' + @item.get('created_at')\r
22     })\r
23     this.$el.append(h.render().el)\r
24     h.$el.append(r.render().el)\r
25     this.$el.append(d.render().el)\r
26     @add_credit(@item)\r
27     this\r
28   \r
29   click_credit_icon: () ->\r
30     @trigger('http_get', @item.show_url())\r
31   \r
32   add_credit: (picture, options = {icon: true}) ->\r
33     credit = new Pettanr.View.Credit(picture, options)\r
34     this.$el.append(credit.render().el)\r
35     @listenTo(credit, 'click:icon', @click_credit_icon)\r
36     @append_rb()\r
37   \r