-
Notifications
You must be signed in to change notification settings - Fork 11
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
completed requirements plus some extras #12
base: jbkd/master
Are you sure you want to change the base?
Changes from 92 commits
090634d
1563530
5be829e
e87afb8
30a4e47
efdd637
7f95f5c
4c76560
fdbca95
15a9b8e
5d53381
3978b6e
f8f679a
f2d54a0
99ba33f
144fc89
a734d26
041812a
b8d8e4d
6412d59
d21271c
e86b601
17a6be6
cc898cd
de245b3
0a1b276
cbac173
728654b
25ac4c9
2da03ed
b59bc1e
c46b678
26e8bc8
83a04a8
935d2c1
99f8d47
375a1dd
66d0517
cbe1ab0
c2e8444
7d79755
6aab5b1
0e1be50
1a36bba
58082a5
fedd7f4
84a5bac
407b085
1cee12b
0a2dfdb
6404e6c
3ac48df
97d0c9e
a6a6936
52b40bf
0b49409
e4c2560
e31c114
f784776
2193929
fd804ee
645a5ff
cd17a7c
b203708
48db4d9
28eda78
994b468
5d938c0
494e8e1
126ff93
36a32ab
1abddb0
18feb22
968a80c
8fbb4a9
d63d246
46a0bd9
aab2d6f
302a07a
f0c40c3
3d8f3e7
cdb0b16
84111c4
d6ffbfc
8d352b6
ad0e66a
f17db49
d4ddca2
4fba312
ef03c91
0ed6531
b7ede7a
054c0b5
7990bb4
ed6d9da
0b1ac8e
348c3bd
a0ae3c4
4e571ef
517f594
7d1c46c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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/ |
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/ |
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/ |
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/ |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
/* | ||
* This is a manifest file that'll be compiled into application.css, which will include all the files | ||
* listed below. | ||
* | ||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, | ||
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. | ||
* | ||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the | ||
* compiled file so the styles you add here take precedence over styles defined in any styles | ||
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new | ||
* file per style scope. | ||
* | ||
*/ | ||
|
||
// "bootstrap-sprockets" must be imported before "bootstrap" and "bootstrap/variables" | ||
@import "bootstrap-sprockets"; | ||
@import "bootstrap"; | ||
@import url(https://fonts.googleapis.com/css?family=Bitter:700); | ||
@import url(https://fonts.googleapis.com/css?family=Lato); | ||
|
||
$purple: rgb(80, 48, 90); | ||
$yellow: rgb(227, 230, 61); | ||
$orange: rgb(231, 110, 38); | ||
|
||
$jumbo-height: 350px; | ||
$title-font: 'Bitter', serif; | ||
$body-font: 'Lato', sans-serif; | ||
|
||
.navbar-inverse { | ||
background-color: $purple; | ||
} | ||
.navbar-inverse .navbar-nav > li > a, | ||
.btn, | ||
.btn-primary | ||
{ | ||
background-color: $purple; | ||
font-size: 1.2em; | ||
color: $yellow; | ||
font-weight: bold; | ||
transition: all 0.5s ease-out; | ||
&:hover, | ||
&:active { | ||
background-color: $yellow; | ||
color: $purple; | ||
transition: all 0.2s ease-out; | ||
} | ||
} | ||
|
||
.navbar-inverse .navbar-nav > .open > a, | ||
.navbar-inverse .navbar-nav > .open > a:hover, | ||
.navbar-inverse .navbar-nav > .open > a:focus { | ||
background-color: $yellow; | ||
color: $purple; | ||
transition: all 0.2s ease-out; | ||
} | ||
|
||
|
||
#logo { | ||
float: left; | ||
margin-right: 10px; | ||
font-size: 1.7em; | ||
color: $yellow; | ||
letter-spacing: -1px; | ||
padding-top: 9px; | ||
font-weight: bold; | ||
&:hover { | ||
color: $yellow; | ||
text-decoration: none; | ||
} | ||
} | ||
|
||
.jumbotron { | ||
height: $jumbo-height; | ||
color: $yellow; | ||
text-shadow: #444 1px 2px 1px; | ||
background:transparent; | ||
padding-top: 70px; | ||
h1{ | ||
color: $yellow; | ||
font-size: 5em; | ||
} | ||
} | ||
|
||
h1 { | ||
font-family: $title-font; | ||
} | ||
|
||
.centered-block { | ||
margin: auto; | ||
} | ||
|
||
.centered-button { | ||
margin-top: 20vh; | ||
} | ||
|
||
thead { | ||
font-size: 1.3em; | ||
font-weight: bold; | ||
} | ||
|
||
.table-color { | ||
border-collapse:collapse; | ||
border:2px solid $purple; | ||
thead { | ||
background: $yellow; | ||
} | ||
} | ||
|
||
body { | ||
font-family: $body-font; | ||
} | ||
|
||
// Parallax code from http://www.cssscript.com/simple-parallax-scrolling-effect-pure-css3/ | ||
// Parallax necessary CSS | ||
.parallax { | ||
height: 100vh; | ||
overflow-x: hidden; | ||
overflow-y: auto; | ||
perspective: 1px; | ||
-webkit-perspective: 1px; | ||
} | ||
.parallax_layer { | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
} | ||
.parallax_layer_base { | ||
transform: translateZ(0); | ||
-webkit-transform: translateZ(0); | ||
} | ||
.parallax_layer_back { | ||
-webkit-transform: translateZ(-1px); | ||
transform: translateZ(-0.5px) scale(2); | ||
} |
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/ |
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/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the Sessions controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the static_pages controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,58 @@ | ||
class MarketsController < ApplicationController | ||
|
||
def index | ||
@markets = Market.all | ||
end | ||
|
||
def new | ||
@market = Market.new | ||
end | ||
|
||
def create | ||
Market.create(market_params[:market]) | ||
redirect_to "/markets" | ||
end | ||
|
||
def edit | ||
id = params[:id] | ||
@market = Market.find(id) | ||
end | ||
|
||
def show | ||
id = params[:id] | ||
@market = Market.find(id) | ||
@vendors = Market.find(id).vendors | ||
end | ||
|
||
def update | ||
id = params[:id] | ||
@market = Market.find(id) | ||
@market.update( | ||
name: market_params[:market][:name], | ||
address: market_params[:market][:address], | ||
city: market_params[:market][:city], | ||
county: market_params[:market][:county], | ||
state: market_params[:market][:state], | ||
zip: market_params[:market][:zip] | ||
) | ||
redirect_to "/markets" | ||
end | ||
|
||
def destroy | ||
id = params[:id] | ||
Market.destroy(id) | ||
redirect_to "/markets" | ||
end | ||
|
||
def search | ||
@markets = Market.where("name LIKE ?" , params[:search_term]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like it may be better to have this |
||
render :index | ||
end | ||
|
||
private | ||
|
||
def market_params | ||
params.permit(market:[:id, :name, :address, :city, :county, :state, :zip]) | ||
end | ||
|
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
class ProductsController < ApplicationController | ||
def index | ||
@vendor_id = params[:vendor_id] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do |
||
@id = params[:id] | ||
@products = Vendor.find(@vendor_id).products | ||
end | ||
|
||
def new | ||
@product = Product.new | ||
@url_path = vendor_products_path | ||
end | ||
|
||
def create | ||
vendor_id = params[:vendor_id] | ||
Product.create( | ||
name: product_params[:product][:name], | ||
vendor_id: session[:vendor_id]) | ||
redirect_to "/vendors/#{vendor_id}/products" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is better to use a named path rather than the URL itself. Is there a named path for this route that you could use instead? |
||
end | ||
|
||
def edit | ||
id = params[:id] | ||
@product = Product.find(id) | ||
@url_path = vendor_product_path | ||
end | ||
|
||
def show | ||
id = params[:id] | ||
@product = Product.find(id) | ||
end | ||
|
||
def update | ||
id = params[:id] | ||
vendor_id = params[:vendor_id] | ||
@product = Product.find(id) | ||
@product.update( | ||
name: product_params[:product][:name], | ||
vendor_id: product_params[:product][:vendor_id] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wondering if this update works because the |
||
) | ||
redirect_to "/vendors/#{vendor_id}/products/#{id}" | ||
end | ||
|
||
def destroy | ||
@id = params[:id] | ||
@vendor_id = params[:vendor_id] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question re: instance variables vs local variables |
||
Product.destroy(@id) | ||
redirect_to "/vendors/#{@vendor_id}/products" | ||
end | ||
|
||
private | ||
|
||
def product_params | ||
params.permit(product:[:name]) | ||
end | ||
|
||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to see some refactoring of the
id
and@market
variables to use abefore_action