OSDN Git Service

fix orm
[pettanr/pettanr.git] / lib / manifest / local / view / profiler.rb
1 require_dependency "manifest/local/view/profiler/header"
2 require_dependency "manifest/local/view/profiler/column"
3 require_dependency "manifest/local/view/profiler/association"
4 module Manifest
5   module View
6     class Profiler
7       include ProfilerModule
8       attr :profiler_manifest, :item_name, :item, :operators, :template_dir, 
9         :header, :columns, :associations
10       def initialize item_name, item, operators
11         @item_name = item_name
12         @item = item
13         @operators = operators
14         @profiler_manifest = Manifest.manifest.profilers[@item_name]
15         @template_dir = 'templates/r/profiler/'
16         @header = Header.new self
17         @columns = @profiler_manifest.column_names.map {|column_name|
18           Column.new self, column_name
19         }
20         @associations = Association.new self, @profiler_manifest.associations
21       end
22       
23       def model
24         ::Manifest::item_name_to_model @item_name
25       end
26       
27       def template_file_name
28         "profiler"
29       end
30       
31       def template_name
32         self.template_dir + self.template_file_name
33       end
34       
35       def header_template_file_name
36         "header"
37       end
38       
39       def header_template_name
40         self.template_dir + self.header_template_file_name
41       end
42       
43       def columns_template_file_name
44         "columns"
45       end
46       
47       def columns_template_name
48         self.template_dir + self.columns_template_file_name
49       end
50       
51       def associations_template_file_name
52         "associations"
53       end
54       
55       def associations_template_name
56         self.template_dir + self.associations_template_file_name
57       end
58       
59       def image_dir
60         '/images/'
61       end
62       
63     end
64   end
65 end