Sha256: 76ba5d626f232036e1f77fdc479869e5a6c5f276975f12ebe972dbe69c2e2851

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 context.layout == ''
    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.0.6 app/views/admin_it/shared/_form.html.slim
admin_it-1.0.5 app/views/admin_it/shared/_form.html.slim
admin_it-1.0.4 app/views/admin_it/shared/_form.html.slim
admin_it-1.0.3 app/views/admin_it/shared/_form.html.slim
admin_it-1.0.2 app/views/admin_it/shared/_form.html.slim
admin_it-1.0.1 app/views/admin_it/shared/_form.html.slim