-<% item_name = item.class.to_s.underscore %>\r
-<% profile = configurations['profiles'][item_name] || {} %>\r
-<% model_conf = configurations['models'][item_name] || {} %>\r
-<% model_attributes = model_conf['attributes'] || {} %>\r
-<% model_associations = model_conf['associations'] || {} %>\r
-<% profile_associations = profile['associations'] || {} %>\r
-<%= render 'system/filer.html', :items => [item], :model => item.class, :roles => roles, :pager => nil %>\r
-<% profile['fields'].each do |field_name| %>\r
- <% field_conf = model_attributes[field_name] || {} %>\r
+<%= render 'system/filer.html', :filer => profiler.header_filer %>\r
+<% profiler.each_column do |column| %>\r
<div>\r
- <%= item.class.human_attribute_name(field_name) %>\r
- <% case field_conf['type'] %>\r
- <% when 'datetime' %>\r
- <% if item.attributes[field_name] %>\r
- <%= l item.attributes[field_name] %>\r
- <% else %>\r
- <%= item.attributes[field_name] %>\r
- <% end %>\r
- <% else %>\r
- <%= item.attributes[field_name] %>\r
- <% end %>\r
- <% if field_conf['source'] %>\r
- <% case field_conf['source']['type'] %>\r
- <% when 'magic_number' %>\r
- (<%= t_selected_item(field_conf['source']['key'], item.attributes[field_name]) %>)\r
- <% when 'model' %>\r
- <% else %>\r
- <% end %>\r
- <% end %>\r
+ <%= column.label self %>\r
+ <%= column.disp_value self %>\r
+ <%= column.note self %>\r
</div>\r
<% end %>\r
<div>\r
<div>\r
<%= 'belongs_to' %>\r
</div>\r
-<% (profile_associations['belongs_to'] || []).each do |association_model_name| %>\r
- <% belongs_to_conf = model_associations['belongs_to'][association_model_name] %>\r
- <% parent_model = association_model_name.classify.constantize %>\r
- <% id_column = belongs_to_conf['id_column'] %>\r
- <% parent = nil %>\r
- <% begin %>\r
- <% parent = parent_model.show(item.attributes[id_column], roles) %>\r
- <% rescue ActiveRecord::RecordNotFound %>\r
- <% end %>\r
- <% if parent %>\r
- <%= render 'system/filer.html', :items => [parent], :model => parent.class, :roles => roles, :pager => nil %>\r
- <% end %>\r
+<% profiler.each_belongs_to do |parent_filer| %>\r
+ <%= render 'system/filer.html', :filer => parent_filer %>\r
<% end %>\r
<div>\r
<%= 'has_many' %>\r
</div>\r
-<% (profile_associations['has_many'] || []).each do |association_model_name| %>\r
- <% has_many_conf = model_associations['has_many'][association_model_name] %>\r
- <% child_model = association_model_name.classify.constantize %>\r
- <% foreign_key = has_many_conf['foreign_key'] %>\r
- <% children = child_model.__send__(has_many_conf['list_method'], item.attributes['id'], roles, 1, 3) %>\r
- <%= render 'system/filer.html', :items => children, :model => child_model, :roles => roles, :pager => nil %>\r
+<% profiler.each_belongs_to do |has_many_filer| %>\r
+ <%= render 'system/filer.html', :filer => has_many_filer %>\r
<% end %>\r
<div>\r
<%= 'has_one' %>\r
</div>\r
-<% (profile_associations['has_one'] || []).each do |association_model_name| %>\r
- <% has_one_conf = model_associations['has_one'][association_model_name] %>\r
- <% child_model = association_model_name.classify.constantize %>\r
- <% foreign_key = has_one_conf['foreign_key'] %>\r
- <% children = child_model.__send__(has_one_conf['list_method'], item.attributes['id'], roles, 1, 3) %>\r
- <%= render 'system/filer.html', :items => children, :model => child_model, :roles => roles, :pager => nil %>\r
+<% profiler.each_has_one do |has_one_filer| %>\r
+ <%= render 'system/filer.html', :filer => has_one_filer %>\r
<% end %>\r