= simple_form_for [:admin, @home] do |f| .row#home .col-12.text-left %h2 Administração de Homes .col-md-12 = f.input :title, label: false, placeholder: "Digite um título para a home" .row.primary_section .col-12.text-left.mt-4 %h2.mb-5 Banner .row %div.col-md-12 = f.input :top_banner_description, label: false, placeholder: "Digite um título para o Banner" %div.col-md-12 = f.input :top_banner_link, label: false, placeholder: "Digite um link para o Banner" %div.col-md-12{'data-crop-container' => true} - home_image_base64 = '' - if home.top_banner.present? - home_image_base64 = "data:image/png;base64,#{Base64.encode64(home.top_banner.read)}" = image_tag(home.top_banner_url.to_s, class: "menu_icon image-preview", 'width'=>1110) = f.text_field :top_banner, value: home_image_base64, class: 'base64CropedImage d-none' %input{type:'file', 'data-file'=>true} = render partial: '/layouts/site/crop_modal' %input.crop-config{type:'hidden', 'width'=>1110, 'height'=>278} .row.primary_section .col-12.text-left.mt-4 %h2.mb-5 Seção principal .row - index = -1 = f.simple_fields_for :home_primary_section do |hpc| = hpc.simple_fields_for :home_contents do |hc| - index += 1 .col-3 = render 'card_form_primary', hc: hc, index: index, home: home .row.secondary_section.mt-5 .col-12 %h2 Seções secundárias - index_section = -1 = f.simple_fields_for :home_secondary_sections do |hsc| - index_section += 1 - index_content = -1 %h2.mt-5 Pilar #{index_section + 1} = hsc.association :section, label: false .row = hsc.simple_fields_for :home_contents do |hc| - index_content += 1 .col-md-4 = render 'card_form_secondary', hc: hc, index_section: index_section, index_content: index_content, home: home .row.submit_buttons.ml-auto .col-12.py-5 = f.button :submit, value: 'salvar', class: "btn btn-primary" = link_to "cancelar", :back, class: "btn btn-secondary"