Sha256: 3388abe73a08e93f6cbf4a858605a579ed4a0ac841959e1e396cb841701744ca

Contents?: true

Size: 1.87 KB

Versions: 6

Compression:

Stored size: 1.87 KB

Contents

- for_context ||= context

- if for_context.is_a?(AdminIt::NewContext)
  - action = for_context.resource.collection_path
- elsif for_context.is_a?(AdminIt::EditContext)
  - action = for_context.resource.single_path(for_context.entity)

form(
  class="form-horizontal"
  role="form"
  action==action
  method="POST"
)
  input name="authenticity_token" type="hidden" value==form_authenticity_token
  - if for_context.is_a?(AdminIt::EditContext)
    input name="_method" type="hidden" value="patch"

  - if for_context.child?
    input name="redirect" type="hidden" value="test"

  - if for_context.sections.size > 0
    ul class="nav nav-tabs"
      - for_context.sections.each do |section|
        li class="#{section.name == for_context.section ? 'active' : ''}"
          a href="##{section.name}" data-toggle="tab"
            = section.display_name
    div class="tab-content"
      - for_context.sections.each do |section|
        div class="tab-pane #{section.name == for_context.section ? 'active' : ''}" id==section.name
          - if section.fields.size > 0
            - 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
            - c = section.render(for_context.entity, for_context)
            - if c.is_a?(AdminIt::Context)
              = render partial: File.join(%W(admin_it shared child)), \
                       locals: { for_context: for_context, child: c }
  - else
    = render partial: File.join(%w(admin_it shared fields)), \
             locals: { fields: for_context.fields(scope: :all) }

  - content_for :buttons do
    button class="btn btn-primary" = t('admin_it.action.save')

  - if for_context.layout.empty?
    div class="form-group"
      div class="col-sm-10 col-sm-offset-2"
        = yield :buttons

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
admin_it-1.1.0 app/views/admin_it/shared/_form.html.slim
admin_it-1.0.11 app/views/admin_it/shared/_form.html.slim
admin_it-1.0.10 app/views/admin_it/shared/_form.html.slim
admin_it-1.0.9 app/views/admin_it/shared/_form.html.slim
admin_it-1.0.8 app/views/admin_it/shared/_form.html.slim
admin_it-1.0.7 app/views/admin_it/shared/_form.html.slim