Skip to content

Commit

Permalink
Fix marge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeanbulambo committed Nov 18, 2022
2 parents 11a0bc4 + 22594a9 commit 5cdd7af
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 52 deletions.
2 changes: 1 addition & 1 deletion app/controllers/foods_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class FoodsController < ApplicationController
before_action :set_food, only: %i[show destroy]

def index
@foods = Food.all
@foods = Food.includes(:user)
end

def destroy
Expand Down
27 changes: 16 additions & 11 deletions app/views/devise/sessions/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
<h2>Log in</h2>
<div>
<h2>Log in Page</h2>

<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
<div class="form-group">
<%= f.label :email %>
<%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control" %>
</div>

<div class="field">
<%= f.label :password %><br />
<%= f.password_field :password, autocomplete: "current-password" %>
<div class="form-group">
<br/>
<%= f.label :password %>
<%= f.password_field :password, autocomplete: "current-password", class: "form-control"%>
</div>

<% if devise_mapping.rememberable? %>
<div class="field">
<%= f.check_box :remember_me %>
<%= f.label :remember_me %>
<div class="form-group">
<br/>
<%= f.check_box :remember_me %> Remember me
<!--%# <%= f.label :remember_me %> % -->
</div>
<% end %>

<div class="actions">
<%= f.submit "Log in" %>
<br/>
<%= f.submit "Log in", class: "btn btn-primary" %>
</div>
</div>
<% end %>

<%= render "devise/shared/links" %>
3 changes: 2 additions & 1 deletion app/views/foods/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</div>
<% end %>

<div>
<div >
<%= form.label :name, style: "display: block" %>
<%= form.text_field :name %>
</div>
Expand All @@ -27,6 +27,7 @@
</div>

<div>
<br/>
<%= form.submit %>
</div>
<% end %>
15 changes: 8 additions & 7 deletions app/views/foods/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<section class="index-container">
<p style="color: green"><%= notice %></p>
<section class="index-container">
<div>
<h2>List of Foods</h2>
<div class=" Add_button">
<%= link_to 'Add Food', new_food_path %>
<div id="recipes" class="d-flex flex-column gap-3 float-end">
<%= link_to 'Add Food', new_food_path, class: 'btn btn-lg btn-primary'%>
</div>
<br>
<table class="table_food">
<br/><br/><br/>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Food</th>
<th>Measurement Unit</th>
<th>Price Unit</th>
<th>Action</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
Expand All @@ -22,7 +23,7 @@
<td><%= food.price %></td>
<div>
<td>
<% if can? :delete, food %><%= link_to'Delete', food, :method => :delete %><% end %>
<% if can? :delete, food %><%= link_to'Delete', food, :method => :delete, class: "btn btn-danger" %><% end %>
</td>
</tr>
</div>
Expand Down
3 changes: 2 additions & 1 deletion app/views/foods/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<h1>New food</h1>
<p style="color: green"><%= notice %></p><br/><br/>
<h1 class="lead">NEW FOOD</h1>

<%= render "form", food: @food %>

Expand Down
7 changes: 3 additions & 4 deletions app/views/foods/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<p style="color: green"><%= notice %></p>

<%= render @food %>

<div>
<div class="d-flex justify-content-center gap-3 container-lg mt-3 mb-3">
<%= link_to "Edit this food", edit_food_path(@food) %> |
<%= link_to "Back to foods", foods_path %>
<%= link_to "Back to foods", new_food_path, class: "btn btn-primary" %>

<%= button_to "Destroy this food", @food, method: :delete %>
<%= button_to "Confirm to delete", @food, method: :delete, class: "btn btn-danger"%>
</div>
54 changes: 27 additions & 27 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,40 @@
# movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }])
# Character.create(name: "Luke", movie: movies.first)

wayuni = User.create(name: 'wayungi' email: '[email protected]', password:'123456')
obella = User.create(name: 'obella', email: '[email protected]', password:'123456')
kibuuka = User.create(name: 'kibuuka', email: '[email protected]', password:'123456')
mahooro = User.create(name: 'mahooro', email: '[email protected]', password:'123456')
anzoyo = User.create(name: 'anzoyo', email: '[email protected]', password:'123456')
sali = User.create(name: 'sali', email: '[email protected]', password:'123456')
# wayuni = User.create(name: 'wayungi' email: '[email protected]', password:'123456')
# obella = User.create(name: 'obella', email: '[email protected]', password:'123456')
# kibuuka = User.create(name: 'kibuuka', email: '[email protected]', password:'123456')
# mahooro = User.create(name: 'mahooro', email: '[email protected]', password:'123456')
# anzoyo = User.create(name: 'anzoyo', email: '[email protected]', password:'123456')
# sali = User.create(name: 'sali', email: '[email protected]', password:'123456')

