Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactorx2 routes #122

Open
wants to merge 269 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
269 commits
Select commit Hold shift + click to select a range
c2228d4
Update object in test to merchant_user
jakeheft Oct 27, 2020
7d1be6d
Add functionality to log in as admin
jakeheft Oct 27, 2020
f7959e2
Add test to check for invalid credentials
jakeheft Oct 27, 2020
c16b4de
resolve merge conflicts
GregJMitchell Oct 27, 2020
db6bb33
Reslolve merge conflict
GregJMitchell Oct 27, 2020
32dc653
Reslolve merge conflict
GregJMitchell Oct 27, 2020
6937f4f
Update test to log user in and then check for links
GregJMitchell Oct 27, 2020
8244c5e
Remove duplicate routes
GregJMitchell Oct 27, 2020
17b6151
Remove duplicate actions
GregJMitchell Oct 27, 2020
19dd34f
Update nav bar to show links based off role
GregJMitchell Oct 27, 2020
84cf90a
Add test to make sure invalid email or password is returned to login …
jakeheft Oct 27, 2020
16fe3ce
Add role into test user objects
jakeheft Oct 27, 2020
dd463f2
Add functionality to prevent user from logging in with incorrect cred…
jakeheft Oct 27, 2020
2e866b3
Fix user roles to be 1,2, or 3
GregJMitchell Oct 27, 2020
a067b46
Update tests to use new user roles
GregJMitchell Oct 27, 2020
de9be26
Update nav bar to show links based off role
GregJMitchell Oct 27, 2020
2fe149c
Update describe block in test:
GregJMitchell Oct 27, 2020
50de003
Create test for admin nav bar
GregJMitchell Oct 27, 2020
fe3432c
Update test to log user in
jakeheft Oct 27, 2020
707e23c
Add admin links to nav bar
GregJMitchell Oct 27, 2020
8e04a61
Add functionality for logged in user to not see login page
jakeheft Oct 27, 2020
befb270
Update test for visitor auth
GregJMitchell Oct 27, 2020
efae3b4
Add require role functionality to admin, merchant, and user controllers
GregJMitchell Oct 27, 2020
c974c96
Add tests for merchant and admin to be directed to proper page when t…
jakeheft Oct 27, 2020
2ac7fa1
Build functionality to redirect already logged in admin and merchant
jakeheft Oct 27, 2020
ec4d3d3
Create test for user auth for admin and merchant pages
GregJMitchell Oct 27, 2020
03eef35
Re-organize user controllers
GregJMitchell Oct 27, 2020
b36b536
Create test for merchant auth to admin
GregJMitchell Oct 27, 2020
bb25ead
Update test for merchant auth to admin
GregJMitchell Oct 27, 2020
d6229d0
Create cart base controller for auth
GregJMitchell Oct 27, 2020
a14959a
Merge pull request #2 from jakeheft/login
abcdefghijohn Oct 27, 2020
38f1abf
Add test to log out
jakeheft Oct 28, 2020
b5019df
Move logout test to correct file
jakeheft Oct 28, 2020
b5ca9fe
Update test to have content rather than equal
jakeheft Oct 28, 2020
bdbdb6d
Add functionality to be able to log out and see flash message confirm…
jakeheft Oct 28, 2020
745d3a1
modified admin spec to include a stub
abcdefghijohnk Oct 28, 2020
81e05bb
Merge pull request #3 from jakeheft/logout
abcdefghijohn Oct 28, 2020
90b1641
resolve merge conflicts
abcdefghijohnk Oct 28, 2020
2b35e07
one last merge conflict
abcdefghijohnk Oct 28, 2020
a5fc12a
found few more merge conflicts
abcdefghijohnk Oct 28, 2020
fd52a80
Merge pull request #4 from jakeheft/navigation
GarrettCottrell Oct 28, 2020
c7ff8ac
Resolve merge conflicts
GregJMitchell Oct 28, 2020
5484b62
Update logout test to clear cart
jakeheft Oct 28, 2020
997ec6f
Add functionality to clear cart upon logout
jakeheft Oct 28, 2020
24cda3f
Merge pull request #5 from jakeheft/logout_refactor
abcdefghijohn Oct 28, 2020
fdbef5e
add validations test to user model spec
abcdefghijohnk Oct 28, 2020
22e6980
add tests for full address model method
GarrettCottrell Oct 28, 2020
6c037df
add test for profile show page
GarrettCottrell Oct 28, 2020
4237470
create method for full address
GarrettCottrell Oct 28, 2020
f362982
create user dashboad show page
GarrettCottrell Oct 28, 2020
2f6fd10
created test to click edit profile
GarrettCottrell Oct 28, 2020
b1eae6a
create working link for edit page
GarrettCottrell Oct 28, 2020
47a3ff0
create test for edit form
GarrettCottrell Oct 28, 2020
455302b
create route for edit profile
GarrettCottrell Oct 28, 2020
c8d90de
create edit profile functionality
GarrettCottrell Oct 28, 2020
1488c24
create test for updating password
GarrettCottrell Oct 28, 2020
81a950c
created functionality for updating password as a regular user
GarrettCottrell Oct 28, 2020
51bab64
create sad path test for invalid password entries
GarrettCottrell Oct 28, 2020
f276d59
create sad path functionality for inalid password entries when updati…
GarrettCottrell Oct 28, 2020
7bb9d49
updated tests to include restful routing for password update function…
GarrettCottrell Oct 28, 2020
c11caaf
updated link routes for edit password functionality for new restful r…
GarrettCottrell Oct 28, 2020
4e8f3a6
updated routes to be restful for password update routes
GarrettCottrell Oct 28, 2020
cdc39fa
creat test for trying to update profile with duplicate email
GarrettCottrell Oct 28, 2020
593b4af
create sad path for when user tries to update profile with duplicate …
GarrettCottrell Oct 28, 2020
27f1b4d
update routing in tests for register-->users route change
GarrettCottrell Oct 29, 2020
f663f0e
update routing for register-->users route changes
GarrettCottrell Oct 29, 2020
6eb9822
create feature and model test for items index
abcdefghijohnk Oct 29, 2020
4e21106
create top and bottom five method for items index
abcdefghijohnk Oct 29, 2020
e2d4acf
update items index view to show top and bottom 5 items
abcdefghijohnk Oct 29, 2020
974bb3f
create model test for top and bottom five methods in item spec
abcdefghijohnk Oct 29, 2020
6afae0f
Merge pull request #6 from jakeheft/user_profile
abcdefghijohn Oct 29, 2020
6571a50
Solve pr issues
GregJMitchell Oct 29, 2020
d6622a8
Merge pull request #7 from jakeheft/item_index
GarrettCottrell Oct 29, 2020
9806463
Fix register bug
GregJMitchell Oct 29, 2020
df62df6
Update logout test description to cover cart clearing
jakeheft Oct 29, 2020
59146dd
Add test to either register or log in before cart checkout
jakeheft Oct 29, 2020
d9e20e9
Update checkout test to be logged in before checkout
jakeheft Oct 29, 2020
e42b823
Add functionality to require user before checkout with cart
jakeheft Oct 29, 2020
7497528
Create test for incrementing item in cart
GregJMitchell Oct 29, 2020
67b9c1c
Create route for incrementing cart
GregJMitchell Oct 29, 2020
9a0f54f
Create modify quantity action
GregJMitchell Oct 29, 2020
74cea99
Add + button for adding items
GregJMitchell Oct 29, 2020
a690861
Add logged in user to tests that need to checkout cart
jakeheft Oct 30, 2020
80fa457
Update tests for cart to subtract items and test subtract_items insta…
GregJMitchell Oct 30, 2020
f52a78f
Add - button to view and change text to black
GregJMitchell Oct 30, 2020
8d592b9
Create subtract item method
GregJMitchell Oct 30, 2020
8d46d5a
Add test to get to new order
jakeheft Oct 30, 2020
cfc6a62
Add conditional statments to modify contents
GregJMitchell Oct 30, 2020
6267925
Add test for order creation
jakeheft Oct 30, 2020
a7ebfff
Add test for relationship between user and order
jakeheft Oct 30, 2020
6164ba8
Update tests for correct routing of order creation and order show con…
jakeheft Oct 30, 2020
e374716
Add status column to orders
jakeheft Oct 30, 2020
03502ad
Update all specs to include user on orders
jakeheft Oct 30, 2020
47761b3
Add functionality to profile orders show page
jakeheft Oct 30, 2020
701b15c
Merge pull request #8 from jakeheft/increment/decrement_items
jakeheft Oct 30, 2020
f93e9b1
Update tests to show correct buttons
jakeheft Oct 30, 2020
a5c6310
Merge branch 'main' of github.com:jakeheft/monster_shop_2005 into che…
jakeheft Oct 30, 2020
ca6548d
Remove useless conditionals
GregJMitchell Oct 30, 2020
5f36784
Remove all data logic from view and use model methods
GregJMitchell Oct 30, 2020
fc92482
Merge pull request #10 from jakeheft/refactor_navbar
jakeheft Oct 31, 2020
1c747cf
Merge pull request #9 from jakeheft/checkout_registration_status
GregJMitchell Oct 31, 2020
a36a500
Add test for user order show page link
GregJMitchell Oct 31, 2020
98f487e
Add conditional statment to the profile order show page
GregJMitchell Oct 31, 2020
a5cbeea
Update test to test the correct page
GregJMitchell Oct 31, 2020
23fa7ac
create order status model test for when item_orders attached to the o…
GarrettCottrell Oct 31, 2020
2dd8b71
Update tests to test correct pages
GregJMitchell Oct 31, 2020
6f24573
Update routes and add profile order index page content
GregJMitchell Oct 31, 2020
714213b
created item_orders controller for future use
GarrettCottrell Oct 31, 2020
159dcd4
create status column for item_orders table
GarrettCottrell Oct 31, 2020
a4381fe
Create test for order show page
GregJMitchell Oct 31, 2020
a87e021
Add columns to view for show page
GregJMitchell Oct 31, 2020
322c6b2
Add status to item_orders table
GregJMitchell Oct 31, 2020
8251e7e
Create test for cancelling order
GregJMitchell Oct 31, 2020
e9d5bbe
Create model test for return items method
GregJMitchell Oct 31, 2020
5b13194
Move return items model test to order spec
GregJMitchell Oct 31, 2020
5c2a373
Add cancel button to profile order show page
GregJMitchell Oct 31, 2020
c1d81be
Create patch route for cancel order
GregJMitchell Oct 31, 2020
3455564
Create model method for return items and code cancel order action
GregJMitchell Oct 31, 2020
dd499f8
Merge pull request #11 from jakeheft/orders_user_profile
jakeheft Oct 31, 2020
ab210ee
merging into order_status_update branch
GarrettCottrell Oct 31, 2020
fc3d15d
resolving merge conflicts from cancellation functionality pr
GarrettCottrell Oct 31, 2020
6967fe3
add test for linking to user profile
GarrettCottrell Oct 31, 2020
c210659
added links to user profiles on admin dashboard
GarrettCottrell Oct 31, 2020
d06a242
created view for admin user page
GarrettCottrell Oct 31, 2020
739dc1f
added route for admin user page
GarrettCottrell Oct 31, 2020
a0cb806
added show action for admin user page
GarrettCottrell Oct 31, 2020
c4cf614
create tests to ship items and remove cancel functionality from items…
GarrettCottrell Nov 1, 2020
033cb60
removed duplicate migrations for adding status to item_orders
GarrettCottrell Nov 1, 2020
096ecce
create route for updating order status to shipped
GarrettCottrell Nov 1, 2020
9248a78
Update db
jakeheft Nov 1, 2020
e168ee3
Merge branch 'order_status_update' of github.com:jakeheft/monster_sho…
jakeheft Nov 1, 2020
ec969ed
Add model tests for merchant user to merchant relationship
jakeheft Nov 1, 2020
8dbf466
Add merchant id to user column
jakeheft Nov 1, 2020
755ae9d
Add relationships between merchant and user
jakeheft Nov 1, 2020
4b020da
Move full address method to application record class so all objects c…
jakeheft Nov 1, 2020
5bdc3d3
Remove pry
jakeheft Nov 1, 2020
e230870
Add test for merchant dashboard show page
jakeheft Nov 1, 2020
5b4d503
Add functionality to see merchant info on dashboard
jakeheft Nov 1, 2020
319f08b
Merge pull request #12 from jakeheft/order_status_update
abcdefghijohn Nov 2, 2020
18a8e0e
Add more seed data
jakeheft Nov 2, 2020
ccce438
add column enabled to merchant table
abcdefghijohnk Nov 2, 2020
bb2625a
create feature test for admin/merchants disable function
abcdefghijohnk Nov 2, 2020
bed00aa
update schema for merchants table
abcdefghijohnk Nov 3, 2020
d5e5991
update route for merchant resource in admin namespace
abcdefghijohnk Nov 3, 2020
7806991
create admin/merchants controller
abcdefghijohnk Nov 3, 2020
9d0d8ea
create view for admin/merchants
abcdefghijohnk Nov 3, 2020
6705941
create model and feature test for disabled items
abcdefghijohnk Nov 3, 2020
9d0ebd4
update disable method with flash message and disable_merchant method
abcdefghijohnk Nov 3, 2020
9a6f9e4
create disable_merchant method in merchant model
abcdefghijohnk Nov 3, 2020
2164d2a
create spec and model test for enable merchant functionality
abcdefghijohnk Nov 3, 2020
7ffaec3
create merchant enable route
abcdefghijohnk Nov 3, 2020
db6d016
create enable action in merchant controller
abcdefghijohnk Nov 3, 2020
4b352a7
update merchant view to include enable function
abcdefghijohnk Nov 3, 2020
e261b80
create enable_merchant method in merchants model
abcdefghijohnk Nov 3, 2020
d564042
Add funtionality to whatever
jakeheft Nov 3, 2020
100fafd
Add merchant id to item orders
jakeheft Nov 3, 2020
c99b1ae
Fix item_qty method
GregJMitchell Nov 3, 2020
1410a0c
Create model test and feature test for item qty and total value methods
GregJMitchell Nov 3, 2020
8dbb3e8
Create model method for item_qty and total_value methods
GregJMitchell Nov 3, 2020
351c952
Remove comments and pry
GregJMitchell Nov 3, 2020
e0c5e1e
Code merchant dashboard show page to use new model methods and have b…
GregJMitchell Nov 3, 2020
f2db574
Correct tests that now require merchant ids in item orders
jakeheft Nov 3, 2020
c9f6294
Update test with merchant ids to item orders
jakeheft Nov 3, 2020
bd709a9
Update item order creation to have merchant id
jakeheft Nov 3, 2020
629fc36
Merge pull request #13 from jakeheft/item_index
GarrettCottrell Nov 3, 2020
6c9cc74
Add test to check for link to merchant items
jakeheft Nov 3, 2020
6270d73
Add functionality to see link to merchant items and build path and view
jakeheft Nov 3, 2020
1cceee8
Add test for admin merchant show
jakeheft Nov 3, 2020
98cb8e7
Add functionality for admin merchant show and index pages
jakeheft Nov 3, 2020
1adbf85
Merge branch with main
jakeheft Nov 3, 2020
f155918
Merge pull request #14 from jakeheft/merchant_dashboard
abcdefghijohn Nov 3, 2020
9a0ab0d
fixed ends after merge conflict resolution
GarrettCottrell Nov 3, 2020
998adb7
Create test for merchant user deactivating an item
GregJMitchell Nov 3, 2020
21954cb
Create route for merchant items deactivating and item
GregJMitchell Nov 3, 2020
be83374
Create deactivate action for items controller
GregJMitchell Nov 3, 2020
513368b
Create view for merchant items index page
GregJMitchell Nov 3, 2020
652368e
Update test for activate button
GregJMitchell Nov 3, 2020
6c07371
Create route and action for activating an item
GregJMitchell Nov 3, 2020
ddada4f
Add activate button and only show buttons for correct item status
GregJMitchell Nov 3, 2020
88be915
Create delete spec for merchant deleteing an item
GregJMitchell Nov 3, 2020
fbca43d
Create route and action for deleteing an item
GregJMitchell Nov 3, 2020
2d1a52d
Add delete item button next to each item that has no past orders
GregJMitchell Nov 3, 2020
9042029
Move tests to new item folder
GregJMitchell Nov 3, 2020
ab8d214
create test for order show page
GarrettCottrell Nov 3, 2020
4583628
created item model test for order_quantity and order model test for i…
GarrettCottrell Nov 3, 2020
84e69d9
creae functionality for order show page
GarrettCottrell Nov 3, 2020
8e557a4
add routes for order show page
GarrettCottrell Nov 3, 2020
ede02e3
not sure what this is
GarrettCottrell Nov 3, 2020
4e0926c
push for john
GregJMitchell Nov 4, 2020
23f1012
Convert form_for to form_tag
GregJMitchell Nov 4, 2020
2c007ac
Convert test to use new form_with field ids
GregJMitchell Nov 4, 2020
769a09b
Change form setup to be form_with
GregJMitchell Nov 4, 2020
234a9e8
Convert form_tag to form_with
GregJMitchell Nov 4, 2020
c34a95c
create status and order_item models
GarrettCottrell Nov 4, 2020
f8716f5
create test for item and order models, as well as for merchant user f…
GarrettCottrell Nov 4, 2020
86590cd
create update action in merchant controller for orders/order_items
GarrettCottrell Nov 4, 2020
8b9993a
create route for orders show page update action
GarrettCottrell Nov 4, 2020
b294786
create show page for orders
GarrettCottrell Nov 4, 2020
670de86
add .DS_Store to ignore file
GarrettCottrell Nov 4, 2020
2b7daa1
Create test for editing an item and for sad path
GregJMitchell Nov 4, 2020
1b5fa9a
moved item_order controller into merchant folder
GarrettCottrell Nov 4, 2020
684db8c
change route to new item_order merchant controller
GarrettCottrell Nov 4, 2020
45eb8fe
Create route resources for all except put
GregJMitchell Nov 4, 2020
03bdc94
Correct routes for new and delete items
GregJMitchell Nov 4, 2020
9a83c21
Create edit form for item
GregJMitchell Nov 4, 2020
96fa721
Add edit and update actions and correct params id for finding items
GregJMitchell Nov 4, 2020
8e55c70
add message for not enough quantity to fulfill item
GarrettCottrell Nov 4, 2020
ede101c
update test to test for not enough inventory message on order show page
GarrettCottrell Nov 4, 2020
3ad36a4
Change view to use one instance variable
GregJMitchell Nov 4, 2020
2eec0f1
Remove second instance variable from index action
GregJMitchell Nov 4, 2020
970c9f6
Merge pull request #15 from jakeheft/merchant_items
jakeheft Nov 4, 2020
66c1b0c
merged changes and resolved conflicts
GarrettCottrell Nov 4, 2020
b20a3f1
Delete launch.json
jakeheft Nov 4, 2020
0d157b6
updated route and tests to make item_order update action route restful
GarrettCottrell Nov 4, 2020
66a5bcf
Merge branch 'merchant_user' of github.com:jakeheft/monster_shop_2005…
GarrettCottrell Nov 4, 2020
8e8f0af
Merge pull request #16 from jakeheft/merchant_user
abcdefghijohn Nov 4, 2020
e04e50c
create spec for displaying merchant city state and relevant button
abcdefghijohnk Nov 4, 2020
0a88ae6
update view for admin merchants index
abcdefghijohnk Nov 4, 2020
e5c8ef0
add column created at to user table
abcdefghijohnk Nov 5, 2020
fdeec69
create test for admin user index spec
abcdefghijohnk Nov 5, 2020
5eb3515
update view, controller, and route for admin user
abcdefghijohnk Nov 5, 2020
caa1918
create spec for admin user show
abcdefghijohnk Nov 5, 2020
7d05f69
update show action in user controller
abcdefghijohnk Nov 5, 2020
927a074
update view for admin user show page
abcdefghijohnk Nov 5, 2020
391b374
Merge pull request #17 from jakeheft/admin_merchant/user_pages
GarrettCottrell Nov 5, 2020
51218a8
update css and styling for merchant dashboard
abcdefghijohnk Nov 5, 2020
f1ccd0b
Update seeds with accurate objects
jakeheft Nov 5, 2020
5673445
Update seeds
jakeheft Nov 5, 2020
290e413
update css and styling for buttons and text color
abcdefghijohnk Nov 5, 2020
93b1c19
refactor
abcdefghijohnk Nov 5, 2020
ded2201
Refactor models
GregJMitchell Nov 5, 2020
2e27dc5
Merge pull request #18 from jakeheft/refactor_seeds
abcdefghijohn Nov 5, 2020
d2f530b
Merge pull request #19 from jakeheft/refactor_style
GregJMitchell Nov 5, 2020
37c72d3
Merge pull request #20 from jakeheft/refactor_models
jakeheft Nov 5, 2020
4e85ab3
create spec and itemorder method items_left update controller
abcdefghijohnk Nov 5, 2020
37fbc41
Create test for cancel order method
GregJMitchell Nov 5, 2020
42e1869
Create cancel order method
GregJMitchell Nov 5, 2020
434cbca
Refactor controllers using rubocop
GregJMitchell Nov 5, 2020
9071dbb
change routes to resources
GarrettCottrell Nov 5, 2020
ac32478
edit symbol arrays to use %i syntax
GarrettCottrell Nov 5, 2020
71f58d2
Correct status naming for order items and make casing consistent
jakeheft Nov 5, 2020
81e1eae
Merge pull request #21 from jakeheft/refactor_admin_controllers
jakeheft Nov 5, 2020
8691d69
Change empty method syntax
GregJMitchell Nov 6, 2020
8d76bd9
resolve merge conflicts
GregJMitchell Nov 6, 2020
1665f18
Merge pull request #22 from jakeheft/refactor_non_admin_controllers
jakeheft Nov 6, 2020
6e408db
Merge branch 'main' into refactor_statuses
jakeheft Nov 6, 2020
10e4b52
Merge pull request #25 from jakeheft/refactor_statuses
GregJMitchell Nov 6, 2020
15c276e
Correct status capitalization errors that GREG made
jakeheft Nov 6, 2020
7cda042
Merge pull request #24 from jakeheft/refactor_routes
jakeheft Nov 6, 2020
45d9a60
added syntax to remove put from resource routes
GarrettCottrell Nov 6, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# Ignore bundler config.
/.bundle
coverage
.DS_Store
.vscode

