5 attr :item_name, :conf, :manifest, :model_name, :actions
6 def initialize item_name, conf, manifest
10 @model_name = @conf['model_name']
11 @actions = @conf['actions'] || {}
14 def list_name action_name
15 a = @actions[action_name] || {}
23 attr :item_name, :conf, :manifest, :attributes, :associations, :belongs_to, :has_many, :has_one
24 def initialize item_name, conf, manifest
25 @item_name = item_name
29 @attributes = @conf['attributes']
30 @associations = @conf['associations'] || {}
31 @belongs_to = @associations['belongs_to'] || {}
32 @has_many = @associations['has_many'] || {}
33 @has_one = @associations['has_one'] || {}
39 attr :item_name, :conf, :manifest, :default_page_size, :lists
40 def initialize item_name, conf, manifest
41 @item_name = item_name
44 @default_page_size = @conf['default_page_size'] || 20
45 @lists = @conf['lists'] || {}
51 attr :conf, :license_groups, :elements, :speech_balloon_templates, :writing_formats
52 def initialize system_resource_conf
53 @conf = system_resource_conf || {}
54 @engine_resources = @conf['engine_resources'] || {}
55 @license_groups = @engine_resources['license_groups'] || {}
56 @speech_balloon_templates = @engine_resources['speech_balloon_templates'] || {}
57 @writing_formats = @engine_resources['writing_formats'] || {}
58 @elements = @conf['elements'] || {}
64 attr :item_name, :conf, :manifest, :columns, :lists, :belongs_to, :has_many, :has_one
65 def initialize item_name, conf, manifest
66 @item_name = item_name
69 @columns = @conf['columns'] || {}
70 @lists = @conf['lists'] || {}
71 @associations_conf = @conf['associations'] || {}
72 @belongs_to = @associations_conf['belongs_to'] || []
73 @has_many = @associations_conf['has_many'] || []
74 @has_one = @associations_conf['has_one'] || []
80 attr :item_name, :conf, :manifest, :icon, :symbol, :caption, :summary, :date, :edit
81 def initialize item_name, conf, manifest
82 @item_name = item_name
85 @symbol = @conf['symbol']
86 @caption = @conf['caption']
87 @summary = @conf['summary']
96 attr :item_name, :conf, :manifest, :base, :fields, :field_names
97 def initialize item_name, conf, manifest
98 @item_name = item_name
101 @base = @conf['base']
102 @fields = @conf['fields'] || {}
103 @field_names = @conf['field_names'] || []
108 attr :system_resources, :magic_numbers, :select_items,
109 :controller_managers, :model_managers, :list_managers, :profiler_managers, :filer_managers, :form_managers
110 def initialize manifest
111 @manifest = manifest || {}
112 @system_resources = SystemResources.new(@manifest['system_resources'])
113 @magic_numbers = @manifest['magic_numbers']
114 @select_items = @manifest['select_items']
121 @controller_managers = {}
124 @profiler_managers = {}
127 (@manifest['controllers'] || {}).each {|item_name, controller_conf|
128 @controllers[item_name] = Controller.new(item_name, controller_conf, self)
129 @controller_managers[item_name] = Pettanr::ControllerManager.new @controllers[item_name]
131 (@manifest['models'] || {}).each {|item_name, model_conf|
132 @models[item_name] = Model.new(item_name, model_conf, self)
133 @model_managers[item_name] = Pettanr::ModelManager.new @models[item_name]
135 (@manifest['lists'] || {}).each {|item_name, list_conf|
136 @lists[item_name] = List.new(item_name, list_conf, self)
137 @list_managers[item_name] = Pettanr::ListManager.new @lists[item_name]
139 @locals = @manifest['locals'] || {}
140 (@locals['profilers'] || {}).each {|item_name, profiler_conf|
141 @profilers[item_name] = Profiler.new item_name, profiler_conf, self
142 @profiler_managers[item_name] = Pettanr::ProfilerManager.new @profilers[item_name]
144 (@locals['filers'] || {}).each {|item_name, filer_conf|
145 @filers[item_name] = Filer.new item_name, filer_conf, self
146 @filer_managers[item_name] = Pettanr::FilerManager.new @filers[item_name]
148 (@locals['forms'] || {}).each {|form_name, form_conf|
149 @forms[form_name] = Form.new form_name, form_conf, self
150 @form_managers[form_name] = Pettanr::FormManager.new @forms[form_name]
156 select_items_font_size
160 #JSON.stringify couldn't print 1.0
163 def select_items_font_size
164 (@select_items['magic_number']['speech_font_size_items']).each {|conf|
165 conf[1] = conf[1].to_f
169 def select_items_loader
170 (@select_items['model_loader'] || {}).each {|name, conf|
171 list = Pettanr::Application::manifest.list_managers[conf['model']].open conf['list_name'], nil, nil, nil
172 @select_items['model'] ||= {}
173 @select_items['model'][name] = list.items.map {|item| [item.caption, item.id]}
177 def controller item_name
178 @controllers[item_name] || @mcontrollers[item_name.tableize]
182 @models[item_name] || @models[item_name.tableize]
186 @lists[item_name] || @lists[item_name.tableize]
189 def profiler item_name
190 @profilers[item_name] || @profilers[item_name.tableize]
194 @filers[item_name] || @filers[item_name.tableize]
198 @forms[form_name] || @forms[form_name.tableize]