OSDN Git Service

fix: fetch fail
[pettanr/pettanr.git] / app / assets / javascripts / view / show.js.coffee
index caf9248..b23db10 100644 (file)
@@ -1 +1,85 @@
 class Pettanr.View.Show extends Pettanr.View\r
+  tagName: 'div'\r
+  className: 'show'\r
+  \r
+  constructor: (@item, options) ->\r
+    super(options)\r
+  \r
+  default_header_options: () ->\r
+    {\r
+      face: {\r
+        click: () =>\r
+          @trigger('http_get', @item.show_url())\r
+      },\r
+      label: {\r
+        click: () =>\r
+          @trigger('http_get', @item.show_url())\r
+      },\r
+      prof: {\r
+        click: () =>\r
+          @trigger('http_get', @item.prof_url())\r
+      },\r
+    }\r
+  \r
+  binder_header_options: () ->\r
+    {\r
+      face: {\r
+        click: () =>\r
+          @trigger('http_get', @item.show_url())\r
+      },\r
+      label: {\r
+        url: @item.play_url(),\r
+        click: () =>\r
+          @trigger('http_get', @item.play_url())\r
+      },\r
+      prof: {\r
+        click: () =>\r
+          @trigger('http_get', @item.prof_url())\r
+      },\r
+    }\r
+  \r
+  default_footer_options: () ->\r
+    {\r
+      actions: {\r
+        edit: {\r
+          click: () =>\r
+            @trigger('http_get', @item.edit_url())\r
+        }, \r
+        destroy: {\r
+          click: () =>\r
+            redirect = (url) =>\r
+              @trigger('http_get', url)\r
+            Pettanr.Proxy.destroy(@item, {redirect: redirect})\r
+        }, \r
+      }, \r
+    }\r
+  \r
+  edit_only_footer_options: () ->\r
+    {\r
+      actions: {\r
+        edit: {\r
+          click: () =>\r
+            @trigger('http_get', @item.edit_url())\r
+        }, \r
+      }, \r
+    }\r
+  \r
+  add_credits: (options = {icon: true}) ->\r
+    @credits = new Pettanr.View.Credits(this, options)\r
+    @listenTo(@credits, 'click:credit:icon', @click_credit_icon)\r
+    this.$el.append(@credits.render().el)\r
+    @append_rb()\r
+    @credits.push(@panel.licensed_pictures())\r
+  \r
+  add_credit: (picture, options = {icon: true}) ->\r
+    credit = new Pettanr.View.Credit(picture, options)\r
+    this.$el.append(credit.render().el)\r
+    @listenTo(credit, 'click:icon', @click_credit_icon)\r
+    @append_rb()\r
+  \r
+  click_authored_by: (author) ->\r
+    @trigger('http_get', author.show_url())\r
+  \r
+  click_credit_icon: (item) ->\r
+    @trigger('http_get', item.show_url())\r
+  \r