Skip to content

Commit

Permalink
Default cook and prep time to zero on new. Flushed out views. Removed…
Browse files Browse the repository at this point in the history
… recipe variations from views for now.
  • Loading branch information
quattro004 committed Sep 18, 2010
1 parent 0b7a448 commit 20295b8
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
2 changes: 2 additions & 0 deletions app/controllers/recipes_controller.rb
Expand Up @@ -31,6 +31,8 @@ def new
@recipe = Recipe.new

1.times { @recipe.ingredient.build }
@recipe.cook_time_in_minutes = 0
@recipe.prep_time_in_minutes = 0

respond_to do |format|
format.html # new.html.erb
Expand Down
12 changes: 6 additions & 6 deletions app/views/recipes/_form.html.erb
Expand Up @@ -22,7 +22,7 @@
<p><%= link_to_add_fields 'Add Ingredient', f, :ingredient %></p>
</fieldset>
<div class="field">
<%= f.label :instructions %><br />
<%= f.label :instructions %> <small><i>(separate each by pressing Enter)</i></small><br />
<%= f.text_area :instructions, :size => '60x7' %>
</div>
<div class="field">
Expand All @@ -43,19 +43,19 @@
</div>
<div class="field">
<%= f.label :prep_time_in_minutes %><br />
<%= f.text_field :prep_time_in_minutes, :size => 5 %>
<%= f.text_field :prep_time_in_minutes, :size => 3 %>
</div>
<div class="field">
<%= f.label :cook_time_in_minutes %><br />
<%= f.text_field :cook_time_in_minutes, :size => 5 %>
<%= f.text_field :cook_time_in_minutes, :size => 3 %>
</div>
<div class="field">
<div class="field">
<%= f.label :yield %><br />
<%= f.text_field :yield, :size => 25 %>
</div>
<div class="field">
<%= f.label :variations %><br />
<%= f.text_area :variations, :size => '60x3' %>
Public<%= f.check_box :is_public %>
Secret<%= f.check_box :is_secret %>
</div>
<div class="actions">
<%= f.submit nil, :class => 'input' %>
Expand Down
5 changes: 2 additions & 3 deletions app/views/recipes/index.html.erb
Expand Up @@ -6,7 +6,6 @@
<th>Author</th>
<th>Picture</th>
<th>Comment</th>
<th>Variations</th>
<th>Category</th>
<th>Ingredients</th>
<th>Instructions</th>
Expand All @@ -21,7 +20,6 @@
<td><%= recipe.title %></td>
<td><%= recipe.author %></td>
<td><%= recipe.comment %></td>
<td><%= recipe.variations %></td>
<td><%= recipe.category_id %></td>
<td><%= recipe.instructions %></td>
<td><%= recipe.keywords %></td>
Expand All @@ -34,4 +32,5 @@

<br />

<%= link_to 'New Recipe', new_recipe_path %>
<%= link_to 'New Recipe', new_recipe_path %> |
<%= link_to 'Home', root_path %>
18 changes: 11 additions & 7 deletions app/views/recipes/show.html.erb
Expand Up @@ -21,12 +21,6 @@
</p>
<% end %>

<% unless @recipe.variations.empty? %>
<p>
<b>Variations:</b>
<%= @recipe.variations %>
</p>
<% end %>
<p>
<b>Category:</b>
<%= @recipe.category_id %>
Expand Down Expand Up @@ -67,5 +61,15 @@
<%= @recipe.cook_time_in_minutes %>
</p>

<!-- TODO: display picture -->

<p>
<b>Public:</b>
<%= @recipe.is_public %>
<b>Secret:</b>
<%= @recipe.is_secret %>
</p>

<%= link_to 'Edit', edit_recipe_path(@recipe) %> |
<%= link_to 'Back', recipes_path %>
<%= link_to 'Back', recipes_path %> |
<%= link_to 'Home', root_path %>

0 comments on commit 20295b8

Please sign in to comment.