OSDN Git Service

79d67bf44deef91d25e7f79b539a87f1eb8e5ff5
[pettanr/pettanr.git] / app / assets / javascripts / views / resource_pictures / show.js.coffee
1 class Pettanr.Views.ResourcePicture.ShowModule\r
2 class Pettanr.Views.ResourcePicture.ShowModule.Header extends Pettanr.Views.Show.Header\r
3   \r
4   initialize: (options) ->\r
5     super(options)\r
6   \r
7 class Pettanr.Views.ResourcePicture.ShowModule.Owner extends Pettanr.Views.Show.Owner\r
8   \r
9   initialize: (options) ->\r
10     super(options)\r
11   \r
12 class Pettanr.Views.ResourcePicture.Show extends Backbone.View\r
13   tagName: 'div'\r
14   className: 'show'\r
15   \r
16   initialize: (options) ->\r
17     @item = options.item\r
18     @header = new Pettanr.Views.ResourcePicture.ShowModule.Header({\r
19       item: @item, \r
20       icon_url: @item.show_url(),\r
21       caption_url: @item.show_url(),\r
22       prof_url: @item.prof_url()\r
23     })\r
24     @artist = new Pettanr.Views.Show.HeaderArtist({item: @item})\r
25     @listenTo(@header, 'click:pick', @click_pick)\r
26     @listenTo(@header, 'click:icon', @click_show)\r
27     @listenTo(@header, 'click:prof', @click_prof)\r
28     @listenTo(@artist, 'click:artist', @click_artist)\r
29   \r
30   render: () ->\r
31     this.$el.html('')\r
32     this.$el.append(@header.render().el)\r
33     this.$el.append(@artist.render().el)\r
34     this\r
35   \r
36   click_show: () ->\r
37     @trigger('http_get', @item.show_url())\r
38   \r
39   click_prof: () ->\r
40     @trigger('http_get', @item.prof_url())\r
41   \r
42   click_artist: () ->\r
43     @trigger('http_get', @item.artist().show_url())\r
44   \r
45   click_pick: () ->\r
46     @trigger('pick', @item)\r
47   \r
48   is_pickable: () ->\r
49     true\r
50   \r
51   add_pick: (target_model) ->\r
52     @header.add_pick(target_model)\r
53   \r