OSDN Git Service

fix event
[pettanr/pettanr.git] / app / assets / javascripts / locmare / filer / body / file_body / file_item / edit / default.js.coffee
index bc94ccd..e7164d5 100644 (file)
@@ -6,22 +6,20 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColum
       attr: {'src': @edit_img_file_name()}, \r
       half: true\r
     })\r
-    url = Pettanr.url(@item.table_name(), 'edit', {id: @item.get('id')})\r
     @edit_btn = new Tag.A({\r
-      attr: {href: '/' + url}, \r
-      handler_name: url,\r
+      attr: {href: '/' + @item.edit_url()}, \r
       content: @edit_icon.render().el\r
     })\r
     @remove_icon = new Pettanr.Image.SymbolImg({\r
       attr: {'src': @remove_img_file_name()}, \r
       half: true\r
     })\r
-    url = Pettanr.url(@item.table_name(), 'destroy', {id: @item.get('id')})\r
     @remove_btn = new Tag.A({\r
-      attr: {href: '/' + url}, \r
-      handler_name: url,\r
+      attr: {href: '/' + @item.destroy_url()}, \r
       content: @remove_icon.render().el\r
     })\r
+    @listenTo(@edit_btn, 'click', @click_edit)\r
+    @listenTo(@remove_btn, 'click', @click_remove)\r
   \r
   render: () ->\r
     this.$el.html('')\r
@@ -42,3 +40,9 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColum
   remove_img_file_name: () ->\r
     @image_dir() + 'remove.png'\r
   \r
+  click_edit: () ->\r
+    @trigger('navigate', @item.edit_url())\r
+  \r
+  click_remove: () ->\r
+    @trigger('navigate', @item.destroy_url())\r
+  \r