OSDN Git Service

fix: fetch fail
[pettanr/pettanr.git] / app / assets / javascripts / locmare / profiler / association / has_one.js.coffee
index 07eadee..0c6c6e0 100644 (file)
@@ -7,17 +7,17 @@ class Locmare.ProfilerModule.AssociationModule.HasOne extends Pettanr.View
     @filer = null\r
     controller = Manifest.manifest().controllers[@has_one_manifest.controller_name]\r
     action = controller.actions[@has_one_manifest.action_name]\r
-    @list = Locmare.ListGroup.list(\r
-      action.path_name(), action.name, \r
-      {id: @item().get('id')}\r
-    )\r
+    @list = action.find({id: @item().get('id')})\r
   \r
   clear: () ->\r
     this.$el.html('')\r
-    @list.open((page_status) =>\r
-      @set_filer()\r
-      @render()\r
-    )\r
+    @list.open(this, {\r
+      success: (page_status) =>\r
+        @set_filer()\r
+        @render()\r
+      fail: (response, opt) =>\r
+        @open_error_dialog(response, opt)\r
+    })\r
     this\r
   \r
   render: () ->\r
@@ -45,11 +45,14 @@ class Locmare.ProfilerModule.AssociationModule.HasOne extends Pettanr.View
     @association.profiler\r
   \r
   add_pick: (target_model) ->\r
-    @list.open((page_status) =>\r
-      @set_filer()\r
-      @render()\r
-      @filer.add_pick(target_model)\r
-    )\r
+    @list.open(this, {\r
+      success: (page_status) =>\r
+        @set_filer()\r
+        @render()\r
+        @filer.add_pick(target_model)\r
+      fail: (response, opt) =>\r
+        @open_error_dialog(response, opt)\r
+    })\r
   \r
   http_get: (url) ->\r
     @trigger('http_get', url)\r