Skip to content

Commit

Permalink
Update application.css file
Browse files Browse the repository at this point in the history
  • Loading branch information
Gardimy committed Sep 30, 2023
1 parent 2a933e5 commit ee9a0f6
Show file tree
Hide file tree
Showing 20 changed files with 229 additions and 297 deletions.
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ group :test do
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem 'capybara'
gem 'rspec-rails'
gem 'rails-controller-testing'
gem 'selenium-webdriver'
gem 'webdrivers'
gem 'shoulda-matchers'
gem 'webdrivers'
end
154 changes: 48 additions & 106 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ body {
font: 500 0.8em "Lato", sans-serif;
text-align: center;
}

/* Updated CSS for the nav */
.sign_in_user_bar {
margin-top: 0; /* Add this to remove any top margin */
padding-top: 0; /* Add this to remove any top padding */
margin-top: 0;
padding-top: 0;
background: #2d2738;
opacity: 0.95;
}
Expand All @@ -41,6 +42,7 @@ body {
width: 70%;
margin: 0 auto;
}

ul li {
margin: 0;
padding: 10px 0 10px 0;
Expand All @@ -59,6 +61,7 @@ li.active {
color: orange;
transform: scale(1.1);
}

a {
background-color: #282928;
color: rgb(210, 205, 205); /* Set the link color to white */
Expand Down Expand Up @@ -172,6 +175,7 @@ form div {
label {
width: 20%;
}

.cont {
margin: 0 auto;
max-width: 59rem;
Expand All @@ -180,6 +184,7 @@ label {
background-color: greenyellow;
opacity: 0.8;
}

.register {
background-color: #333;
margin: 3em auto;
Expand Down Expand Up @@ -211,6 +216,7 @@ input[type=checkbox] {
opacity: 0.8;
border-radius: 0.5rem;
}

.links {
display: flex;
gap: 1em;
Expand All @@ -232,40 +238,12 @@ input[type=checkbox] {
opacity: 0.8;
}


/* .container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
} */

/* h1 {
text-align: center;
margin-top: 20px;
} */

header {
background-color: #333;
color: #fff;
padding: 10px 0;
}

/* nav ul {
list-style: none;
}
nav ul li {
display: inline;
margin-right: 20px;
}
nav ul li:last-child {
margin-right: 0;
} */

.notice {
background-color: #4caf50;
color: aliceblue;
Expand All @@ -274,7 +252,7 @@ nav ul li:last-child {
max-width: 8em;
position: fixed;
bottom: 0;
right: 2.5em;
right: 2.5em;
}

.alert {
Expand All @@ -285,7 +263,7 @@ nav ul li:last-child {
max-width: 8em;
position: fixed;
bottom: 0;
right: 1em;
right: 1em;
}

footer {
Expand All @@ -307,121 +285,82 @@ footer {
opacity: 0.8;
gap: 5em;
}
.recipe{

.recipe {
display: flex;
background-color: rgb(109 111 107);
opacity: 0.8;
color: #fcfcfc;
font-size: medium;
}
.recipe p{

.recipe p {
width: 85%;
}
.recipe div{

.recipe div {
display: flex;
flex-direction: column;
gap: 1em;
}
.total_info{

.total_info {
display: flex;
gap: 1em;
justify-content: center;
}
#shopping{

#shopping {
display: flex;
flex-direction: column;
gap: 1em;
font-size: medium;
}
.recipe_name a{

.recipe_name a {
font-size: larger;
color: #ef005c;
padding: 0;
border-radius: 0%;
padding: 0.5em;
background-color: rgb(237 242 231);
}
.Delete button {
color: white;
background-color: #17141d;
opacity: 0.8;
border-radius: 0.5rem;
}

.field {
margin-bottom: 20px;
}

#is_public {
justify-content: flex-end;
display: flex;
color: white;
}

#is_public button{
background-color: #2d2e2d;
color: white;
}
#is_public button:hover{
background-color: rgb(231, 103, 103);
}
.detailsDiv{
flex-direction: column;
display: flex;
margin: 0 auto;
max-width: 59rem;
padding: 1em;
color: rgb(34, 32, 32);
background-color: greenyellow;
opacity: 0.8;
}
.recipe-food-actions a, .recipe-food-actions button{
.recipe-food-actions a,
.recipe-food-actions button {
display: inline-block;
padding: 1em;
box-shadow: 0 103px 100px rgb(252 251 251 / 20%);
padding: 1em;
box-shadow: 0 103px 100px rgb(252 251 251 / 20%);
}


/* label {
font-weight: bold;
display: block;
} */

/* input[type="text"],
input[type="number"],
textarea {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
} */

/* .checkbox {
display: inline;
margin-right: 10px;
#is_public button {
background-color: #2d2e2d;
color: white;
}

.actions {
margin-top: 20px;
} */

/* button,
input[type="submit"] {
background-color: #333;
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
#is_public button:hover {
background-color: rgb(231, 103, 103);
}

button:hover,
input[type="submit"]:hover {
background-color: #555; */
/* }
.buttons {
text-align: right;
margin-top: 20px;
} */
.detailsDiv {
flex-direction: column;
display: flex;
margin: 0 auto;
max-width: 59rem;
padding: 1em;
color: rgb(34, 32, 32);
background-color: greenyellow;
opacity: 0.8;
}

.toggle-button {
padding: 10px 20px;
Expand Down Expand Up @@ -452,6 +391,7 @@ input[type="submit"]:hover {
justify-content: space-between;
flex-direction: column;
}

.btn {
display: inline-block;
margin-right: 10px;
Expand Down Expand Up @@ -492,9 +432,11 @@ input[type="submit"]:hover {
.item-info {
display: flex;
}
#recipe_id{
justify-content:space-around;

#recipe_id {
justify-content: space-around;
}

small {
color: black;
display: flex;
Expand Down
48 changes: 24 additions & 24 deletions app/controllers/foods_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,30 @@ def destroy
end

def general_shopping_list
@recipes = Recipe.where(user: current_user)
@general_food_list = Food.where(user: current_user)
@missing_food_items = []
@recipes.each do |recipe|
recipe.recipe_foods.each do |recipe_food|
general_food = @general_food_list.find_by(id: recipe_food.food_id)
if general_food.nil? || general_food.quantity < recipe_food.quantity
quantity_needed = recipe_food.quantity - (general_food&.quantity || 0)
price = recipe_food.food.price * quantity_needed

@missing_food_items << {
food_name: recipe_food.food.name,
quantity_needed: quantity_needed,
price: price
}
end
end
end
@total_food_items = @missing_food_items.sum { |item| item[:quantity_needed] }
@total_price = @missing_food_items.sum { |item| item[:price] }
end
@recipes = Recipe.where(user: current_user)
@general_food_list = Food.where(user: current_user)
@missing_food_items = []

@recipes.each do |recipe|
recipe.recipe_foods.each do |recipe_food|
general_food = @general_food_list.find_by(id: recipe_food.food_id)

next unless general_food.nil? || general_food.quantity < recipe_food.quantity

quantity_needed = recipe_food.quantity - (general_food&.quantity || 0)
price = recipe_food.food.price * quantity_needed

@missing_food_items << {
food_name: recipe_food.food.name,
quantity_needed:,
price:
}
end
end

@total_food_items = @missing_food_items.sum { |item| item[:quantity_needed] }
@total_price = @missing_food_items.sum { |item| item[:price] }
end

private

Expand Down
Loading

0 comments on commit ee9a0f6

Please sign in to comment.