akora = Inventory.create(name:'Akora', description: 'Delicious staple foodfor the people of West Nile (Uganda)', user: wayungi)
dekngor = Inventory.create(name:'Dek Ngor', description: 'Boiled Amur beans mixed with landi', user: wayungi)
angara = Inventory.create(name:'Angara', description: 'Big fresh nile water fish, shinny and fatty, fried with its own fats', user: wayungi)
# akora = Inventory.create(name:'Akora', description: 'Delicious staple foodfor the people of West Nile (Uganda)', user: wayungi)
# dekngor = Inventory.create(name:'Dek Ngor', description: 'Boiled Amur beans mixed with landi', user: wayungi)
# angara = Inventory.create(name:'Angara', description: 'Big fresh nile water fish, shinny and fatty, fried with its own fats', user: wayungi)

luwombo = Inventory.create(name:'Luwombo', description: 'Chicken cooked in Ndagala', user: sali)
shawama = Inventory.create(name:'Shawama', description: 'Conconction of chips + chicken & wheat', user: sali)
lekuki = Inventory.create(name:'Lekuki', description: 'Wid lased kuki iten 1 pa de', user: sali)
# luwombo = Inventory.create(name:'Luwombo', description: 'Chicken cooked in Ndagala', user: sali)
# shawama = Inventory.create(name:'Shawama', description: 'Conconction of chips + chicken & wheat', user: sali)
# lekuki = Inventory.create(name:'Lekuki', description: 'Wid lased kuki iten 1 pa de', user: sali)

# ---------------------------------------------------------------------------
oboo = Food.create(name: 'Oboo', measurement_unit: 'Bundle', price: 500)
rec = Food.create(name: 'Rec', measurement_unit: 'Piece', price: 15000)
odii = Food.create(name: 'Odii', measurement_unit: 'Kg', price: 10000)
oboo = Food.create(name: 'Oboo', measurement_unit: 'Bundle', price: 500)
beans = Food.create(name: 'Beans', measurement_unit: 'Kg', price: 3600)
moo = Food.create(name: 'Moo', measurement_unit: 'Litre', price: 8000)
yao = Food.create(name: 'Yao', measurement_unit: 'Litre', price: 12000)
# # ---------------------------------------------------------------------------
# oboo = Food.create(name: 'Oboo', measurement_unit: 'Bundle', price: 500)
# rec = Food.create(name: 'Rec', measurement_unit: 'Piece', price: 15000)
# odii = Food.create(name: 'Odii', measurement_unit: 'Kg', price: 10000)
# oboo = Food.create(name: 'Oboo', measurement_unit: 'Bundle', price: 500)
# beans = Food.create(name: 'Beans', measurement_unit: 'Kg', price: 3600)
# moo = Food.create(name: 'Moo', measurement_unit: 'Litre', price: 8000)
# yao = Food.create(name: 'Yao', measurement_unit: 'Litre', price: 12000)


InventoryFood.create(quantity: 8, inventory: akora, food:oboo)
InventoryFood.create(quantity: 2, inventory: akora, food:rec)
InventoryFood.create(quantity: 1, inventory: akora, food:odii)
# InventoryFood.create(quantity: 8, inventory: akora, food:oboo)
# InventoryFood.create(quantity: 2, inventory: akora, food:rec)
# InventoryFood.create(quantity: 1, inventory: akora, food:odii)

InventoryFood.create(quantity: 1, inventory: dekngor, food:beans)
InventoryFood.create(quantity: 1, inventory: dekngor, food:odii)
# InventoryFood.create(quantity: 1, inventory: dekngor, food:beans)
# InventoryFood.create(quantity: 1, inventory: dekngor, food:odii)

InventoryFood.create(quantity: 4, inventory: angara, food:rec)
InventoryFood.create(quantity: 50, inventory: angara, food:moo)
# InventoryFood.create(quantity: 4, inventory: angara, food:rec)
# InventoryFood.create(quantity: 50, inventory: angara, food:moo)

#Users
#5.times do
Expand Down

0 comments on commit 5cdd7af

Please sign in to comment.