OSDN Git Service

rename model name
[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     _this = this\r
15     @list.open((page_status) ->\r
16       _this.filer = new Locmare.Filer({\r
17         item_name: _this.has_one_model().item_name(), \r
18         items: _this.list.items(), \r
19         pager: _this.pager, \r
20         operators: _this.profiler().operators\r
21       })\r
22       _this.render()\r
23     )\r
24   \r
25   render: () ->\r
26     this.$el.html('')\r
27     if @filer\r
28       this.$el.html(@filer.render().el)\r
29     this\r
30   \r
31   item: () ->\r
32     @profiler().item\r
33   \r
34   has_one_model: () ->\r
35     @has_one_manifest.model()\r
36   \r
37   profiler: () ->\r
38     @association.profiler\r
39   \r