<%# This is ancient code, needs a lot of refactoring when I or someone can get around to it. In the meantime, it works. %> <% title ||= name %> <% container ||= '' %> <% system_controlled = false if system_controlled.nil? %> <% form_id ||= nil %> <% attributes_key ||= nil %> <% attributes = lookup_attributes(attributes_key) unless attributes_key.blank? %> <% totals = Array.new(attributes.size) %> <% total_columns ||= [] %> <% total_columns.each {|total_column| totals[total_column - 1] = 0.00} %> <% begin hidden_fields = "#{name.classify}::HIDDEN_FIELDS".constantize rescue NameError, LoadError hidden_fields = [] end %>
<% if container.empty? %> <% end %>
<% attributes.each do |attribute| %> <% end %> <%= render partial: 'bulma_form_rails/child', collection: children, locals: { name: name, container: container, attributes: attributes, last: false, system_controlled: system_controlled, totals: totals, attributes_key: attributes_key, form_id: form_id } %> <% unless total_columns.empty? %> <% totals.each do |total| %> <% end %> <% end %> <% unless system_controlled %> <%= render partial: 'bulma_form_rails/child', locals: { child: eval("#{name.capitalize.gsub(/_(.)/) {|s| $1.capitalize}}.new"), container: container, child_counter: children.size, name: name, attributes: attributes, attributes_key: attributes_key, form_id: form_id, last: true, system_controlled: false } %> <% end %>
<% if not hidden_fields.include? attribute.to_sym %> <% if attribute[-3..-1] == "_id" -%> <%= attribute[0..-3].tr("_", " ").capitalize_words %> <% else -%> <%= attribute.tr("_", " ").split.each(&:capitalize!).join ' ' %> <% end -%> <% end -%>
<%= total.nil? ? '' : raw("#{ASAP::Money.new(:amount => total).to_html}") %>