generated from OmarMWarraich/ROR-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b24dd0f
commit 77c83c6
Showing
14 changed files
with
106 additions
and
75 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
class PublicRecipesController < ApplicationController | ||
def index | ||
@recipes = Recipe.all | ||
@public_recipes = @recipes.where(public: true) | ||
end | ||
def index | ||
@recipes = Recipe.all.where(public: true) | ||
end | ||
end |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,28 @@ | ||
<p style="color: green"><%= notice %></p> | ||
|
||
<h1>Foods</h1> | ||
<h1 class='text-center'>Foods</h1> | ||
|
||
<div id="foods"> | ||
<div class='container' style='margin-top:2.5rem;'> | ||
<div class='align-left' style='margin-bottom:5rem;'> | ||
<%=link_to "Add Food", new_food_path, class: "large-button" %> | ||
</div> | ||
<ul class='grid-container'> | ||
<li>Food</li> | ||
<li>Measurement Unit</li> | ||
<li>Price</li> | ||
<li>Actions</li> | ||
</ul> | ||
<% @foods.each do |food| %> | ||
<%= render food %> | ||
<p> | ||
<%= link_to "Show this food", food %> | ||
</p> | ||
<% end %> | ||
<ul class='grid-container'> | ||
<li><%= food.name %></li> | ||
<li><%= food.measurement_unit %></li> | ||
<li><%= food.price %></li> | ||
<li> | ||
<%= button_to "Delete", food_path(food.id), method: :delete, class:'large-button' %> | ||
</li> | ||
</ul> | ||
<% end %> | ||
</div> | ||
|
||
<%= link_to "New food", new_food_path %> | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
<p style="color: green"><%= notice %></p> | ||
|
||
<%= render @food %> | ||
<h1 class='text-center'>Public Recipes</h1> | ||
|
||
<div> | ||
<%= link_to "Edit this food", edit_food_path(@food) %> | | ||
<%= link_to "Back to foods", foods_path %> | ||
|
||
<%= button_to "Destroy this food", @food, method: :delete %> | ||
<div class='container' style='margin-top:2.5rem;'> | ||
<%= link_to recipe_path(@recipe) do %> | ||
<% @recipes.each do |recipe| %> | ||
<div class='grid'> | ||
<div class='recipe-card'> | ||
<div class='flex-col'> | ||
<%= recipe.name %> | ||
<%= recipe.user.name %> | ||
</div> | ||
<div> | ||
<p>Total Food Items: </p> | ||
<p>Total Price: </p> | ||
</div> | ||
</div> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
<div> | ||
<div class='container'> | ||
<h1 class='text-center' style='margin:3rem 0;'>Public Recipes</h1> | ||
<div class='grid'> | ||
<p style="color: green"><%= notice %></p> | ||
|
||
<% @recipes.each do |recipe| %> | ||
<% if recipe.public == true %> | ||
<div class='recipe-card'> | ||
<div class='flex-col'> | ||
<div> | ||
<p><%= recipe.name %></p> | ||
</div> | ||
<div> | ||
<%= link_to 'Delete', recipe_path(recipe), method: :delete, data: { confirm: 'Are you sure?' } %> | ||
<h1 class='text-center'>Public Recipes</h1> | ||
|
||
<div class='container public' style='margin-top:2.5rem;'> | ||
<% @recipes.each do |recipe| %> | ||
<%= link_to recipes_url do %> | ||
<div class='grid' style='margin-bottom:2rem;'> | ||
<div class='recipe-card'> | ||
<div class='flex-col'> | ||
<p><%= recipe.name %></p> | ||
<p><%= recipe.user.name %></p> | ||
</div> | ||
<div> | ||
<p>Total Food Items: </p> | ||
<p>Total Price: </p> | ||
</div> | ||
</div> | ||
</div> | ||
<div> | ||
<p><%= recipe.description %></p> | ||
</div> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
</div> |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
<p style="color: green"><%= notice %></p> | ||
|
||
<h1>Recipes</h1> | ||
<h1 class='text-center'>Recipes</h1> | ||
|
||
<div id="recipes"> | ||
<% @recipes.each do |recipe| %> | ||
<%= render recipe %> | ||
<p> | ||
<%= link_to "Show this recipe", recipe %> | ||
</p> | ||
<% end %> | ||
<div class='container' style='margin-top:2.5rem;'> | ||
<div class='align-left' style='margin-bottom:5rem;'> | ||
<%=link_to "Add Recipe", new_recipe_path, class: "large-button" %> | ||
</div> | ||
</div> | ||
|
||
<%= link_to "New recipe", new_recipe_path %> | ||
<% @recipes.each do |recipe| %> | ||
<div class='recipe-card' style='margin-top:2.5rem;'> | ||
<div> | ||
<h3 style='margin-bottom:0.6rem;'>Recipe <%= recipe.id %></h3> | ||
<%= button_to "Delete", recipe_path(recipe.id), method: :delete, class:'large-button' %> | ||
</div> | ||
<%= link_to recipe_path(recipe.id) do %> | ||
<div> | ||
<p><%= recipe.description %></p> | ||
</div> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,3 @@ | |
<%= render "form", recipe: @recipe %> | ||
|
||
<br> | ||
|
||
<div> | ||
<%= link_to "Back to recipes", recipes_path %> | ||
</div> |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe 'PublicRecipes', type: :request do | ||
describe 'GET /index' do | ||
it 'returns http success' do | ||
get '/public_recipes/index' | ||
expect(response).to have_http_status(:success) | ||
end | ||
RSpec.describe "PublicRecipes", type: :request do | ||
describe "GET /index" do | ||
pending "add some examples (or delete) #{__FILE__}" | ||
end | ||
end |