class Pettanr.Views.Author.ShowModule extends Pettanr.View.Show class Pettanr.Views.Author.ShowModule.Scrolls extends Pettanr.View initialize: (options) -> super(options) @item = options.item render: () -> params = { controller: 'scrolls', action: 'by_author', id: @item.get('id'), page_size: 5 } controller = Manifest.manifest().controllers[params['controller']] action = controller.actions[params['action']] @list = action.find(params) @list.to_filer(this, { success: (filer) => pager = Locmare.ListGroupModule.LibModule.Pager.factory(@list.page_status, params) @listenTo(filer, 'http_get', @http_get) this.$el.append(filer.render().el) }) this http_get: (url) -> @trigger('http_get', url) class Pettanr.Views.Author.ShowModule.PanelsBody extends Pettanr.View initialize: (options) -> super(options) @item = options.item render: () -> params = { controller: 'panels', action: 'by_author', id: @item.get('id'), page_size: 5 } @list = Locmare.ListGroup.list( params['controller'], params['action'], params ) @list.open(this, { success: (items) => pager = Locmare.ListGroupModule.LibModule.Pager.factory(@list.page_status, params) _.each items, (panel) => panel = panel.play() # retake panel for 'with_elements' mode panel.fetch({ success: (model, response, opt) => panel.attributes = panel.decoded_attributes() body = new Pettanr.Views.Panel.Body({ panel: panel, spot: null }) @trigger('ready', panel) this.$el.append(body.render().el) error: (item, response, opt) => @open_error_dialog(response, opt) }) }) this class Pettanr.Views.Author.ShowModule.Panels extends Pettanr.View.Show initialize: (options) -> super(options) @panels_body = new Pettanr.Views.Author.ShowModule.PanelsBody({item: @item}) @credits = new Pettanr.View.Credits(this, {icon: true}) render: () -> @listenTo(@panels_body, 'ready', @ready) @listenTo(@panels_body, 'http_get', @http_get) @listenTo(@credits, 'click:credit:icon', @click_credit_icon) this.$el.append(@panels_body.render().el) this.$el.append(@credits.render().el) @append_rb() this http_get: (url) -> @trigger('http_get', url) ready: (panel) -> @credits.push(panel.licensed_pictures()) click_credit_icon: (item) -> @trigger('http_get', item.show_url()) class Pettanr.Views.Author.ShowModule.Body extends Pettanr.View initialize: (options) -> super(options) @item = options.item @scrolls = new Pettanr.Views.Author.ShowModule.Scrolls({item: @item}) @panels = new Pettanr.Views.Author.ShowModule.Panels(@item, {}) render: () -> this.$el.html('') @listenTo(@scrolls, 'http_get', @http_get) @listenTo(@panels, 'http_get', @http_get) this.$el.append(@scrolls.render().el) this.$el.append(@panels.render().el) this http_get: (url) -> @trigger('http_get', url) class Pettanr.Views.Author.Show extends Pettanr.View.Show initialize: (options) -> @header = new Pettanr.View.Show.Header(@item, this, @default_header_options()) @body = new Pettanr.Views.Author.ShowModule.Body({ item: @item, }) @owner = new Pettanr.View.Show.Footer(@item, this, @edit_only_footer_options()) @listenTo(@body, 'http_get', @http_get) render: () -> this.$el.html('') this.$el.append(@header.render().el) this.$el.append(@body.render().el) this.$el.append(@owner.render().el) if @item.is_own() this http_get: (url) -> @trigger('http_get', url)