OSDN Git Service

fix: fetch fail
[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         fail: (response, opt) =>\r
26           @open_error_dialog(response, opt)\r
27       })\r
28   \r
29   click_credit_icon: (item) ->\r
30     @trigger('click:credit:icon', item)\r
31   \r