X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fviews%2Fpanel_pictures%2Fshow.js.coffee;h=e4b32b925f428dd237d3e1814a644f543a0f963e;hb=16156f8c2cc82d5ae69e3c2b7d5cc35ddbfa92a3;hp=89ca570e1769625f95c50464f8f34b8284829545;hpb=85d27b03ef74a6d4775fc345a9f59c9e1736e7c1;p=pettanr%2Fpettanr.git diff --git a/app/assets/javascripts/views/panel_pictures/show.js.coffee b/app/assets/javascripts/views/panel_pictures/show.js.coffee index 89ca570e..e4b32b92 100644 --- a/app/assets/javascripts/views/panel_pictures/show.js.coffee +++ b/app/assets/javascripts/views/panel_pictures/show.js.coffee @@ -1,10 +1,68 @@ +class Pettanr.Views.PanelPicture.ShowModule +class Pettanr.Views.PanelPicture.ShowModule.Header extends Pettanr.Views.Show.Header + + initialize: (options) -> + super(options) + class Pettanr.Views.PanelPicture.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.PanelPicture.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: () -> + @trigger('http_get', @item.show_url()) + + click_author: () -> + @trigger('http_get', @panel.author().show_url()) + + click_prof: () -> + @trigger('http_get', @item.prof_url()) + + click_credit_icon: (item) -> + @trigger('http_get', item.show_url()) +