<%= form_with method: method, model: @record, url: url, local: true do |form| %> <%-dynamic_scaffold.form.items.each do |elem|-%> <% if elem.needs_rendering?(self)%> <% if !elem.label? && elem.type?(:hidden_field) %> <%= elem.render(self, form) %> <% else %> <%- errors = elem.errors(@record) -%>
<%- elem.insert(:before).each do |block| -%> <%= self.instance_exec(@record, &block) %> <%-end-%> <% if elem.type? :collection_check_boxes %> <%= elem.render(self, form) do |cb|%>
<%= cb.label class: 'form-check-label' do%> <%= cb.check_box class: 'form-check-input' %> <%= cb.text %> <%end%>
<%end%> <% elsif elem.type? :collection_radio_buttons %> <%= elem.render(self, form) do |cb|%>
<%= cb.label class: 'form-check-label' do%> <%= cb.radio_button class: 'form-check-input' %> <%= cb.text %> <%end%>
<%end%> <% elsif elem.type? :carrierwave_image %> <%- image = form.object.public_send(elem.name) -%>
<% if elem.options[:removable] %>
<% end %>
<%- if elem.cropper.present? -%> <%= form.hidden_field "cropper_#{elem.name}", class: "js-ds-image-cropper", data:{options: elem.cropper.to_json} %>
<%- end -%>
<%= form.hidden_field "remove_#{elem.name}", value: "1", disabled:"disabled", class: 'js-ds-image-remove-flag' if elem.options[:removable]%> <%= elem.render(self, form, 'form-control-file js-ds-image') do |attr|%> <%= form.file_field(elem.name, attr) %> <%end%> <%= form.hidden_field "#{elem.name}_cache" %>
<% else %> <%= elem.render(self, form, class_names('form-control', {'is-invalid': errors.present?})) %> <% end %> <%- elem.insert(:after).each do |block| -%> <%= self.instance_exec(@record, &block) %> <%-end-%>
<%- if errors.present? -%> <%- end -%> <%if elem.notes?%>
<%= elem.render_notes(form.object, self) %>
<%end%>
<% end %> <% end %> <% end %>
<%= link_to dynamic_scaffold_path(:index, request_queries), class: 'btn btn-outline-secondary btn-default back' do%> <%= dynamic_scaffold_icon :back %> <%= t('dynamic_scaffold.button.back') %> <%end%>
<% end %>