move swag fields to partial
This commit is contained in:
parent
93f7e07ebe
commit
e55509183c
5 changed files with 21 additions and 23 deletions
|
|
@ -22,14 +22,12 @@
|
|||
off_color: 'warning',
|
||||
on_text: 'Yes',
|
||||
off_text: 'No' }
|
||||
- @sponsor.swag_hash.each do |type, quantity|
|
||||
.row
|
||||
.col-md-6
|
||||
= f.input :type, label: 'Swag type'
|
||||
.col-md-6
|
||||
= f.input :quantity, as: :number, in: 0..9999
|
||||
- generate_swags_hash(@type, @quantity)
|
||||
= f.submit 'Add Swag', :type
|
||||
|
||||
- @sponsor.swag_hash.each_with_index do |k, v, index|
|
||||
=render partial: 'swag_fields', locals: {f: f, index: index}
|
||||
|
||||
|
||||
|
||||
.row
|
||||
.col-md-8
|
||||
= image_tag f.object.picture.thumb.url if f.object.picture?
|
||||
|
|
|
|||
5
app/views/admin/sponsors/_swag_fields.html.haml
Normal file
5
app/views/admin/sponsors/_swag_fields.html.haml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
.row
|
||||
.col-md-6
|
||||
= text_field_tag "sponsor[swag_hash][#{index}][type]"
|
||||
.col-md-6
|
||||
= text_field_tag "sponsor[swag_hash][#{index}][quantity]"
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<div class="swag_fields">
|
||||
<%= f.inputs do %>
|
||||
<%= f.input :type, label: 'Swags type' %>
|
||||
<%= f.input :quantity, label: 'Swags quantity', as: :number, in: 0..9999 %>
|
||||
<%- generate_swags_hash(@type, @quantity) %>
|
||||
<% end %>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue