-class Pettanr.Views.OriginalPicture.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.OriginalPicture.Summary extends Pettanr.View.Summary\r
className: 'op-smy'\r
\r
initialize: (options) ->\r
super(options)\r
- @item = options.item\r
- #@item = new Pettanr.OriginalPicture({id: options.item.get('id')}) # with resource_picture\r
- @load()\r
- \r
- load: () ->\r
- @item.fetch({cache: false}).done =>\r
- @visible = new Tag.Span({\r
- class_name: 'state',\r
- content: I18n.t('original_pictures.' + @item.state())\r
- })\r
- if ra = @item.get('resource_picture')\r
- resource_picture = new Pettanr.ResourcePicture(ra)\r
- @credit = resource_picture.credit_view(true)\r
- @listenTo(@credit, 'click:icon', @resource_picture_click)\r
- @trigger('ready')\r
\r
render: () ->\r
+ super()\r
+ @visible = new Tag.Span({\r
+ class_name: 'state',\r
+ content: I18n.t('original_pictures.' + @item.state())\r
+ })\r
this.$el.html('')\r
this.$el.append(@visible.render().el)\r
- if @credit\r
- this.$el.append(@credit.render().el)\r
- rb = new Tag.RowBreak()\r
- this.$el.append(rb.render().el)\r
+ @item.get_child('resource_picture', this, {\r
+ success: (@resource_picture) =>\r
+ if @resource_picture\r
+ @resource_picture.get_parent('picture', this, {\r
+ success: (@picture) =>\r
+ @credit = new Pettanr.View.Credit(@picture, {icon: false})\r
+ this.$el.append(@credit.render().el)\r
+ @append_rb()\r
+ })\r
+ })\r
this\r
\r
- # in credit\r
- resource_picture_click: (resource_picture) ->\r
- @trigger('http_get', resource_picture.show_url())\r
- \r