OSDN Git Service

fix: view system2
[pettanr/pettanr.git] / app / assets / javascripts / view / show / header.js.coffee
index 014bd65..794e429 100644 (file)
@@ -2,31 +2,33 @@ class Pettanr.View.Show.Header extends Pettanr.View
   tagName: 'h1'\r
   className: 'show-header'\r
   \r
-  initialize: (@item, options) ->\r
+  constructor: (@item, @context, options) ->\r
+    super(options)\r
+  \r
+  initialize: (options) ->\r
     @face_options = options.face\r
     @label_options = options.label\r
     @prof_options = options.prof\r
     \r
+    @face_options.context ||= @context\r
+    @face_options.class_name ||= 'face'\r
+    @face_options.click ||= () =>\r
+      @trigger('click:face')\r
+    \r
+    @label_options.context ||= @context\r
+    @label_options.class_name ||= 'label'\r
+    @label_options.click ||= () =>\r
+      @trigger('click:label')\r
+    \r
+    @prof_options.context ||= @context\r
+    @prof_options.class_name ||= 'prof'\r
+    @prof_options.click ||= () =>\r
+      @trigger('click:prof')\r
+    \r
     @pick = null\r
-    @face_button = @item.mini_face_button({\r
-      context: this,\r
-      class_name: 'icon',\r
-      click: () =>\r
-        @trigger('click:icon')\r
-    })\r
-    @label_button = @item.label_button({\r
-      url: @label_options.url,\r
-      context: this,\r
-      class_name: 'caption',\r
-      click: () =>\r
-        @trigger('click:caption')\r
-    })\r
-    @prof_button = @item.mini_prof_button({\r
-      context: this,\r
-      class_name: 'prof',\r
-      click: () =>\r
-        @trigger('click:prof')\r
-    })\r
+    @face_button = @item.mini_face_button(@face_options)\r
+    @label_button = @item.label_button(@label_options)\r
+    @prof_button = @item.mini_prof_button(@prof_options)\r
   \r
   render: () ->\r
     this.$el.html('')\r