*/
String key();
- /**
- * The empty string "" is considered as null, so it's not possible to have empty strings for default values.
- */
- String defaultValue() default "";
-
/**
* This name will be displayed on the Settings page. This can be overridden/translated
* by adding a a value for: <code>field.{key of parent property}.{key of this field}.name</code> in the language bundle.
*/
public final class PropertyFieldDefinition {
private final String key;
- private final String defaultValue;
private final String name;
private final String description;
private final int indicativeSize;
private PropertyFieldDefinition(PropertyField annotation) {
this.key = annotation.key();
- this.defaultValue = annotation.defaultValue();
this.name = annotation.name();
this.description = annotation.description();
this.indicativeSize = annotation.indicativeSize();
return key;
}
- public String getDefaultValue() {
- return defaultValue;
- }
-
public String getName() {
return name;
}
# clear
Property.with_key_prefix(key + '.').with_resource(resource_id).delete_all
+ if params[key][:auto_generate]
+ set_keys = Array.new(set_keys.size - 1) { |i| i.to_s }
+ end
+
# set keys
update_property(key, set_keys, resource_id)
set_keys.each do |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 -%>
- <%= hidden_field_tag "property_sets[#{property.key}][]", set_key -%>
+ <%= hidden_field_tag "property_sets[#{property.key}][]", 'auto-generated' -%>
<% end -%>
<% property.fields.reject { |field| field.key == 'key' }.each do |field| -%>
<tr>
<% if key_field(property) -%>
<th><%= message('key') -%></th>
+ <% else %>
+ <%= hidden_field_tag "#{property.key}[auto_generate]", true -%>
<% end -%>
<% property.fields.reject { |field| field.key == 'key' }.each do |field| -%>
<th>