Created
May 31, 2019 03:58
-
-
Save leemcalilly/1e2927fad26cfa1481a51899cfcd881b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# _form.html.erb | |
<%= f.fields_for :options do |builder| %> | |
<%= render 'option_fields', f: builder %> | |
<% end %> | |
# _option_fields.html.erb | |
<fieldset class='form-group'> | |
<%= f.hidden_field :account_id, value: current_user.account.id %> | |
<%= f.label :name, 'Option' %> | |
<%= f.text_field :name, class: 'form-control' %> | |
<br> | |
<%= f.check_box :_destroy, class: 'form-check-input' %> | |
<%= f.label :_destroy, 'Remove Option' %> | |
<small id="optionHelp" class="form-text text-muted"> | |
(e.g. "Size" or "Color") | |
</small> | |
<%= f.fields_for :option_values do |builder| %> | |
<%= render partial: 'option_value_fields', f: builder %> | |
<% end %> | |
</fieldset> | |
# _option_value_fields.html.erb | |
<fieldset class='form-group'> | |
<%= f.hidden_field :account_id, value: current_user.account.id %> | |
<%= f.label :name, 'Value' %> | |
<%= f.text_field :name, class: 'form-control' %> | |
<br> | |
<%= f.check_box :_destroy, class: 'form-check-input' %> | |
<%= f.label :_destroy, 'Remove Value' %> | |
<small id="optionValueHelp" class="form-text text-muted"> | |
(e.g. "Small, Medium, Large" or "Red, Green, Blue") | |
</small> | |
</fieldset> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment