</thead>
<tbody>
<% @definitions.each do |property| -%>
- <tr class="<%= cycle('even', 'odd', :name => 'properties') -%>">
+ <tr class="property <%= cycle('even', 'odd', :name => 'properties') -%>">
<td style="padding: 10px" id="block_<%= property.key -%>">
<h3>
<div><%= property_name(property) -%></div>
$j('.add_value').live('click', function () {
$j('.delete').show();
- var template = $j(this).siblings('.template');
- template.before(template.html());
+ var template = $j(this).parents('.property').find('.template').last();
+ template.clone().insertBefore(template).show();
+
return false;
});
</script>
-<div class="multi_value">
- <div class="field">
- <label><%= message('key') %>:</label>
- <%= text_field_tag "property_sets[#{property.key}][]", set_key, :size => 50 -%>
- <a href="#" class="delete link-action"><%= message('delete') -%></a>
- </div>
+<tr class="multi_value <%= 'template' unless set_key -%>" style="<%= 'display:none' unless set_key -%>">
+ <td><%= text_field_tag "property_sets[#{property.key}][]", set_key, :size => 50 -%></td>
<% property.fields.each do |field| -%>
<% key = "#{property.key}.#{set_key}.#{field.key}" if set_key -%>
<% value = Property.value(key, resource_id) if set_key -%>
- <div class="field">
- <label><%= field_name(property, field) -%>: </label>
- <%= render "settings/type_#{field.type}", :property => field, :field => field, :value => value, :name => "#{property.key}[#{field.key}][]", :id => "input_#{h field.key}" -%>
-
- <% desc=field_description(property, field) -%>
- <% unless desc.blank? %>
- <p class="note"><%= desc -%></p>
- <% end -%>
-
- <%= render "settings/error", :key => key -%>
- </div>
+ <td><%= render "settings/type_#{field.type}", :property => field, :field => field, :value => value, :name => "#{property.key}[#{field.key}][]", :id => "input_#{h field.key}" -%></td>
<% end -%>
- <br/>
-</div>
+
+ <td><a href="#" class="delete link-action"><%= message('delete') -%></a></td>
+</tr>
<% resource_id = @resource.id if @resource -%>
-<% Property.values(property.key, resource_id).reject(&:blank?).each do |set_key| -%>
- <%= render 'settings/set_instance', :property => property, :set_key => set_key, :resource_id => resource_id %>
-<% end -%>
+<table class="data">
+ <thead>
+ <tr>
+ <th><%= message('key') -%></th>
+ <% property.fields.each do |field| -%>
+ <th><%= field_name(property, field) -%></th>
+ <% end -%>
+ <th></th>
+ </tr>
+ </thead>
-<div class="template" style="display:none;">
+ <tbody>
+ <% Property.values(property.key, resource_id).reject(&:blank?).each do |set_key| -%>
+ <%= render 'settings/set_instance', :property => property, :set_key => set_key, :resource_id => resource_id %>
+ <% end -%>
<%= render 'settings/set_instance', :property => property, :set_key => nil, :resource_id => resource_id %>
-</div>
-<button class="add_value"><%= message('settings.add') -%></button>
+ </tbody>
+
+ <tfoot>
+ <tr>
+ <td>
+ <button class="add_value"><%= message('settings.add') -%></button>
+ </td>
+ </tr>
+ </tfoot>
+</table>
}
div.autocomplete {
+ position: absolute;
+ width: 600px;
+ right: 10px;
+ top: 10px;
background-color: #fff;
border: 1px solid #ccc;
margin: 0;
padding: 0;
color: #111;
line-height: 18px;
- box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.5);
+ -moz-box-shadow: 0 0 10px 5px #EFEFEF;
+ -webkit-box-shadow: 0 0 10px 5px #EFEFEF;
+ -o-box-shadow: 0 0 10px 5px #EFEFEF;
+ box-shadow: 0 0 10px 5px #EFEFEF;
z-index: 999999;
}
box-sizing: border-box; /* Opera/IE 8+ */
}
-.field {
- margin-bottom: 5px;
-}
-
-.field label {
- text-align: right;
- width: 80px;
- display: block;
- float: left;
- line-height: 1;
- word-wrap: break-word;
- position: relative;
- padding-top: 5px;
- padding-right: 5px;
-}
-
-.field .note, .field .error {
- margin-top: 3px;
- margin-left: 88px;
-}
-
.coverage tr {
line-height: 1.8em;
}