class Pettanr.Views.GroundColor.ShowModule class Pettanr.Views.GroundColor.ShowModule.Header extends Pettanr.Views.Show.Header initialize: (options) -> super(options) class Pettanr.Views.GroundColor.Show extends Backbone.View tagName: 'div' className: 'show' initialize: (options) -> @item = options.item @operators = options.operators icon_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id')}) caption_url = icon_url prof_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id'), format: 'prof'}) @header = new Pettanr.Views.GroundColor.ShowModule.Header({ item: @item, operators: @operators, caption: @item.get('caption'), icon_url: icon_url, caption_url: caption_url, prof_url: prof_url }) @listenTo(this, 'ready', @ready) @panel = @item.panel().with_elements() @panel.fetch({cache: false}).done => # with elements @author = new Pettanr.Views.Show.HeaderAuthor({item: @panel}) @body = new Pettanr.Views.Panel.Body({ panel: @panel, operators: @operators, spot: @item }) @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(@author, 'click:author', @click_author) @listenTo(@credits, 'click:credit:icon', @click_credit_icon) @trigger('ready') render: () -> this.$el.html('') this ready: () -> this.$el.html('') this.$el.append(@header.render().el) this.$el.append(@author.render().el) this.$el.append(@body.render().el) this.$el.append(@credits.render().el) rb = new Tag.RowBreak() this.$el.append(rb.render().el) click_show: () -> window.router.navigate(@item.show_url(), true) click_author: () -> window.router.navigate(@panel.author().show_url(), true) click_prof: () -> window.router.navigate(@item.prof_url(), true) click_credit_icon: (item) -> window.router.navigate(item.show_url(), true)