Sha256: 4d6e5e9534a1bf8433cf128485e148b6de91d669730a720f0c0e1a86ecd69a0a

Contents?: true

Size: 1.96 KB

Versions: 1

Compression:

Stored size: 1.96 KB

Contents

- if has_template? "_#{view_prefix}.#{field}"
  = render "#{view_prefix}.#{field}", :f => f, :name => field

- else
  - new_view_prefix = "#{view_prefix}.#{field}"


  - case reflection.macro
  - when :has_many
    - sortable_objects = reflection.klass.column_names.include?('position')
    .nested_wrap{:'data-name' => field}
      .nested_title= I18n.t(field)
      .list{:'data-sortable' => sortable_objects ? '' : nil}

        .item.template{:style => 'display:none;'}
          = f.fields_for field, reflection.klass.new, :child_index => '_template_' do |ff|
            = render 'edit.fields.has_many_template', :ff => ff, :sortable_objects => sortable_objects, :subfields => subfields, :view_prefix => new_view_prefix, :field => field

        - f.object.send(field).each_with_index do |obj, i|
          .item
            = f.fields_for field, obj, :child_index => i do |ff|
              = render 'edit.fields.has_many_template', :ff => ff, :sortable_objects => sortable_objects, :subfields => subfields, :view_prefix => new_view_prefix, :field => field


      %button.add.new(type='button')
        = image_tag 'releaf/icons/add.png', :atl => ''
        %span= I18n.t("New")


  - when :belongs_to
    .nested_wrap{:'data-name' => field}
      .nested_title= I18n.t(field)
      .item
        = f.fields_for field, f.object.send(field) do |ff|

          - if subfields.is_a? Array
            - subfields.each do |subfield|
              - if has_template? "_#{new_view_prefix}.#{subfield}"
                = render "#{new_view_prefix}.#{subfield}", :f => ff, :name => subfield
              - else
                = render 'edit.fields', :f => ff, :fields => subfields, :view_prefix => new_view_prefix

          - elsif subfields.is_a? String or subfields.is_a? Symbol
            - if has_template? "_#{new_view_prefix}.#{field}"
              = render "_#{new_view_prefix}.#{field}", :f => ff, :name => field
            - else
              = render 'edit.field', :f => ff, :name => field

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
releaf-0.1.2 app/views/releaf/base/_edit.fields.association.html.haml