this\r
\r
push: (append_pictures) ->\r
- _.each append_pictures, (picture, pid) =>\r
+ _.each append_pictures, (retriever, pid) =>\r
return if @licensed_pictures[pid]\r
- @licensed_pictures[pid] = picture\r
- picture.fetch({cache: true}).done =>\r
- credit = picture.credit_view()\r
- this.$el.append(credit.render().el)\r
+ @listenTo(retriever, 'retrieve', @retrieve_picture)\r
+ retriever.retrieve()\r
+ \r
+ retrieve_picture: (picture) ->\r
+ @licensed_pictures[pid] = picture\r
+ credit = picture.credit_view()\r
+ this.$el.append(credit.render().el)\r
+ \r
+class Pettanr.Views.Sheet.PlayModule.Panel extends Backbone.View\r
+ tagName: 'div'\r
+ \r
+ initialize: (options) ->\r
+ @sheet_panel = options.sheet_panel\r
+ @operators = options.operators\r
+ \r
+ clear: () ->\r
+ this.$el.html('')\r
+ retriever = @sheet_panel.panel()\r
+ @listenTo(retriever, 'retrieve', @retrieve_panel)\r
+ retriever.retrieve()\r
+ this\r
+ \r
+ retrieve_panel: (@panel) ->\r
+ @render()\r
+ \r
+ render: () ->\r
+ this.$el.html('')\r
+ body = new Pettanr.Views.Panel.Body({\r
+ panel: @panel,\r
+ operators: @operators,\r
+ spot: null\r
+ })\r
+ this.$el.append(body.render().el)\r
+ footer = new Pettanr.Views.Panel.Footer({\r
+ sheet_panel: sheet_panel,\r
+ panel: @panel,\r
+ operators: @operators\r
+ })\r
+ this.$el.append(footer.render().el)\r
+ this.credits.push(@panel.licensed_pictures())\r
+ this\r
\r
class Pettanr.Views.Sheet.PlayModule.Panels extends Backbone.View\r
tagName: 'div'\r
render: () ->\r
this.$el.html('')\r
_.each @items, (sheet_panel) =>\r
- return if not scroll_panel.has_panel()\r
- panel = sheet_panel.panel()\r
- panel.fetch({cache: true}).done =>\r
- body = new Pettanr.Views.Panel.Body({\r
- panel: panel,\r
- operators: @operators,\r
- spot: null\r
- })\r
- this.$el.append(body.render().el)\r
- footer = new Pettanr.Views.Panel.Footer({\r
- sheet_panel: sheet_panel,\r
- panel: panel,\r
- operators: @operators\r
- })\r
- this.$el.append(footer.render().el)\r
- this.credits.push(panel.licensed_pictures())\r
+ return if not sheet_panel.has_panel()\r
+ panel_view = new Pettanr.Views.Sheet.PlayModule.Panel({\r
+ sheet_panel: sheet_panel,\r
+ operators: @operators,\r
+ })\r
+ this.$el.append(panel_view.render().el)\r
this\r
\r
class Pettanr.Views.Sheet.PlayModule.Body extends Backbone.View\r