Sha256: aedf7444def1405162644f4424ba98b1b861654b24e9ca623533ba622304b718

Contents?: true

Size: 1.84 KB

Versions: 22

Compression:

Stored size: 1.84 KB

Contents

%repeater-field{ :':row-count' => field.rows.size, :'inline-template' => true }
  .repeater-field
    %table
      - if field.grid?
        %thead
          %tr
            - field.fields.each do |(_, fd)|
              %th= label_tag fd.label
            %th  

      %tbody.rows
        // Static existing rows
        - field.rows.each do |row|
          = f.fields_for field.name, row, index: nil do |r|
            %tr
              - if field.grid?
                - row.fields.each do |name, sub_field|
                  %td= render_field sub_field, r, id: nil
              - else
                %td
                  .repeater-field
                    %table
                      %tbody
                        - row.fields.each do |key, sub_field|
                          %tr
                            %th= r.label sub_field.name, sub_field.label
                            %td= render_field sub_field, r
              %td.remove
                %a.alert{ :'v-remove-row' => true }= ficon(:x)

        // Dynamic rows
        = f.fields_for field.name, field.structure, index: nil do |r|
          %tr{ :'v-for' => 'row in rows', :'track-by' => 'id' }
            - if field.grid?
              - field.fields.each do |name, sub_field|
                %td= render_field sub_field, r, id: nil
            - else
              %td
                .repeater-field
                  %table
                    %tbody
                      - field.fields.each do |key, sub_field|
                        %tr
                          %th= r.label sub_field.name, sub_field.label
                          %td= render_field sub_field, r, id: nil
            %td.remove
              %a.alert{ :'v-on:click.prevent' => 'removeRow(row)' }= ficon(:x)

    .plus
      %a.button.success.tiny.radius{ :'v-on:click.prevent' => 'addRow()' }
        = ficon :plus, 'Add row'

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
push_type_admin-0.9.0.beta.3 app/views/push_type/fields/_matrix.html.haml
push_type_admin-0.9.0.beta.2 app/views/push_type/fields/_matrix.html.haml