-class Pettanr.Views.OriginalPicture.ShowModule\r
-class Pettanr.Views.OriginalPicture.ShowModule.History extends Pettanr.View\r
+class Pettanr.Views.OriginalPicture.Show extends Pettanr.View.Show\r
\r
initialize: (options) ->\r
- super(options)\r
- @item = options.item\r
- @list = @item.history()\r
+ @header = new Pettanr.View.Show.Header(@item, this, @default_header_options())\r
+ @authored_by = @item.authored_by()\r
+ @listenTo(@header, 'click:pick', @click_pick)\r
+ @listenTo(@authored_by, 'click', @click_authored_by)\r
+ @body = new Pettanr.Views.OriginalPicture.Show.Body(@item, options)\r
+ @listenTo(@body, 'http_get', @http_get)\r
+ @history = new Pettanr.Views.OriginalPicture.Show.History(@item, {})\r
+ @listenTo(@history, 'http_get', @http_get)\r
\r
render: () ->\r
this.$el.html('')\r
- h = new Tag.H2({\r
- content: I18n.t('original_pictures.show.history')\r
- })\r
- this.$el.append(h.render().el)\r
- @list.fetch().done =>\r
- _.each @list.models, (picture) =>\r
- view = picture.history_view()\r
- @listenTo(view, 'http_get', @http_get)\r
- this.$el.append(view.render().el)\r
+ this.$el.append(@header.render().el)\r
+ this.$el.append(@authored_by.render().el)\r
+ this.$el.append(@body.render().el)\r
+ this.$el.append(@history.render().el)\r
this\r
\r
http_get: (url) ->\r
@trigger('http_get', url)\r
\r
-class Pettanr.Views.OriginalPicture.Show extends Pettanr.View.Show\r
+ is_pickable: () ->\r
+ false\r
\r
- initialize: (options) ->\r
- @header = new Pettanr.View.Show.Header(@item, this, @default_header_options())\r
- @authored_by = @item.authored_by()\r
+class Pettanr.Views.OriginalPicture.Show.Body extends Pettanr.View\r
+ className: 'op-body'\r
+ \r
+ constructor: (@item, options) ->\r
+ super(options)\r
+ \r
+ initialize: (@options) ->\r
@img = @item.real_picture()\r
- @listenTo(@header, 'click:pick', @click_pick)\r
- @listenTo(@authored_by, 'click', @click_authored_by)\r
@owner = new Pettanr.View.Show.Footer(@item, this, {\r
actions: {\r
select: {\r
- url: @original_picture.license_url(),\r
+ url: @item.license_url(),\r
dic_name: 'original_pictures.show.select', \r
click: () =>\r
@create_dialog()\r
- @trigger('click:license', @dialog)\r
+ @options.click_license.call(@options.context, @dialog)\r
}, \r
replace: {\r
- url: @original_picture.edit_url(),\r
+ url: @item.edit_url(),\r
dic_name: 'original_pictures.show.replace', \r
click: () =>\r
@trigger('http_get', @item.edit_url())\r
}, \r
}, \r
})\r
- @history = new Pettanr.Views.OriginalPicture.ShowModule.History({item: @item})\r
- @listenTo(@history, 'http_get', @http_get)\r
+ @summary = @item.summary(this, {})\r
+ @listenTo(@summary, 'http_get', @http_get)\r
\r
render: () ->\r
this.$el.html('')\r
- this.$el.append(@header.render().el)\r
- this.$el.append(@authored_by.render().el)\r
this.$el.append(@img.render().el)\r
- @item.get_parent('picture', this, {\r
- success: (@picture) =>\r
- @credit = new Pettanr.View.Credit(@picture, {\r
- icon: {\r
- click: () =>\r
- @trigger('http_get', @picture.show_url())\r
- }\r
- })\r
- this.$el.append(@credit.render().el)\r
- this.$el.append(@owner.render().el)\r
- })\r
- this.$el.append(@history.render().el)\r
+ this.$el.append(@summary.render().el)\r
+ @append_rb()\r
+ this.$el.append(@owner.render().el)\r
this\r
\r
- http_get: (url) ->\r
- @trigger('http_get', url)\r
- \r
create_dialog: () ->\r
@dialog = new Editor.PicturePublisher.Dialog({\r
parent: this\r
@dialog.start(params, null)\r
@dialog\r
\r
- is_pickable: () ->\r
- false\r
- \r
success: (resource_picture) ->\r
#Pettanr.cache.fix(@item)\r
- @trigger('success', @params, @dialog)\r
+ @options.publish.call(@options.context, @dialog)\r
@trigger('http_get', resource_picture.show_url())\r
Pettanr.cache.refresh(@item)\r
\r
close_dialog: () ->\r
#Pettanr.cache.release(@item)\r
- @trigger('click:close', @dialog)\r
+ @options.close_dialog.call(@options.context, @dialog)\r
+ \r
+class Pettanr.Views.OriginalPicture.Show.History extends Pettanr.View\r
+ className: 'op-history'\r
+ \r
+ constructor: (@item, options) ->\r
+ super(options)\r
+ \r
+ initialize: (options) ->\r
+ super(options)\r
+ controller = Manifest.manifest().controllers['original_pictures']\r
+ action = controller.actions['history']\r
+ @list = action.find(id: @item.get('id'))\r
+ \r
+ render: () ->\r
+ this.$el.html('')\r
+ h = new Tag.H2({\r
+ content: I18n.t('original_pictures.show.history')\r
+ })\r
+ this.$el.append(h.render().el)\r
+ @list.open(this, {\r
+ success: (pictures) => \r
+ _.each pictures, (picture) =>\r
+ history = new Pettanr.Views.Picture.History(picture)\r
+ @listenTo(history, 'http_get', @http_get)\r
+ this.$el.append(history.render().el)\r
+ })\r
+ this\r
+ \r
+ http_get: (url) ->\r
+ @trigger('http_get', url)\r
\r