OSDN Git Service

add profiler
[pettanr/pettanr.git] / app / assets / javascripts / locmare / profiler.js.coffee
1 class Locmare.Profiler extends Backbone.View\r
2   tagName: 'div'\r
3   initialize: (options) ->\r
4     @item_name = options.item_name\r
5     @item = options.item\r
6     # feasible show parsed extend data\r
7     @item.boosts 'post'\r
8     @operators = options.operators\r
9       \r
10     @profiler_manifest = LocalManifest.manifest().profilers[@item_name]\r
11     @template_dir = 'templates-profiler-'\r
12     @header = new Locmare.ProfilerModule.Header({profiler: this})\r
13     @columns = new Locmare.ProfilerModule.Column({profiler: this})\r
14     @associations = new Locmare.ProfilerModule.Association({'profiler': this, association_manifest: @profiler_manifest.associations})\r
15     @render()\r
16   \r
17   render: () ->\r
18     this.$el.html('')\r
19     this.$el.append(@header.render().el)\r
20     this.$el.append(@columns.render().el)\r
21     this.$el.append(@associations.render().el)\r
22     $("#pettanr").html(this.el)\r
23     this\r
24   \r
25   peta: () ->\r
26     Manifest.manifest().items[@item_name]\r
27   \r
28   model: () ->\r
29     Manifest.item_name_to_model @item_name\r
30   \r
31   image_dir: () ->\r
32     '/images/'\r
33   \r
34 class Locmare.ProfilerModule\r
35 \r
36  \r