OSDN Git Service

fix event
[pettanr/pettanr.git] / app / assets / javascripts / locmare / profiler / association / has_one.js.coffee
index 7094d71..d9b9f8c 100644 (file)
@@ -5,14 +5,22 @@ class Locmare.ProfilerModule.AssociationModule.HasOne extends Backbone.View
     @association = options.association\r
     @has_one_manifest = options.has_one_manifest\r
     @filer = null\r
-    c = @has_one_manifest.list_options(@item().get('id'))\r
-    m = new Pettanr.FilerCollection({}, c)\r
-    @filer = new Locmare.Filer({\r
-      item_name: @has_one_model().item_name(), \r
-      collection: m, \r
-      pager: @pager, \r
-      operators: @profiler().operators\r
-    })\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
+      @profiler().operators, {id: @item().get('id')}\r
+    )\r
+    @list.open((page_status) =>\r
+      @filer = new Locmare.Filer({\r
+        item_name: @has_one_model().item_name(), \r
+        items: @list.items(), \r
+        pager: @pager, \r
+        operators: @profiler().operators\r
+      })\r
+      @listenTo(@filer, 'navigate', @navigate)\r
+      @render()\r
+    )\r
   \r
   render: () ->\r
     this.$el.html('')\r
@@ -29,3 +37,6 @@ class Locmare.ProfilerModule.AssociationModule.HasOne extends Backbone.View
   profiler: () ->\r
     @association.profiler\r
   \r
+  navigate: (url) ->\r
+    @trigger('navigate', url)\r
+  \r