OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
[pettanr/pettanr.git] / app / assets / javascripts / views / panels / show.js.coffee
1 # panel: panel item\r
2 # operators: operators\r
3 # spot: no opacity element\r
4 class Pettanr.Views.Panel.Show extends Backbone.View\r
5   tagName: 'div'\r
6   \r
7   initialize: (options) ->\r
8     @panel = options.panel\r
9     @operators = options.operators\r
10     @spot = options.spot\r
11     \r
12     icon_url = Pettanr.url(@panel.table_name(), 'show', {id: @panel.get('id')})\r
13     caption_url = Pettanr.url(@panel.table_name(), 'show', {id: @panel.get('id')})\r
14     prof_url = Pettanr.url(@panel.table_name(), 'show', {id: @panel.get('id'), format: 'prof'})\r
15     @header = new Pettanr.Views.Scroll.ShowModule.Header({\r
16       item: @panel, \r
17       operators: @operators,\r
18       caption: @panel.get('caption'), \r
19       icon_url: icon_url,\r
20       caption_url: caption_url,\r
21       prof_url: prof_url\r
22     })\r
23     @body = new Pettanr.Views.Panel.Body({\r
24       panel: @panel,\r
25       operators: @operators,\r
26       spot: @spot\r
27     })\r
28     @footer = new Pettanr.Views.Panel.Footer({\r
29       panel: @panel,\r
30       operators: @operators\r
31     })\r
32     @credits = new Pettanr.Views.Panel.Show.Credits({pictures: @panel.licensed_pictures()})\r
33   \r
34   render: () ->\r
35     this.$el.html('')\r
36     this.$el.append(@header.render().el)\r
37     this.$el.append(@body.render().el)\r
38     this.$el.append(@footer.render().el)\r
39     this.$el.append(@credits.render().el)\r
40     rb = new Tag.RowBreak()\r
41     this.$el.append(rb.render().el)\r
42     this\r
43   \r
44 class Pettanr.Views.Panel.Show.Credits extends Backbone.View\r
45   tagName: 'div'\r
46   className: 'credits'\r
47   \r
48   initialize: (options) ->\r
49     @pictures = options.pictures\r
50   \r
51   render: () ->\r
52     _this = this\r
53     this.$el.html('')\r
54     _.each @pictures, (picture) ->\r
55       picture.fetch({cache: true}).done ->\r
56         credit = picture.credit_view()\r
57         _this.$el.append(credit.render().el)\r
58     this\r
59   \r