app/views/carnival/shared/form/_field.html.haml in carnival-0.0.55 vs app/views/carnival/shared/form/_field.html.haml in carnival-0.0.56
- old
+ new
@@ -2,7 +2,15 @@
- current_type = field_type(model_presenter,field.name)
- options[:as] = :admin_enum if current_type == :enum
- options[:as] = :admin_relationship_select if current_type == :relation
- options[:as] = :admin_date if current_type == :date
- options[:as] = field.as if field.as.present?
-
+- options[:input_html] = {}
+- options[:input_html][:class] = "field-#{field.name}"
+- options[:input_html][:data] = {}
+- if field.depends_on.present?
+ - options[:input_html][:data][:depends_on] = field.depends_on
+ :javascript
+ $(".field-#{field.depends_on}").change(function(event, element){
+ updateDependentFormSelectHtml(element.selected, $(this).attr("name").match( /\[(.*)\]/)[1], $($(".field-#{field.name}").first()).attr("name").match( /\[(.*)\]/)[1]);
+ });
= f.input field.name, options