# Ignore all logfiles and tempfiles.
/log/*
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ gem 'coffee-rails', '~> 4.2'
gem 'jbuilder', '~> 2.5'

gem 'bootsnap', '>= 1.1.0', require: false
gem 'bcrypt', '~> 3.1.7'

group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
Expand Down
94 changes: 48 additions & 46 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,52 +1,53 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.4.3)
actionpack (= 5.2.4.3)
actioncable (5.2.4.4)
actionpack (= 5.2.4.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.4.3)
actionpack (= 5.2.4.3)
actionview (= 5.2.4.3)
activejob (= 5.2.4.3)
actionmailer (5.2.4.4)
actionpack (= 5.2.4.4)
actionview (= 5.2.4.4)
activejob (= 5.2.4.4)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.4.3)
actionview (= 5.2.4.3)
activesupport (= 5.2.4.3)
actionpack (5.2.4.4)
actionview (= 5.2.4.4)
activesupport (= 5.2.4.4)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.4.3)
activesupport (= 5.2.4.3)
actionview (5.2.4.4)
activesupport (= 5.2.4.4)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.4.3)
activesupport (= 5.2.4.3)
activejob (5.2.4.4)
activesupport (= 5.2.4.4)
globalid (>= 0.3.6)
activemodel (5.2.4.3)
activesupport (= 5.2.4.3)
activerecord (5.2.4.3)
activemodel (= 5.2.4.3)
activesupport (= 5.2.4.3)
activemodel (5.2.4.4)
activesupport (= 5.2.4.4)
activerecord (5.2.4.4)
activemodel (= 5.2.4.4)
activesupport (= 5.2.4.4)
arel (>= 9.0)
activestorage (5.2.4.3)
actionpack (= 5.2.4.3)
activerecord (= 5.2.4.3)
activestorage (5.2.4.4)
actionpack (= 5.2.4.4)
activerecord (= 5.2.4.4)
marcel (~> 0.3.1)
activesupport (5.2.4.3)
activesupport (5.2.4.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
arel (9.0.0)
bcrypt (3.1.16)
bindex (0.8.1)
bootsnap (1.4.8)
bootsnap (1.4.9)
msgpack (~> 1.0)
builder (3.2.4)
byebug (11.1.3)
Expand Down Expand Up @@ -77,7 +78,7 @@ GEM
activesupport (>= 4.2.0)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
jbuilder (2.10.0)
jbuilder (2.10.1)
activesupport (>= 5.0.0)
launchy (2.5.0)
addressable (~> 2.7)
Expand All @@ -98,7 +99,7 @@ GEM
mini_portile2 (2.4.0)
minitest (5.14.2)
msgpack (1.3.3)
nio4r (2.5.3)
nio4r (2.5.4)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
pg (1.2.3)
Expand All @@ -110,38 +111,38 @@ GEM
rack (2.2.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.4.3)
actioncable (= 5.2.4.3)
actionmailer (= 5.2.4.3)
actionpack (= 5.2.4.3)
actionview (= 5.2.4.3)
activejob (= 5.2.4.3)
activemodel (= 5.2.4.3)
activerecord (= 5.2.4.3)
activestorage (= 5.2.4.3)
activesupport (= 5.2.4.3)
rails (5.2.4.4)
actioncable (= 5.2.4.4)
actionmailer (= 5.2.4.4)
actionpack (= 5.2.4.4)
actionview (= 5.2.4.4)
activejob (= 5.2.4.4)
activemodel (= 5.2.4.4)
activerecord (= 5.2.4.4)
activestorage (= 5.2.4.4)
activesupport (= 5.2.4.4)
bundler (>= 1.3.0)
railties (= 5.2.4.3)
railties (= 5.2.4.4)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (5.2.4.3)
actionpack (= 5.2.4.3)
activesupport (= 5.2.4.3)
railties (5.2.4.4)
actionpack (= 5.2.4.4)
activesupport (= 5.2.4.4)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rake (13.0.1)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
regexp_parser (1.7.1)
rspec-core (3.9.2)
regexp_parser (1.8.2)
rspec-core (3.9.3)
rspec-support (~> 3.9.3)
rspec-expectations (3.9.2)
rspec-expectations (3.9.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
Expand All @@ -155,7 +156,7 @@ GEM
rspec-expectations (~> 3.9)
rspec-mocks (~> 3.9)
rspec-support (~> 3.9)
rspec-support (3.9.3)
rspec-support (3.9.4)
ruby_dep (1.5.0)
sass (3.7.4)
sass-listen (~> 4.0.0)
Expand All @@ -170,14 +171,14 @@ GEM
tilt (>= 1.1, < 3)
shoulda-matchers (4.4.1)
activesupport (>= 4.2.0)
simplecov (0.19.0)
simplecov (0.19.1)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov-html (0.12.2)
simplecov-html (0.12.3)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
sprockets-rails (3.2.2)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
Expand All @@ -203,6 +204,7 @@ PLATFORMS
ruby

DEPENDENCIES
bcrypt (~> 3.1.7)
bootsnap (>= 1.1.0)
byebug
capybara
Expand Down
28 changes: 27 additions & 1 deletion app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,26 @@
font-family: "Marker Felt", fantasy;
}

p {
color: black;
font-size: 15px;
}

p1 {
font-size: 17px;
color: white;
}

#current-user {
color: white;
}
ul{
padding: 0px;
text-align: center;
}
img{
width: 50%;
width:20%;
height:auto;
}

#cart-image{
Expand Down Expand Up @@ -99,6 +113,12 @@ section[id*='review'] {
text-align: center;
}

button{
text-align: center;
padding: 5px;
width: 30%;
}

input[type=text], select {
width: 100%;
padding: 12px 20px;
Expand Down Expand Up @@ -135,6 +155,12 @@ form {
background-color: red;
color: white;
}

.notice-flash {
padding: 10px;
background-color: green;
color: white;
}
.success-flash {
padding: 10px;
background-color: green;
Expand Down
7 changes: 7 additions & 0 deletions app/controllers/admin/base_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Admin::BaseController < ApplicationController
before_action :require_admin

def require_admin
render file: "/public/404" unless current_admin?
end
end
5 changes: 5 additions & 0 deletions app/controllers/admin/dashboard_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Admin::DashboardController < Admin::BaseController
def index
@orders = Order.all
end
end
24 changes: 24 additions & 0 deletions app/controllers/admin/merchants_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class Admin::MerchantsController < Admin::BaseController
def show
@merchant = Merchant.find(params[:merchant_id])
end
before_action :require_admin

def index
@merchants = Merchant.all
end

def disable
merchant = Merchant.find(params[:merchant_id])
merchant.disable_merchant
redirect_to '/admin/merchants'
flash[:notice] = "Merchant Account Is Now Disabled"
end

def enable
merchant = Merchant.find(params[:merchant_id])
merchant.enable_merchant
redirect_to '/admin/merchants'
flash[:notice] = "Merchant Account Is Now Enabled"
end
end
8 changes: 8 additions & 0 deletions app/controllers/admin/profile_orders_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Admin::ProfileOrdersController < Admin::BaseController
def update
order = Order.find(params[:order_id])
order.update!(status: "Shipped")

redirect_to "/admin"
end
end
9 changes: 9 additions & 0 deletions app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class Admin::UsersController < Admin::BaseController
def index
@users = User.all
end

def show
@user = User.find(params[:id])
end
end
17 changes: 16 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception

helper_method :cart
helper_method :cart, :current_user, :current_admin?, :current_merchant?, :current_user?

def cart
@cart ||= Cart.new(session[:cart] ||= Hash.new(0))
end

def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end

def current_admin?
current_user && current_user.admin?
end

def current_merchant?
current_user && current_user.merchant?
end

def current_user?
current_user && current_user.user?
end
end
7 changes: 7 additions & 0 deletions app/controllers/cart_base_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class CartBaseController < ApplicationController
before_action :require_non_admin

def require_non_admin
render file: "/public/404" if current_admin?
end
end
25 changes: 24 additions & 1 deletion app/controllers/cart_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CartController < ApplicationController
class CartController < CartBaseController
def add_item
item = Item.find(params[:item_id])
cart.add_item(item.id.to_s)
Expand All @@ -20,5 +20,28 @@ def remove_item
redirect_to '/cart'
end

def modify_quantity
item = Item.find(params[:item_id])

if params[:operation] == "add"
if item.inventory > session[:cart][item.id.to_s]
cart.add_item(item.id.to_s)
flash[:success] = "Another #{item.name} was successfully added to your cart"
redirect_to "/cart"
else
flash[:notice] = "Not Enough Inventory for #{item.name}"
redirect_to "/cart"
end
elsif params[:operation] == "subtract"
if session[:cart][item.id.to_s] > 1
cart.subtract_item(item.id.to_s)
flash[:success] = "A #{item.name} was successfully removed from your cart"
redirect_to "/cart"
else
session[:cart].delete(params[:item_id])
flash[:success] = "#{item.name} was successfully removed from your cart"
redirect_to '/cart'
end
end
end
end
Loading