- for_context ||= context - parent = for_context.child? ? for_context.parent : for_context - resource = for_context.resource - if for_context.is_a?(AdminIt::NewContext) - action = resource.collection_path - elsif for_context.is_a?(AdminIt::EditContext) - action = resource.single_path(for_context.entity) / images - for_context.fields(scope: { editor: :image }).each do |field| - locals = { field: field, for_context: for_context } = render partial: File.join(%w(admin_it editors image)), locals: locals form.form-horizontal role="form" action=action method="POST" input name="authenticity_token" type="hidden" value=form_authenticity_token input name="section" type="hidden" value=parent.section - if for_context.child? input name="parent" type="hidden" value=for_context.parent.to_link - if for_context.is_a?(AdminIt::EditContext) input name="_method" type="hidden" value="patch" - if for_context.sections.size > 0 ul.nav.nav-tabs - for_context.sections.each do |section| li class="#{section.name == for_context.section ? 'active' : ''}" a href="##{section.name}" data-toggle="tab" - if section.icon? i.fa> class="fa-#{section.icon}" = section.display_name .tab-content - for_context.sections.each do |section| .tab-pane class="#{section.name == for_context.section ? 'active' : ''}" id=section.name - if !section.renderable? - fields = for_context.fields.select do |f| - section.fields.include?(f.name) = render partial: File.join(%w(admin_it shared fields)), \ locals: { fields: fields } - else - rendered = section.render(for_context.entity, for_context) - rendered = [rendered] unless rendered.is_a?(Array) - rendered.each do |item| - if item.is_a?(AdminIt::Context) = render partial: File.join(%W(admin_it shared child)), \ locals: { for_context: for_context, child: item } - elsif item.is_a?(AdminIt::Partial) - locals = item.locals.merge(for_context: for_context) = render partial: item.name, locals: locals - elsif item.is_a?(String) == item - else = render partial: File.join(%w(admin_it shared fields)), \ locals: { fields: for_context.fields(scope: :all) } - content_for :buttons do button.btn.btn-primary type="submit" = t('admin_it.action.save') - if for_context.layout.empty? .form-group .col-sm-10.col-sm-offset-2 = yield :buttons .modal.fade#child_modal .modal-dialog.modal-lg .modal-content