def update_property_sets(resource_id)
(params[:property_sets] || []).each do |key, set_keys|
- update_property_set(key, set_keys, params[key], resource_id, params[:auto_generate][key])
+ update_property_set(key, set_keys, params[key], resource_id, params[:auto_generate] && params[:auto_generate][key])
end
end
<% key_field = key_field(property) -%>
<tr class="top multi_value <%= 'template' unless set_key -%> odd" style="<%= 'display:none' unless set_key -%>">
- <% if key_field -%>
- <td><%= render "settings/type_#{key_field.type}", :property => key_field, :field => key_field, :value => set_key, :name => "property_sets[#{property.key}][]", :id => "input_#{h key_field.key}", :size => key_field.indicativeSize -%></td>
- <% else -%>
+ <% unless key_field -%>
<%= hidden_field_tag "property_sets[#{property.key}][]", 'auto-generated' -%>
<% end -%>
- <% property.fields.reject { |field| field.key == 'key' }.each do |field| -%>
+ <% property.fields.each do |field| -%>
<% if set_key -%>
<% key = "#{property.key}.#{set_key}.#{field.key}" -%>
<% value = Property.value(key, resource_id) -%>
<% errors << (render "settings/error", :key => key) -%>
<% end -%>
- <td><%= render "settings/type_#{field.type}", :property => field, :field => field, :value => value, :name => "#{property.key}[#{field.key}][]", :id => "input_#{h field.key}", :size => field.indicativeSize -%></td>
+ <% if field == key_field -%>
+ <td><%= render "settings/type_#{field.type}", :property => field, :field => field, :value => value, :name => "#{property.key}[#{field.key}][]", :id => "input_#{h field.key}", :size => field.indicativeSize -%></td>
+ <% else -%>
+ <td><%= render "settings/type_#{field.type}", :property => field, :field => field, :value => value, :name => "property_sets[#{property.key}][]", :id => "input_#{h field.key}", :size => field.indicativeSize -%></td>
+ <% end -%>
<% end -%>
<td style="width: 60px;">
<table class="data">
<thead>
<tr>
- <% if key_field(property) -%>
- <th><%= message('key') -%></th>
- <% else %>
+ <% unless key_field(property) -%>
<%= hidden_field_tag "auto_generate[#{property.key}]", true -%>
<% end -%>
- <% property.fields.reject { |field| field.key == 'key' }.each do |field| -%>
+ <% property.fields.each do |field| -%>
<th>
<%= field_name(property, field) -%>
<% desc = field_description(property, field) -%>