OSDN Git Service

fix filer
[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     m = new @parent_model(@parent_id())\r
9     m = new Pettanr.FilerCollection({}, @has_one_manifest.list_options(@item().get('id')))\r
10     _this = this\r
11     m.fetch().done ->\r
12       items = m.models\r
13       _this.filer = new Locmare.Filer(_this.has_one_model().item_name, items, null, _this.profiler().operators)\r
14       _this.render()\r
15   \r
16   render: () ->\r
17     this.$el.html('')\r
18     if @filer\r
19       this.$el.html(@filer.render().el)\r
20     this\r
21   \r
22   item: () ->\r
23     @profiler().item\r
24   \r
25   has_one_model: () ->\r
26     @has_one_manifest.model()\r
27   \r
28   profiler: () ->\r
29     @association.profiler\r
30   \r