Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
Hunger Buster - Breadcrumbs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Julia Santos
Hunger Buster - Breadcrumbs
Commits
e04ba2de
Commit
e04ba2de
authored
Mar 23, 2021
by
Julia Santos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Users can now add items under a specific Product Type
parent
e4fc58d5
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
246 additions
and
49 deletions
+246
-49
sidebar.css
Breadcrumbs/static/sidebar.css
+205
-18
placeholder-items.html
Breadcrumbs/templates/placeholder-items.html
+1
-1
placeholder-list.html
Breadcrumbs/templates/placeholder-list.html
+29
-21
urls.py
Breadcrumbs/urls.py
+2
-2
views.py
Breadcrumbs/views.py
+9
-7
No files found.
Breadcrumbs/static/sidebar.css
View file @
e04ba2de
...
@@ -20,61 +20,248 @@ body {
...
@@ -20,61 +20,248 @@ body {
width
:
100vw
;
width
:
100vw
;
display
:
grid
;
display
:
grid
;
grid-template-columns
:
repeat
(
6
,
16.67vw
);
grid-template-columns
:
repeat
(
6
,
16.67vw
);
grid-template-rows
:
12.5vh
87.5vh
;
text-align
:
left
;
text-align
:
left
;
background-color
:
rgba
(
196
,
196
,
196
,
1
);
}
}
.sidebar
{
.sidebar
{
height
:
100%
;
height
:
200vh
;
position
:
fixed
;
width
:
265px
;
background-color
:
rgba
(
196
,
196
,
196
,
1
);
background-color
:
rgba
(
196
,
196
,
196
,
1
);
display
:
grid
;
display
:
grid
;
grid-template-rows
:
repeat
(
16
,
6.25vh
);
grid-template-rows
:
repeat
(
16
,
6.25vh
);
grid-template-columns
:
repeat
(
2
,
8.33vw
);
grid-column
:
1
/
2
;
grid-column
:
1
/
2
;
z-index
:
1
;
z-index
:
1
;
left
:
0
;
left
:
0
;
}
}
.sideItem
{
.sideItem
{
grid-template-columns
:
repeat
(
2
,
12.5vw
);
display
:
grid
;
text-align
:
center
;
background-color
:
rgba
(
104
,
104
,
104
,
1
);
background-color
:
rgba
(
104
,
104
,
104
,
1
);
opacity
:
0.7
;
transform
:
none
;
}
}
.
t
ext
{
.
sideT
ext
{
font-family
:
"Roboto"
;
font-family
:
"Roboto"
;
font-size
:
24px
;
font-size
:
24px
;
color
:
white
;
color
:
white
;
grid-column
:
2
/
3
;
grid-column
:
2
/
3
;
margin-right
:
5px
;
text-align
:
right
;
}
}
.icon
{
#fridgeIcon
{
background-color
:
white
;
clip-path
:
circle
();
height
:
15vh
;
grid-row
:
1
/
6
;
grid-column
:
1
/
2
;
grid-column
:
1
/
2
;
margin
:
10px
;
}
}
.circle
{
#recipesIcon
{
margin
:
5px
;
background-color
:
white
;
clip-path
:
circle
();
height
:
15vh
;
grid-row
:
4
/
9
;
grid-column
:
1
/
2
;
margin
:
10px
;
}
#statsIcon
{
background-color
:
white
;
clip-path
:
circle
();
clip-path
:
circle
();
height
:
15vh
;
grid-row
:
7
/
12
;
grid-column
:
1
/
2
;
margin
:
10px
;
}
#toBuyIcon
{
background-color
:
white
;
background-color
:
white
;
clip-path
:
circle
();
height
:
15vh
;
grid-row
:
10
/
15
;
grid-column
:
1
/
2
;
margin
:
10px
;
}
}
.fridge
{
.fridge
{
grid-row
:
3
/
4
;
grid-row
:
3
/
4
;
grid-column
:
1
/
3
;
}
}
.recipes
{
.recipes
{
grid-row
:
6
/
7
;
grid-row
:
6
/
7
;
grid-column
:
1
/
3
;
}
}
.stats
{
.stats
{
grid-row
:
9
/
10
;
grid-row
:
9
/
10
;
grid-column
:
1
/
3
;
}
}
.toBuy
{
.toBuy
{
grid-row
:
12
/
13
;
grid-row
:
12
/
13
;
grid-column
:
1
/
3
;
}
.pageSubhead
{
grid-column
:
2
/
7
;
grid-row
:
1
/
2
;
background-color
:
white
;
display
:
grid
;
grid-template-columns
:
3vw
repeat
(
6
,
15.67vw
)
3vw
;
}
.subheader
{
font-family
:
"Roboto Medium"
;
font-size
:
10vh
;
grid-column
:
2
/
3
;
text-align
:
center
;
}
.addItem
{
grid-column
:
3
/
4
;
}
.addItemButton
{
margin-top
:
35px
;
margin-left
:
20px
;
margin-right
:
20px
;
background-color
:
rgba
(
175
,
175
,
175
,
1
);
border-radius
:
100px
;
opacity
:
0.7
;
transform
:
none
;
}
.addItemText
{
font-family
:
"Roboto Medium"
;
font-size
:
18px
;
color
:
white
;
text-align
:
center
;
}
.changeView
{
background-color
:
rgba
(
228
,
228
,
228
,
1
);
font-family
:
"Roboto Medium"
;
font-size
:
14px
;
grid-column
:
5
/
6
;
margin-top
:
35px
;
text-align
:
center
;
}
.listView
{
grid-column
:
2
/
7
;
grid-row
:
2
/
3
;
background-color
:
white
;
display
:
grid
;
grid-template-columns
:
3vw
repeat
(
3
,
23vw
)
3vw
;
grid-template-rows
:
repeat
(
4
,
20vh
);
grid-column-gap
:
3vw
;
grid-row-gap
:
3vw
;
}
.listItem
{
background-color
:
rgba
(
237
,
237
,
237
,
1
);
display
:
grid
;
grid-template-columns
:
10vw
15vw
;
grid-template-rows
:
repeat
(
5
,
5vh
);
opacity
:
0.7
;
transform
:
none
;
}
#listIcon
{
grid-column
:
1
/
2
;
grid-row
:
1
/
5
;
text-align
:
center
;
clip-path
:
circle
();
background-color
:
rgba
(
196
,
196
,
196
,
1
);
margin
:
5px
;
}
.listText
{
grid-column
:
2
/
3
;
text-align
:
left
;
margin
:
10px
;
}
.daysLeft
{
font-family
:
"Roboto Black"
;
font-size
:
24px
;
}
.product
{
font-family
:
"Roboto Regular"
;
font-size
:
20px
;
}
.category
{
font-family
:
"Roboto Regular"
;
font-size
:
14px
;
}
.one
{
grid-column
:
2
/
3
;
grid-row
:
1
/
2
;
}
.two
{
grid-column
:
2
/
3
;
grid-row
:
2
/
3
;
}
.three
{
grid-column
:
2
/
3
;
grid-row
:
3
/
4
;
}
.four
{
grid-column
:
2
/
3
;
grid-row
:
4
/
5
;
}
.five
{
grid-column
:
3
/
4
;
grid-row
:
1
/
2
;
}
.six
{
grid-column
:
3
/
4
;
grid-row
:
2
/
3
;
}
.seven
{
grid-column
:
3
/
4
;
grid-row
:
3
/
4
;
}
.eight
{
grid-column
:
3
/
4
;
grid-row
:
4
/
5
;
}
.nine
{
grid-column
:
4
/
5
;
grid-row
:
1
/
2
;
}
.ten
{
grid-column
:
4
/
5
;
grid-row
:
2
/
3
;
}
.eleven
{
grid-column
:
4
/
5
;
grid-row
:
3
/
4
;
}
.twelve
{
grid-column
:
4
/
5
;
grid-row
:
4
/
5
;
}
}
@font-face
{
@font-face
{
font-family
:
Roboto
Bold
;
font-family
:
Roboto
Bold
;
src
:
url(Roboto-Bold.ttf)
;
src
:
url(Roboto-Bold.ttf)
;
}
}
@font-face
{
font-family
:
Roboto
Black
;
src
:
url(Roboto-Black.ttf)
;
}
@font-face
{
font-family
:
Roboto
Medium
;
src
:
url(Roboto-Medium.ttf)
;
}
@font-face
{
@font-face
{
font-family
:
Roboto
;
font-family
:
Roboto
;
src
:
url(Roboto-Regular.ttf)
;
src
:
url(Roboto-Regular.ttf)
;
}
}
.sideItem
:hover
{
opacity
:
1
;
transition
:
opacity
.5s
;
}
.listItem
:hover
{
opacity
:
1
;
transition
:
opacity
.5s
;
}
.addItemButton
:hover
{
opacity
:
1
;
transition
:
opacity
.5s
;
}
.main
{
.main
{
margin-left
:
23%
;
margin-left
:
23%
;
}
}
Breadcrumbs/templates/placeholder-items.html
View file @
e04ba2de
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
</div>
</div>
<h2>
Fridge
</h2>
<h2>
Fridge
</h2>
<table
style=
"width:70%"
div
class=
"main"
>
<table
style=
"width:70%"
div
class=
"main"
>
<tr><th
colspan=
"5"
><a
href=
"{{request.path}}add"
>
Add
Item
</a></th></tr>
<tr><th
colspan=
"5"
><a
href=
"{{request.path}}add"
>
Add
</a></th></tr>
<tr>
<tr>
<th><a
href=
"http://127.0.0.1:8000/fridge/{{object_list.Product_ID}}"
>
Name
</a></th>
<th><a
href=
"http://127.0.0.1:8000/fridge/{{object_list.Product_ID}}"
>
Name
</a></th>
<th><a
href=
"http://127.0.0.1:8000/fridge/{{object_list.Product_ID}}"
>
Description
</a></th>
<th><a
href=
"http://127.0.0.1:8000/fridge/{{object_list.Product_ID}}"
>
Description
</a></th>
...
...
Breadcrumbs/templates/placeholder-list.html
View file @
e04ba2de
...
@@ -8,47 +8,55 @@
...
@@ -8,47 +8,55 @@
border
:
1px
solid
black
;
border
:
1px
solid
black
;
}
}
</style>
</style>
<div
class =
"listViewHeader"
>
<div
class =
"listViewHeader"
>
<div
class =
"breadcrumbsHead"
>
<div
class =
"breadcrumbsHead"
>
BREADCRUMBS
BREADCRUMBS
</div>
</div>
</div>
</div>
<div
class =
"lowerPage"
>
<div
class =
"lowerPage"
>
<div
class =
"sidebar"
>
<div
class =
"sidebar"
>
<div
class =
"sideItem text fridge"
>
<div
class =
"sideItem fridge"
>
FRIDGE
<div
class =
" sideText"
>
FRIDGE
</div>
</div>
<div
class =
"sideItem icon fridge"
>
<div
class =
"circle"
>
:3
</div>
</div>
</div>
<img
id=
"fridgeIcon"
src=
""
alt=
"a flat icon of a refrigerator"
;
>
<div
class =
"sideItem
text
recipes"
>
<div
class =
"sideItem recipes"
>
RECIPES
<div
class =
"sideText"
>
RECIPES
</div>
</div>
</div>
<div
class =
"sideItem icon recipes"
>
<img
id=
"recipesIcon"
src=
""
alt=
"a flat icon of a cook book"
;
>
<div
class =
"circle"
>
:3
</div>
<div
class =
"sideItem stats"
>
<div
class =
"sideText"
>
STATS
</div>
</div>
</div>
<img
id=
"statsIcon"
src=
""
alt=
"a flat icon of a graph"
;
>
<div
class =
"sideItem t
ext stats
"
>
<div
class =
"sideItem t
oBuy
"
>
STATS
<div
class =
"sideText"
>
TO BUY
</div>
</div>
</div>
<div
class =
"sideItem icon stats"
>
<img
id=
"toBuyIcon"
src=
""
alt=
"a flat icon of a shopping cart"
;
>
<div
class =
"circle"
>
:3
</div>
</div>
</div>
<div
class =
"sideItem text toBuy"
>
<div
class =
"pageSubhead"
>
TO BUY
<div
class =
"subheader"
>
Fridge
</div>
<div
class =
"addItem"
>
<div
class =
"addItemButton"
>
<div
class =
"addItemText"
><a
href=
"http://127.0.0.1:8000/fridge/add/"
>
ADD ITEM +
</a></div>
</div>
</div>
</div>
<div
class =
"sideItem icon toBuy"
>
<div
class =
"changeView"
>
LIST VIEW
</div>
<div
class =
"circle"
>
:3
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<h2>
Fridge
</h2>
<h2>
Fridge
</h2>
<table
style=
"width:70%"
div
class=
"main"
>
<table
style=
"width:70%"
div
class=
"main"
>
<tr><th
colspan=
"5"
><a
href=
"http://127.0.0.1:8000/fridge/add/"
>
Add Item
</a></th></tr>
<tr><th></th>
<tr><th></th>
<th><a
href=
"http://127.0.0.1:8000/fridge/list/"
>
name
</a></th>
<th><a
href=
"http://127.0.0.1:8000/fridge/list/"
>
name
</a></th>
<th><a
href=
"http://127.0.0.1:8000/fridge/list-category"
>
category
</a></th>
<th><a
href=
"http://127.0.0.1:8000/fridge/list-category"
>
category
</a></th>
...
...
Breadcrumbs/urls.py
View file @
e04ba2de
...
@@ -15,7 +15,7 @@ urlpatterns = [
...
@@ -15,7 +15,7 @@ urlpatterns = [
#path('fridge/<pk>/delete', ProductTypeDeleteView.as_view()),
#path('fridge/<pk>/delete', ProductTypeDeleteView.as_view()),
path
(
'fridge/<id>/delete'
,
delete_product_type
,
name
=
'product-type-delete'
),
path
(
'fridge/<id>/delete'
,
delete_product_type
,
name
=
'product-type-delete'
),
url
(
r'^fridge/(?P<Product_ID>\d+)/$'
,
ItemViewPDate
.
as_view
(),
name
=
'item-purchase-date-view'
),
url
(
r'^fridge/(?P<Product_ID>\d+)/$'
,
ItemViewPDate
.
as_view
(),
name
=
'item-purchase-date-view'
),
path
(
'fridge/<id>/add
/
'
,
add_item
,
name
=
'add-item'
),
path
(
'fridge/<id>/add'
,
add_item
,
name
=
'add-item'
),
]
]
if
settings
.
DEBUG
:
if
settings
.
DEBUG
:
...
...
Breadcrumbs/views.py
View file @
e04ba2de
from
django.views.generic
import
ListView
from
django.views.generic
import
ListView
from
django.db.models
import
Q
from
django.db.models
import
Q
from
.forms
import
LoginForm
,
ProductTypeForm
from
.forms
import
LoginForm
,
ProductTypeForm
,
AddItemForm
from
django.http
import
HttpResponseRedirect
from
django.http
import
HttpResponseRedirect
from
django.shortcuts
import
render
,
get_object_or_404
#, render_to_response
from
django.shortcuts
import
render
,
get_object_or_404
#, render_to_response
from
django.forms
import
ValidationError
from
django.forms
import
ValidationError
...
@@ -104,8 +104,9 @@ class ItemViewPDate(ListView):
...
@@ -104,8 +104,9 @@ class ItemViewPDate(ListView):
def
add_item
(
request
,
id
):
def
add_item
(
request
,
id
):
context
=
{}
context
=
{}
obj
=
get_object_or_404
(
Product_Type
,
Product_ID
=
id
)
if
request
.
method
==
'POST'
:
if
request
.
method
==
'POST'
:
form
=
AddItemForm
(
request
.
POST
,
request
.
FILES
)
form
=
AddItemForm
(
request
.
POST
)
if
form
.
is_valid
():
if
form
.
is_valid
():
#the name in quotation marks should match the name in the form
#the name in quotation marks should match the name in the form
item_qty
=
form
.
cleaned_data
.
get
(
"Item_Quantity"
)
item_qty
=
form
.
cleaned_data
.
get
(
"Item_Quantity"
)
...
@@ -114,12 +115,13 @@ def add_item(request, id):
...
@@ -114,12 +115,13 @@ def add_item(request, id):
purchase_date
=
form
.
cleaned_data
.
get
(
"Purchase_Date"
)
purchase_date
=
form
.
cleaned_data
.
get
(
"Purchase_Date"
)
exp_date
=
form
.
cleaned_data
.
get
(
"Expiration_Date"
)
exp_date
=
form
.
cleaned_data
.
get
(
"Expiration_Date"
)
is_consumed
=
form
.
cleaned_data
.
get
(
"Is_Consumed"
)
is_consumed
=
form
.
cleaned_data
.
get
(
"Is_Consumed"
)
product_type
=
id
product_type
=
obj
user_id
=
request
.
user
#equating the variables you just declared with the object youre creating
#equating the variables you just declared with the object youre creating
instance
=
Item
.
objects
.
create
(
Item_Quantity
=
item_qty
,
Quantity_Unit
=
qty_unit
,
Item_Description
=
item_description
,
Purchase_Date
=
purchase_date
,
Expiration_Date
=
exp_date
,
Is_Consumed
=
is_consumed
,
Product_ID
=
product_type
)
instance
=
Item
.
objects
.
create
(
Item_Quantity
=
item_qty
,
Quantity_Unit
=
qty_unit
,
Item_Description
=
item_description
,
Purchase_Date
=
purchase_date
,
Expiration_Date
=
exp_date
,
Is_Consumed
=
is_consumed
,
Product_ID
=
product_type
,
User_ID
=
user_id
)
instance
.
save
()
instance
.
save
()
return
HttpResponseRedirect
(
request
.
META
.
get
(
'HTTP_REFERER'
))
return
HttpResponseRedirect
(
'/fridge/'
+
str
(
obj
.
Product_ID
))
else
:
else
:
form
=
ProductType
Form
()
form
=
AddItem
Form
()
context
[
'form'
]
=
form
context
[
'form'
]
=
form
return
render
(
request
,
'add-product-type.html'
,
context
)
return
render
(
request
,
'add-item.html'
,
context
)
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment