OSDN Git Service

fix:replace row break
[pettanr/pettanr.git] / app / assets / javascripts / locmare / profiler / column.js.coffee
1 class Locmare.ProfilerModule.Column extends Pettanr.View\r
2   tagName: 'div'\r
3   className: 'columns'\r
4   \r
5   initialize: (options) ->\r
6     @profiler = options.profiler\r
7     @profiler_manifest = @profiler.profiler_manifest\r
8     @columns = {}\r
9     _.each @profiler_manifest.columns, (column, name) =>\r
10       @columns[name] = @factory(@profiler, column)\r
11   \r
12   render: () ->\r
13     this.$el.html('')\r
14     _.each @sorted_columns(), (column) =>\r
15       this.$el.append(column.render().el)\r
16     this\r
17   \r
18   types: () ->\r
19     {\r
20       default: Locmare.ProfilerModule.ColumnModule.Default, \r
21       date: Locmare.ProfilerModule.ColumnModule.Date, \r
22       source: Locmare.ProfilerModule.ColumnModule.Source, \r
23       extend: Locmare.ProfilerModule.ColumnModule.Extend, \r
24       json: Locmare.ProfilerModule.ColumnModule.Json\r
25     }\r
26   \r
27   factory: (profiler, my_manifest) ->\r
28     type = my_manifest.type\r
29     console.log("undefined type for local view filers > #{profiler.item_name} > edit\n") if not type\r
30     my_class = @types()[type]\r
31     console.log("undefined class for local view filers > #{profiler.item_name} > edit > #{type}\n") if not my_class\r
32     new my_class({profiler: profiler,  column_manifest: my_manifest})\r
33   \r
34   sorted_columns: () ->\r
35     _.map @profiler_manifest.column_names, (column_name) =>\r
36       @columns[column_name]\r
37   \r
38 class Locmare.ProfilerModule.ColumnModule\r
39 \r