OSDN Git Service

e233a016f0eccdf2c813507ad803a372b9c8cfff
[pettanr/pettanr.git] / app / assets / javascripts / view / credits.js.coffee
1 class Pettanr.View.Credits extends Pettanr.View\r
2   tagName: 'div'\r
3   className: 'credits'\r
4   \r
5   constructor: (@parent, options) ->\r
6     super(options)\r
7   \r
8   initialize: (@options) ->\r
9     @licensed_pictures = {}\r
10   \r
11   render: () ->\r
12     this.$el.html('')\r
13     this\r
14   \r
15   push: (retrievers) ->\r
16     _.each retrievers, (retriever, pid) =>\r
17       Pettanr.Picture.retrieve(pid, this, {\r
18         success: (picture) =>\r
19           pid = picture.get('id')\r
20           return if @licensed_pictures[pid]\r
21           @licensed_pictures[pid] = picture\r
22           credit = new Pettanr.View.Credit(picture, @options)\r
23           @listenTo(credit, 'click:icon', @click_credit_icon)\r
24           this.$el.append(credit.render().el)\r
25       })\r
26   \r
27   click_credit_icon: (item) ->\r
28     @trigger('click:credit:icon', item)\r
29   \r