# panel: panel item # operators: operators # spot: no opacity element class Pettanr.Views.Panel.Show extends Backbone.View tagName: 'div' initialize: (options) -> @panel = options.panel @operators = options.operators @spot = options.spot @header = new Pettanr.Views.Panel.ShowModule.Header({ item: @panel, operators: @operators, caption: @panel.get('caption'), icon_url: @panel.show_url(), caption_url: @panel.show_url(), prof_url: @panel.prof_url() }) @body = new Pettanr.Views.Panel.Body({ panel: @panel, operators: @operators, spot: @spot }) @footer = new Pettanr.Views.Panel.Footer({ panel: @panel, operators: @operators }) @credits = new Pettanr.Views.Panel.ShowModule.Credits({ pictures: @panel.licensed_pictures() }) @listenTo(@header, 'click:icon', @click_show) @listenTo(@header, 'click:caption', @click_show) @listenTo(@header, 'click:prof', @click_prof) @listenTo(@footer, 'click:panel', @click_show) @listenTo(@footer, 'click:author', @click_author) @listenTo(@footer, 'click:edit', @click_edit) @listenTo(@credits, 'click:credit:icon', @click_credit_icon) render: () -> this.$el.html('') this.$el.append(@header.render().el) this.$el.append(@body.render().el) this.$el.append(@footer.render().el) this.$el.append(@credits.render().el) rb = new Tag.RowBreak() this.$el.append(rb.render().el) this click_show: () -> window.router.navigate(@panel.show_url(), true) click_author: () -> window.router.navigate(@panel.author().show_url(), true) click_edit: () -> window.router.navigate(@panel.edit_url(), true) click_prof: () -> window.router.navigate(@panel.prof_url(), true) click_credit_icon: (item) -> window.router.navigate(item.show_url(), true) class Pettanr.Views.Panel.ShowModule class Pettanr.Views.Panel.ShowModule.Header extends Pettanr.Views.Show.Header initialize: (options) -> super(options) class Pettanr.Views.Panel.ShowModule.Credits extends Backbone.View tagName: 'div' className: 'credits' initialize: (options) -> @pictures = options.pictures @credited = {} render: () -> this.$el.html('') _.each @pictures, (picture, pid) => @add_picture(picture) this add_picture: (picture) -> add_picture: (picture) -> pid = picture.get('id') if not @credited[pid] picture.fetch({cache: true}).done => @credited[pid] = picture credit = picture.credit_view() @listenTo(credit, 'click:icon', @click_credit_icon) this.$el.append(credit.render().el) click_credit_icon: (item) -> @trigger('click:credit:icon', item)