@visible = new Tag.Div({\r
content: Pettanr.AppHelper.t_selected_item(@visible_t, @item.get(@visible_column_name))\r
})\r
- retriever = @item.author()\r
- @listenTo(retriever, 'retrieve', @retrieve_author)\r
- retriever.retrieve()\r
+ @item.get_parent('author', this, {\r
+ success: (@author) =>\r
+ @author_icon_with_caption = @author.icon_with_caption_view(true, 'name', 12)\r
+ @listenTo(@author_icon_with_caption, 'click', @author_click)\r
+ @trigger('ready')\r
+ })\r
\r
render: () ->\r
this.$el.html('')\r
this.$el.append(@author_icon_with_caption.render().el)\r
this\r
\r
- retrieve_author: (@author) ->\r
- @author_icon_with_caption = @author.icon_with_caption_view(true, 'name', 12)\r
- @listenTo(@author_icon_with_caption, 'click', @author_click)\r
- @trigger('ready')\r
- \r
author_click: () ->\r
@trigger('http_get', @author_icon_with_caption.url())\r
\r
@trigger('ready')\r
\r
load_binder: () ->\r
- retriever = @item[@binder_item_name]()\r
- @listenTo(retriever, 'retrieve', @retrieve_binder)\r
- retriever.retrieve()\r
- \r
- retrieve_binder: (@binder) ->\r
- @binder_icon = @binder.icon_view(true)\r
- @listenTo(@binder_icon, 'click', @binder_click)\r
- retriever = @binder.author()\r
- @listenTo(retriever, 'retrieve', @retrieve_binder_author)\r
- retriever.retrieve()\r
- \r
- retrieve_binder_author: (@binder_author) ->\r
- @binder_author_icon_with_caption = @binder_author.icon_with_caption_view(true, 'name', 12)\r
- @listenTo(@binder_author_icon_with_caption, 'click', @binder_author_click)\r
- @binder_view.$el.append(@binder_icon.render().el)\r
- @binder_view.$el.append(@binder_author_icon_with_caption.render().el)\r
- @trigger('load_binder')\r
+ @item.get_parent(@binder_item_name, this, {\r
+ success: (@binder) =>\r
+ @binder_icon = @binder.icon_view(true)\r
+ @listenTo(@binder_icon, 'click', @binder_click)\r
+ @binder.get_parent('author', this, {\r
+ success: (@binder_author) =>\r
+ @binder_author_icon_with_caption = @binder_author.icon_with_caption_view(true, 'name', 12)\r
+ @listenTo(@binder_author_icon_with_caption, 'click', @binder_author_click)\r
+ @binder_view.$el.append(@binder_icon.render().el)\r
+ @binder_view.$el.append(@binder_author_icon_with_caption.render().el)\r
+ @trigger('load_binder')\r
+ })\r
+ })\r
\r
load_destination: () ->\r
- retriever = @item[@destination_item_name]()\r
- @listenTo(retriever, 'retrieve', @retrieve_destination)\r
- retriever.retrieve()\r
- \r
- retrieve_destination: (@destination) ->\r
- @destination_icon = @destination.icon_view(true)\r
- @listenTo(@destination_icon, 'click', @destination_click)\r
- retriever = @destination.author()\r
- @listenTo(retriever, 'retrieve', @retrieve_destination_author)\r
- retriever.retrieve()\r
- \r
- retrieve_destination_author: (@destination_author) ->\r
- @destination_author_icon_with_caption = @destination_author.icon_with_caption_view(true, 'name', 12)\r
- @listenTo(@destination_author_icon_with_caption, 'click', @destination_author_click)\r
- @destination_view.$el.append(@destination_icon.render().el)\r
- @destination_view.$el.append(@destination_author_icon_with_caption.render().el)\r
- @trigger('load_destination')\r
+ @item.get_parent(@destination_item_name, this, {\r
+ success: (@destination) =>\r
+ @destination_icon = @destination.icon_view(true)\r
+ @listenTo(@destination_icon, 'click', @destination_click)\r
+ @destination.get_parent('author', this, {\r
+ success: (@destination_author) =>\r
+ @destination_author_icon_with_caption = @destination_author.icon_with_caption_view(true, 'name', 12)\r
+ @listenTo(@destination_author_icon_with_caption, 'click', @destination_author_click)\r
+ @destination_view.$el.append(@destination_icon.render().el)\r
+ @destination_view.$el.append(@destination_author_icon_with_caption.render().el)\r
+ @trigger('load_destination')\r
+ })\r
+ })\r
\r
render: () ->\r
this.$el.html('')\r
destination_author_click: () ->\r
@trigger('http_get', @destination_author_icon_with_caption.url())\r
\r
+class Pettanr.Views.Common.Credits extends Pettanr.View\r
+ tagName: 'div'\r
+ className: 'credits'\r
+ \r
+ initialize: (options) ->\r
+ @parent = options.parent\r
+ @licensed_pictures = {}\r
+ \r
+ clear: () ->\r
+ this.$el.html('')\r
+ \r
+ render: () ->\r
+ this.$el.html('')\r
+ this\r
+ \r
+ push: (retrievers) ->\r
+ _.each retrievers, (retriever, pid) =>\r
+ Pettanr.Picture.retrieve(pid, this, {\r
+ success: (picture) =>\r
+ pid = picture.get('id')\r
+ return if @licensed_pictures[pid]\r
+ @licensed_pictures[pid] = picture\r
+ credit = picture.credit_view()\r
+ @listenTo(credit, 'click:icon', @click_credit_icon)\r
+ this.$el.append(credit.render().el)\r
+ })\r
+ \r
+ click_credit_icon: (item) ->\r
+ @trigger('click:credit:icon', item)\r
+ \r