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

Danielle Schrimmer & Kelly Tran : FarMarRails #46

Open
wants to merge 54 commits into
base: b/dis+kt/master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
2bdede8
removed delete-me file
dschrimm Oct 4, 2016
8fb5dc0
Generated market and vendor models
dschrimm Oct 4, 2016
6c75054
Created 4 models: market, vendor, product, sale. Also created the bel…
KellyPT Oct 4, 2016
76a99b0
Pulled data from CSV files to seeds.rb
KellyPT Oct 4, 2016
27a6bd2
Set up routes
dschrimm Oct 4, 2016
526e1a4
Generated Markets controller and 4 views (index,new, show, edit) corr…
KellyPT Oct 5, 2016
c238829
In previous commit, Kelly forgot to include a few files. In this comm…
KellyPT Oct 5, 2016
8d8b161
Generate Vendor controller and associated methods and view files
dschrimm Oct 5, 2016
8c35e73
Merge branch 'b/dis+kt/master' of https://github.com/KellyPT/FarMarRa…
dschrimm Oct 5, 2016
adc22d3
Add create new and edit views and links
dschrimm Oct 5, 2016
6b5e8d2
Add ref_id uniqueness validator
dschrimm Oct 5, 2016
064633a
Created root route in routes.rb. Created an overview method action in…
KellyPT Oct 5, 2016
ed0fa88
Merge branch 'b/dis+kt/master' of https://github.com/KellyPT/FarMarRa…
KellyPT Oct 5, 2016
870346a
commit _form and overview view for Markets
KellyPT Oct 5, 2016
68e7b39
Merge branch 'b/dis+kt/kelly1005' into b/dis+kt/master
KellyPT Oct 5, 2016
5442815
Add some homepage links and start vendor method
dschrimm Oct 5, 2016
9749e01
Created vendors method in Market model.
KellyPT Oct 5, 2016
2dc242d
Created products controller
dschrimm Oct 5, 2016
5c56989
in progress: product edit functionality
dschrimm Oct 5, 2016
dc6afc2
Created new routes and views to achieve 2 paths from the Homepage: (a…
KellyPT Oct 5, 2016
9505e67
Merge branch 'b/dis+kt/master' of https://github.com/KellyPT/FarMarRa…
KellyPT Oct 5, 2016
c33815c
Created nested vendors view inside a particular market ID
KellyPT Oct 6, 2016
7ea507c
Merge branch 'b/dis+kt/kelly1005_aft' into b/dis+kt/master
KellyPT Oct 6, 2016
2195cc5
Able to view list of products from new vendors/:id/products path. Rev…
dschrimm Oct 6, 2016
cc235aa
working form to create new product associated with vendor
dschrimm Oct 6, 2016
f4876c3
Edit and delete product functionalities
dschrimm Oct 6, 2016
f87f802
Add some table formating to vendors show
dschrimm Oct 6, 2016
8ef127a
Sales controller and show sales associated with vendor
dschrimm Oct 6, 2016
7fa3765
Finished the User view and Market view. Yay.
KellyPT Oct 7, 2016
dfe3105
Functionality to create new product sales and calculate a vendor's to…
dschrimm Oct 7, 2016
9b8ec90
Merge branch 'b/dis+kt/master' of https://github.com/KellyPT/FarMarRa…
dschrimm Oct 7, 2016
7bec57b
Functional monthly purchases and totals display
dschrimm Oct 7, 2016
b2ef627
Fixed product list, and monthly sales to calculate date correctly, di…
dschrimm Oct 7, 2016
75b41b9
Started modifying stylesheets.
KellyPT Oct 7, 2016
3538775
Add table formatting to vendors and products
dschrimm Oct 7, 2016
c71d603
Add table formatting for market views
dschrimm Oct 7, 2016
0264070
Add header/nav bar links
dschrimm Oct 7, 2016
8e6e6d1
Add footer and remove extra text on overview page
dschrimm Oct 7, 2016
8d64090
Remove individual product show route
dschrimm Oct 7, 2016
dbf9934
Played with homepage styling
KellyPT Oct 7, 2016
6c09542
fixed merge conflict
dschrimm Oct 7, 2016
75280be
Add tables to market view show and market/id/vendors
dschrimm Oct 7, 2016
7255f7f
Add link to go back to products
dschrimm Oct 7, 2016
322376e
Modified style sheet and overall layout
KellyPT Oct 7, 2016
1e3c2e9
Merge branch 'b/dis+kt/master' of https://github.com/KellyPT/FarMarRa…
KellyPT Oct 7, 2016
8cc5935
Fix update buttons layout in table
dschrimm Oct 7, 2016
ef3f6f0
Merge branch 'b/dis+kt/master' of https://github.com/KellyPT/FarMarRa…
dschrimm Oct 7, 2016
a52cbba
Continued to work on styling sheet and changed the Homepage
KellyPT Oct 7, 2016
9e291ec
Modified Gemfile
KellyPT Oct 7, 2016
ffe75ea
Modified gemfile.lock
KellyPT Oct 7, 2016
6563a9e
change production file
KellyPT Oct 7, 2016
c9d8881
Added table formatting and hyperlink style.Changed background image a…
KellyPT Oct 8, 2016
167660e
Modified some semantic tags and structures in order to sync with CSS …
KellyPT Oct 8, 2016
f746965
Added some hyperlinks to give users better navigation flow. Changed s…
KellyPT Oct 8, 2016
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
Binary file added .DS_Store
Binary file not shown.
9 changes: 7 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.7'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
Expand Down Expand Up @@ -35,6 +34,8 @@ gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
end

group :development do
Expand All @@ -45,3 +46,7 @@ group :development do
gem 'spring'
end

group :production do
gem 'pg'
gem 'rails_12factor'
end
8 changes: 8 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ GEM
nokogiri (1.6.8)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
pg (0.19.0)
pkg-config (1.1.7)
rack (1.6.4)
rack-test (0.6.3)
Expand All @@ -99,6 +100,11 @@ GEM
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
rails_12factor (0.0.3)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (4.2.7)
actionpack (= 4.2.7)
activesupport (= 4.2.7)
Expand Down Expand Up @@ -151,7 +157,9 @@ DEPENDENCIES
coffee-rails (~> 4.1.0)
jbuilder (~> 2.0)
jquery-rails
pg
rails (= 4.2.7)
rails_12factor
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
spring
Expand Down
Binary file added app/.DS_Store
Binary file not shown.
Binary file added app/assets/images/fruits.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/healthy-organic-food.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/lemons.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/tomatoes.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/vege.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/assets/javascripts/markets.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
3 changes: 3 additions & 0 deletions app/assets/javascripts/products.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
3 changes: 3 additions & 0 deletions app/assets/javascripts/sales.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
3 changes: 3 additions & 0 deletions app/assets/javascripts/vendors.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
121 changes: 121 additions & 0 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,124 @@
/*Section A: Overall font, background image, header, footer, body's background container */

* {
font-family: 'Lora', serif;
}

body {
background-image: url("healthy-organic-food.jpg");
background-size: auto;
}

.container {
margin: 30px 30px 30px 30px;
padding: 3px 50px 5px 50px;
background-color: #F1F2F2;
opacity: 0.90;
border-radius: 20px;
}

header {
border-bottom: 5px solid #CC3333;
font-weight: bolder;
text-align: center;
color: #CC3333;
}

header p {
font-size: 30px;
margin: auto;
padding-top: 30px;
padding-bottom: 5px;
}

header nav ul li {
font-size: 18px;
list-style-type: none;
display: inline-block;
padding-left: 20px;
padding-right: 20px;
}

header nav ul li a:link {
text-decoration: none;
color: #CC3333;
}

footer {
font-size: 15px;
color: #333333;
text-align: center;
margin-top: 100px;
line-height: 0.5;
}

/*Section B: Content display for body's container*/
main {
color: #333333;
line-height: 1.5;
}

main h1 {
text-align: center;
font-size: 25px;
}

main a:link {
text-decoration: none;
color: #CC3333;
}

table {
border-collapse: collapse;
width: auto;
}

th, td {
text-align: left;
padding: 15px;
border: 1px solid #CCCCCC;
}

th {
font-weight: 600;
font-weight: bold;
color: black;
background-color: #CCCCCC;
border: 1px solid #F1F2F2;
}
/*Section C: This is the Overview page*/

.overview {
text-align: center;
margin-top: 50px;
}

.overview li {
font-size: 25px;
list-style-type: none;
display: inline-block;
margin: 20px;
padding: 15px;
border: 2px solid #CC3333;
}

.overview li a:link {
text-decoration: none;
color: #333333;
}

.overview li a:visited {
text-decoration: none;
color: #333333;
}


/*MISC*/

a:hover {
background: #CCCCCC;
}

/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
Expand Down
3 changes: 3 additions & 0 deletions app/assets/stylesheets/markets.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the Markets controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/products.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the Products controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/sales.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the sales controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/vendors.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the Vendor controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
Binary file added app/controllers/.DS_Store
Binary file not shown.
77 changes: 77 additions & 0 deletions app/controllers/markets_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
class MarketsController < ApplicationController
def overview
end

def view_markets # show all markets
@markets = Market.all
end

def view_market # show a market
@market = Market.find(params[:id])
@vendors = @market.vendors
end

def index
@markets = Market.all
end

def show
@market = Market.find(params[:id])
end

def new
@market = Market.new
end

def create
@market = Market.new(market_params)
if @market.save
redirect_to markets_path
else
render :new
end
end

def edit #
@market = Market.find(params[:id])
end

def update #
@market = Market.find(params[:id])
if @market.update(market_params)
redirect_to markets_path
else
render :edit
end
end

def market_vendors
@market = Market.find(params[:id])
@vendors = @market.vendors
end

def market_new_vendor
@market = Market.find(params[:id])
@vendor = @market.vendors.build
end

def market_create_vendor
@market = Market.find(params[:id])
@vendor = @market.vendors.build(vendor_params)
if @vendor.save
redirect_to market_view_vendors_path
else
render :market_new_vendor
end
end

private

def market_params
params.require(:market).permit(:ref_id, :name, :address, :city, :county, :state, :zip)
end

def vendor_params
params.require(:vendor).permit(:ref_id, :name, :num_employees, :market_id)
end
end
54 changes: 54 additions & 0 deletions app/controllers/products_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
class ProductsController < ApplicationController

def index
@vendor = Vendor.find(params[:vendor_id])
@products = @vendor.products
end

def new
@vendor = Vendor.find(params[:vendor_id])
@product = @vendor.products.build
end

def create
@vendor = Vendor.find(params[:vendor_id])
@product = @vendor.products.new(prod_params)
if @product.save
# SAVED SUCCESSFULLY
redirect_to vendor_products_path
else
# DID NOT SAVE
puts @product.errors.messages
render :new
end
end

def edit
@vendor = Vendor.find(params[:vendor_id])
@product = Product.find(params[:id])
end

def update
@vendor = Vendor.find(params[:vendor_id])
@product = Product.find(params[:id])
if @product.update(prod_params)
# SUCCESS
redirect_to vendor_products_path
else
# NOPE
render :edit
end
end

def destroy
Product.find(params[:id]).destroy
redirect_to vendor_products_path
end

private

def prod_params
params.require(:product).permit(:ref_id, :name, :vendor_id)
end

end
32 changes: 32 additions & 0 deletions app/controllers/sales_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
class SalesController < ApplicationController

def index
@vendor = Vendor.find(params[:vendor_id])
@sales = @vendor.sales
end

def new
@vendor = Vendor.find(params[:vendor_id])
@sale = @vendor.sales.build
end

def create
@vendor = Vendor.find(params[:vendor_id])
@sale = @vendor.sales.new(sale_params)
if @sale.save
# SAVED SUCCESSFULLY
redirect_to vendor_sales_path
else
# DID NOT SAVE
puts @sale.errors.messages
render :new
end
end

private

def sale_params
params.require(:sale).permit(:ref_id, :product_id, :vendor_id, :amount, :purchase_time)
end

end
Loading