OSDN Git Service

add profiler
[pettanr/pettanr.git] / app / assets / javascripts / locmare / profiler / association.js.coffee
1 class Locmare.ProfilerModule.Association extends Backbone.View\r
2   tagName: 'div'\r
3   \r
4   initialize: (options) ->\r
5     @profiler = options.profiler\r
6     @association_manifest = options.association_manifest\r
7     @belongs_to = _.map @association_manifest.belongs_to, (belongs_to_manifest) =>\r
8       new Locmare.ProfilerModule.AssociationModule.BelongsTo({association: this, belongs_to_manifest: belongs_to_manifest})\r
9     @has_many = _.map @association_manifest.has_many, (list_manifest) =>\r
10       new Locmare.ProfilerModule.AssociationModule.HasMany({association: this, has_many_manifest: list_manifest})\r
11     @has_one = _.map @association_manifest.has_one, (list_manifest) =>\r
12       new Locmare.ProfilerModule.AssociationModule.HasOne({association: this, has_one_manifest: list_manifestt})\r
13     @render\r
14   \r
15   render: () ->\r
16     _this = this\r
17     _.each @belongs_to, (f) ->\r
18       #_this.$el.append(f.render().el)\r
19     _.each @has_many, (f) ->\r
20       #_this.$el.append(f.render().el)\r
21     _.each @has_one, (f) ->\r
22       #_this.$el.append(f.render().el)\r
23     this\r
24   \r
25   item: () ->\r
26     @profiler.item\r
27   \r
28   model_manifest: () ->\r
29     Manifest.manifest().models[@profiler.item_name]\r
30   \r
31 class Locmare.ProfilerModule.AssociationModule\r
32 \r