OSDN Git Service

fix: view system2
[pettanr/pettanr.git] / app / assets / javascripts / view / summary / binder.js.coffee
diff --git a/app/assets/javascripts/view/summary/binder.js.coffee b/app/assets/javascripts/view/summary/binder.js.coffee
new file mode 100644 (file)
index 0000000..5bf5e8d
--- /dev/null
@@ -0,0 +1,29 @@
+class Pettanr.View.Summary.Binder extends Pettanr.View\r
+  \r
+  initialize: (options) ->\r
+    super(options)\r
+    @item = options.item\r
+    @visible_t = options.visible_t\r
+    @visible_column_name = options.visible_column_name\r
+    @load()\r
+  \r
+  load: () ->\r
+    @visible = new Tag.Div({\r
+      content: Pettanr.AppHelper.t_selected_item(@visible_t, @item.get(@visible_column_name))\r
+    })\r
+    @item.get_parent('author', this, {\r
+      success: (@author) =>\r
+        @author_icon_with_caption = @author.icon_with_caption_view(true, 'name', 12)\r
+        @listenTo(@author_icon_with_caption, 'click', @author_click)\r
+        @trigger('ready')\r
+    })\r
+  \r
+  render: () ->\r
+    this.$el.html('')\r
+    this.$el.append(@visible.render().el)\r
+    this.$el.append(@author_icon_with_caption.render().el)\r
+    this\r
+  \r
+  author_click: () ->\r
+    @trigger('http_get', @author_icon_with_caption.url())\r
+  \r