Sha256: a987c46cca03ca16376ce7e67cee4e0330e67ce2206efafca4c6c80a9def671e
Contents?: true
Size: 1.83 KB
Versions: 6
Compression:
Stored size: 1.83 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 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 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
6 entries across 6 versions & 1 rubygems