OSDN Git Service

clean
[pettanr/pettanr.git] / app / assets / javascripts / locmare / profiler / association / has_one.js.coffee
1 class Locmare.ProfilerModule.AssociationModule.HasOne extends Backbone.View\r
2   tagName: 'div'\r
3   \r
4   initialize: (options) ->\r
5     @association = options.association\r
6     @has_one_manifest = options.has_one_manifest\r
7     @filer = null\r
8     controller = Manifest.manifest().controllers[@has_one_manifest.controller_name]\r
9     action = controller.actions[@has_one_manifest.action_name]\r
10     @list = Locmare.ListGroup.list(\r
11       action.path_name(), action.name, \r
12       @profiler().operators, {id: @item().get('id')}\r
13     )\r
14     @list.open((page_status) =>\r
15       @filer = new Locmare.Filer({\r
16         item_name: @has_one_model().item_name(), \r
17         items: @list.items(), \r
18         pager: @pager, \r
19         operators: @profiler().operators\r
20       })\r
21       @render()\r
22     )\r
23   \r
24   render: () ->\r
25     this.$el.html('')\r
26     if @filer\r
27       this.$el.html(@filer.render().el)\r
28     this\r
29   \r
30   item: () ->\r
31     @profiler().item\r
32   \r
33   has_one_model: () ->\r
34     @has_one_manifest.model()\r
35   \r
36   profiler: () ->\r
37     @association.profiler\r
38   \r