lib/formtastic/inputs/grid_input.rb in lalala-4.0.0.dev.132 vs lib/formtastic/inputs/grid_input.rb in lalala-4.0.0.dev.133

- old
+ new

@@ -9,14 +9,17 @@ asset_attributes = asset_model_class.accessible_attributes.to_a asset_attributes.select! { |x| x.size > 0 and !%w(asset translations_writer).include?(x) } ul = template.content_tag :ul do html = template.raw("") + asset_errors = [] assets.each_with_index do |asset, idx| html += template.content_tag :li, class: "asset" do builder.fields_for(method, asset) do |f| + asset_errors.concat(asset.errors.to_a) + lalala_thumb = f.object.asset.lalala_thumb if url = lalala_thumb.try(:url) link_inner_html = template.image_tag(url) else @@ -32,10 +35,23 @@ template.raw(inputs.join) + template.content_tag( :a, template.raw("✕"), class: "close-button" ) end + asset_html + end + end + end + + if asset_errors.present? + html += template.content_tag :li, class: "errors" do + template.content_tag :ul do + errors_html = template.raw("") + asset_errors.each do |error| + errors_html += template.content_tag(:li, error) + end + errors_html end end end html += template.content_tag :li do