OSDN Git Service

fix:panel elm play
[pettanr/pettanr.git] / app / assets / javascripts / views / ground_colors / show.js.coffee
index 85f83d7..7e8b6b3 100644 (file)
@@ -1,74 +1,29 @@
-class Pettanr.Views.GroundColor.ShowModule\r
-class Pettanr.Views.GroundColor.ShowModule.Header extends Pettanr.Views.Show.Header\r
+class Pettanr.Views.GroundColor.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
-    super(options)\r
+    @header = new Pettanr.View.Show.Header(@item, this, @default_header_options())\r
   \r
-class Pettanr.Views.GroundColor.Show extends Pettanr.View\r
-  tagName: 'div'\r
-  className: 'show'\r
-  \r
-  initialize: (options) ->\r
-    @item = options.item\r
-    icon_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id')})\r
-    caption_url = icon_url\r
-    prof_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id'), format: 'prof'})\r
-    @header = new Pettanr.Views.GroundColor.ShowModule.Header({\r
-      item: @item, \r
-      caption: @item.get('caption'), \r
-      icon_url: icon_url,\r
-      caption_url: caption_url,\r
-      prof_url: prof_url\r
-    })\r
-    @listenTo(this, 'ready', @ready)\r
+  render: () ->\r
+    this.$el.html('')\r
     @item.get_parent('panel', this, {\r
       success: (item) =>\r
-        @panel = item.with_elements()\r
+        @panel = item.play()\r
         @panel.fetch().done =>\r
-          @panel.attributes = @panel.replaced_attributes()\r
-          @author = new Pettanr.Views.Show.HeaderAuthor({item: @panel})\r
+          @panel.attributes = @panel.decoded_attributes()\r
+          @authored_by = @panel.authored_by()\r
           @body = new Pettanr.Views.Panel.Body({\r
             panel: @panel,\r
             spot: @item\r
           })\r
-          @credits = new Pettanr.Views.Common.Credits({\r
-            parent: this\r
-          })\r
           @listenTo(@header, 'click:pick', @click_pick)\r
-          @listenTo(@header, 'click:icon', @click_show)\r
-          @listenTo(@header, 'click:caption', @click_show)\r
-          @listenTo(@header, 'click:prof', @click_prof)\r
-          @listenTo(@author, 'click:author', @click_author)\r
-          @listenTo(@credits, 'click:credit:icon', @click_credit_icon)\r
-          @trigger('ready')\r
+          @listenTo(@authored_by, 'click', @click_authored_by)\r
+          this.$el.append(@header.render().el)\r
+          this.$el.append(@authored_by.render().el)\r
+          this.$el.append(@body.render().el)\r
+          @add_credits()\r
     })\r
-  \r
-  render: () ->\r
-    this.$el.html('')\r
     this\r
   \r
-  ready: () ->\r
-    this.$el.html('')\r
-    this.$el.append(@header.render().el)\r
-    this.$el.append(@author.render().el)\r
-    this.$el.append(@body.render().el)\r
-    this.$el.append(@credits.render().el)\r
-    @credits.clear()\r
-    @credits.push(@panel.licensed_pictures())\r
-    @rb()\r
-  \r
-  click_show: () ->\r
-    @trigger('http_get', @item.show_url())\r
-  \r
-  click_author: () ->\r
-    @trigger('http_get', @panel.author().show_url())\r
-  \r
-  click_prof: () ->\r
-    @trigger('http_get', @item.prof_url())\r
-  \r
-  click_credit_icon: (item) ->\r
-    @trigger('http_get', item.show_url())\r
-  \r
   click_pick: () ->\r
     @trigger('pick', @item)\r
   \r