parsley/app/views/recipes/_form.html.erb

66 lines
2.1 KiB
Plaintext
Raw Normal View History

2016-01-13 17:10:43 -06:00
<%= form_for(@recipe, {html: {class: 'recipe-form'}}) do |f| %>
2016-01-12 18:43:00 -06:00
<%= render partial: 'shared/error_list', locals: {model: @recipe} %>
2016-01-13 17:10:43 -06:00
<div class="form-group">
<%= f.label :name %>
<%= f.text_field :name, class: 'form-control' %>
</div>
2016-01-12 18:43:00 -06:00
2016-01-13 17:10:43 -06:00
<div class="form-group">
<%= f.label :description %>
<%= f.text_area :description, class: 'form-control' %>
</div>
2016-01-12 18:43:00 -06:00
2016-01-13 17:10:43 -06:00
<div class="form-group">
<%= f.label :source %>
<%= f.text_field :source, class: 'form-control' %>
</div>
2016-01-12 18:43:00 -06:00
2016-01-13 17:10:43 -06:00
<div class="row">
<div class="col-xs-4">
<div class="form-group">
<%= f.label :yields %>
<%= f.number_field :yields, class: 'form-control', placeholder: 'Servings' %>
</div>
</div>
<div class="col-xs-4">
<div class="form-group">
<%= f.label :total_time %>
<%= f.number_field :total_time, class: 'form-control', placeholder: 'Minutes' %>
</div>
</div>
<div class="col-xs-4">
<div class="form-group">
<%= f.label :active_time %>
<%= f.number_field :active_time, class: 'form-control', placeholder: 'Minutes' %>
</div>
</div>
</div>
2016-01-12 18:43:00 -06:00
2016-01-13 17:10:43 -06:00
<h3>Ingredients</h3>
<div id="ingredient-list">
<%= f.fields_for :recipe_ingredients do |ri_form| %>
<%= render partial: 'recipes/editor/ingredient', locals: { f: ri_form } %>
<% end %>
</div>
<%= link_to_add_association 'Add Ingredient', f, :recipe_ingredients, partial: 'recipes/editor/ingredient', :'data-association-insertion-node' => '#ingredient-list', :'data-association-insertion-method' => 'append', class: 'btn btn-primary' %>
<h3>Steps</h3>
<div id="step-list">
<%= f.fields_for :recipe_steps do |rs_form| %>
<%= render partial: 'recipes/editor/step', locals: { f: rs_form } %>
<% end %>
</div>
2016-01-12 18:43:00 -06:00
2016-01-13 17:10:43 -06:00
<%= link_to_add_association 'Add Step', f, :recipe_steps, partial: 'recipes/editor/step', :'data-association-insertion-node' => '#step-list', :'data-association-insertion-method' => 'append', class: 'btn btn-primary' %>
<br/><br/>
2016-01-12 18:43:00 -06:00
<div class="actions">
<%= f.submit class: 'btn btn-primary' %>
</div>
<% end %>