From 83614ce099ff4c63d6e9a257f5ce1c987b2a9d95 Mon Sep 17 00:00:00 2001 From: heatherherrington Date: Tue, 4 Oct 2016 12:31:37 -0700 Subject: [PATCH 01/52] Models set up --- Gemfile | 7 ++- Gemfile.lock | 16 ++++++ app/models/market.rb | 3 + app/models/product.rb | 4 ++ app/models/sale.rb | 4 ++ app/models/vendor.rb | 5 ++ db/migrate/20161004191027_create_markets.rb | 14 +++++ db/migrate/20161004191111_create_vendors.rb | 11 ++++ db/migrate/20161004191122_create_products.rb | 10 ++++ db/migrate/20161004191144_create_sales.rb | 12 ++++ ...161004192843_delete_column_from_markets.rb | 6 ++ db/schema.rb | 56 +++++++++++++++++++ test/fixtures/markets.yml | 17 ++++++ test/fixtures/products.yml | 7 +++ test/fixtures/sales.yml | 9 +++ test/fixtures/vendors.yml | 9 +++ test/models/market_test.rb | 7 +++ test/models/product_test.rb | 7 +++ test/models/sale_test.rb | 7 +++ test/models/vendor_test.rb | 7 +++ 20 files changed, 217 insertions(+), 1 deletion(-) create mode 100644 app/models/market.rb create mode 100644 app/models/product.rb create mode 100644 app/models/sale.rb create mode 100644 app/models/vendor.rb create mode 100644 db/migrate/20161004191027_create_markets.rb create mode 100644 db/migrate/20161004191111_create_vendors.rb create mode 100644 db/migrate/20161004191122_create_products.rb create mode 100644 db/migrate/20161004191144_create_sales.rb create mode 100644 db/migrate/20161004192843_delete_column_from_markets.rb create mode 100644 db/schema.rb create mode 100644 test/fixtures/markets.yml create mode 100644 test/fixtures/products.yml create mode 100644 test/fixtures/sales.yml create mode 100644 test/fixtures/vendors.yml create mode 100644 test/models/market_test.rb create mode 100644 test/models/product_test.rb create mode 100644 test/models/sale_test.rb create mode 100644 test/models/vendor_test.rb diff --git a/Gemfile b/Gemfile index e87fad5f..c4a50381 100644 --- a/Gemfile +++ b/Gemfile @@ -43,5 +43,10 @@ group :development do # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' -end + gem 'better_errors' + # Optional but allows more advanced features of better_errors + gem 'binding_of_caller' + + gem 'pry-rails' +end diff --git a/Gemfile.lock b/Gemfile.lock index 6c97c19f..6a4ecae9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,10 +37,15 @@ GEM thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) arel (6.0.3) + better_errors (2.1.1) + coderay (>= 1.0.0) + erubis (>= 2.6.6) + rack (>= 0.9.0) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) builder (3.2.2) byebug (9.0.6) + coderay (1.1.1) coffee-rails (4.1.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.1.x) @@ -67,6 +72,7 @@ GEM nokogiri (>= 1.5.9) mail (2.6.4) mime-types (>= 1.16, < 4) + method_source (0.8.2) mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) @@ -77,6 +83,12 @@ GEM mini_portile2 (~> 2.1.0) pkg-config (~> 1.1.7) pkg-config (1.1.7) + pry (0.10.4) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + pry-rails (0.3.4) + pry (>= 0.9.10) rack (1.6.4) rack-test (0.6.3) rack (>= 1.0) @@ -117,6 +129,7 @@ GEM sdoc (0.4.1) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) + slop (3.6.0) spring (2.0.0) activesupport (>= 4.2) sprockets (3.7.0) @@ -147,10 +160,13 @@ PLATFORMS ruby DEPENDENCIES + better_errors + binding_of_caller byebug coffee-rails (~> 4.1.0) jbuilder (~> 2.0) jquery-rails + pry-rails rails (= 4.2.7) sass-rails (~> 5.0) sdoc (~> 0.4.0) diff --git a/app/models/market.rb b/app/models/market.rb new file mode 100644 index 00000000..6a148291 --- /dev/null +++ b/app/models/market.rb @@ -0,0 +1,3 @@ +class Market < ActiveRecord::Base + has_many :vendors +end diff --git a/app/models/product.rb b/app/models/product.rb new file mode 100644 index 00000000..86f8d94b --- /dev/null +++ b/app/models/product.rb @@ -0,0 +1,4 @@ +class Product < ActiveRecord::Base + belongs_to :vendor + has_many :sales +end diff --git a/app/models/sale.rb b/app/models/sale.rb new file mode 100644 index 00000000..7142a28c --- /dev/null +++ b/app/models/sale.rb @@ -0,0 +1,4 @@ +class Sale < ActiveRecord::Base + belongs_to :vendor + belongs_to :product +end diff --git a/app/models/vendor.rb b/app/models/vendor.rb new file mode 100644 index 00000000..fd5a3471 --- /dev/null +++ b/app/models/vendor.rb @@ -0,0 +1,5 @@ +class Vendor < ActiveRecord::Base + belongs_to :market + has_many :products + has_many :sales +end diff --git a/db/migrate/20161004191027_create_markets.rb b/db/migrate/20161004191027_create_markets.rb new file mode 100644 index 00000000..8155ce25 --- /dev/null +++ b/db/migrate/20161004191027_create_markets.rb @@ -0,0 +1,14 @@ +class CreateMarkets < ActiveRecord::Migration + def change + create_table :markets do |t| + t.string :name + t.string :address + t.string :city + t.string :county + t.string :state + t.string :zip + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20161004191111_create_vendors.rb b/db/migrate/20161004191111_create_vendors.rb new file mode 100644 index 00000000..b1204a8e --- /dev/null +++ b/db/migrate/20161004191111_create_vendors.rb @@ -0,0 +1,11 @@ +class CreateVendors < ActiveRecord::Migration + def change + create_table :vendors do |t| + t.belongs_to :market, index: true + t.string :name + t.integer :employee_number + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20161004191122_create_products.rb b/db/migrate/20161004191122_create_products.rb new file mode 100644 index 00000000..058dff47 --- /dev/null +++ b/db/migrate/20161004191122_create_products.rb @@ -0,0 +1,10 @@ +class CreateProducts < ActiveRecord::Migration + def change + create_table :products do |t| + t.belongs_to :vendor, index: true + t.string :name + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20161004191144_create_sales.rb b/db/migrate/20161004191144_create_sales.rb new file mode 100644 index 00000000..86152f31 --- /dev/null +++ b/db/migrate/20161004191144_create_sales.rb @@ -0,0 +1,12 @@ +class CreateSales < ActiveRecord::Migration + def change + create_table :sales do |t| + t.belongs_to :vendor, index: true + t.belongs_to :product, index: true + t.integer :amount + t.datetime :purchase_time + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20161004192843_delete_column_from_markets.rb b/db/migrate/20161004192843_delete_column_from_markets.rb new file mode 100644 index 00000000..b8f2db8d --- /dev/null +++ b/db/migrate/20161004192843_delete_column_from_markets.rb @@ -0,0 +1,6 @@ +class DeleteColumnFromMarkets < ActiveRecord::Migration + def change + remove_column :markets, :state, :string + remove_column :markets, :zip, :string + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 00000000..7ed3a372 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,56 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20161004192843) do + + create_table "markets", force: :cascade do |t| + t.string "name" + t.string "address" + t.string "city" + t.string "county" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "products", force: :cascade do |t| + t.integer "vendor_id" + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "products", ["vendor_id"], name: "index_products_on_vendor_id" + + create_table "sales", force: :cascade do |t| + t.integer "vendor_id" + t.integer "product_id" + t.integer "amount" + t.datetime "purchase_time" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "sales", ["product_id"], name: "index_sales_on_product_id" + add_index "sales", ["vendor_id"], name: "index_sales_on_vendor_id" + + create_table "vendors", force: :cascade do |t| + t.integer "market_id" + t.string "name" + t.integer "employee_number" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "vendors", ["market_id"], name: "index_vendors_on_market_id" + +end diff --git a/test/fixtures/markets.yml b/test/fixtures/markets.yml new file mode 100644 index 00000000..13e26ee7 --- /dev/null +++ b/test/fixtures/markets.yml @@ -0,0 +1,17 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyString + address: MyString + city: MyString + county: MyString + state: MyString + zip: MyString + +two: + name: MyString + address: MyString + city: MyString + county: MyString + state: MyString + zip: MyString diff --git a/test/fixtures/products.yml b/test/fixtures/products.yml new file mode 100644 index 00000000..56066c68 --- /dev/null +++ b/test/fixtures/products.yml @@ -0,0 +1,7 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyString + +two: + name: MyString diff --git a/test/fixtures/sales.yml b/test/fixtures/sales.yml new file mode 100644 index 00000000..9f2ea287 --- /dev/null +++ b/test/fixtures/sales.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + amount: 1 + purchase_time: 2016-10-04 12:11:44 + +two: + amount: 1 + purchase_time: 2016-10-04 12:11:44 diff --git a/test/fixtures/vendors.yml b/test/fixtures/vendors.yml new file mode 100644 index 00000000..8e3e27a7 --- /dev/null +++ b/test/fixtures/vendors.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyString + employee_number: 1 + +two: + name: MyString + employee_number: 1 diff --git a/test/models/market_test.rb b/test/models/market_test.rb new file mode 100644 index 00000000..62e16016 --- /dev/null +++ b/test/models/market_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class MarketTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/product_test.rb b/test/models/product_test.rb new file mode 100644 index 00000000..211cdd0b --- /dev/null +++ b/test/models/product_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ProductTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/sale_test.rb b/test/models/sale_test.rb new file mode 100644 index 00000000..8f0c60c0 --- /dev/null +++ b/test/models/sale_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SaleTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/vendor_test.rb b/test/models/vendor_test.rb new file mode 100644 index 00000000..07dd4193 --- /dev/null +++ b/test/models/vendor_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class VendorTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end From fb01c35bbd880b4c63dc2e1bb43ae3b5a21d30c3 Mon Sep 17 00:00:00 2001 From: Shari Meggs Date: Tue, 4 Oct 2016 14:28:17 -0700 Subject: [PATCH 02/52] We added the columns back into market --- db/migrate/20161004212208_add_columns_to_market.rb | 6 ++++++ db/schema.rb | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20161004212208_add_columns_to_market.rb diff --git a/db/migrate/20161004212208_add_columns_to_market.rb b/db/migrate/20161004212208_add_columns_to_market.rb new file mode 100644 index 00000000..0c1968b7 --- /dev/null +++ b/db/migrate/20161004212208_add_columns_to_market.rb @@ -0,0 +1,6 @@ +class AddColumnsToMarket < ActiveRecord::Migration + def change + add_column :markets, :state, :string + add_column :markets, :zip, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 7ed3a372..26deda69 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20161004192843) do +ActiveRecord::Schema.define(version: 20161004212208) do create_table "markets", force: :cascade do |t| t.string "name" @@ -20,6 +20,8 @@ t.string "county" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.string "state" + t.string "zip" end create_table "products", force: :cascade do |t| From b5c37bb03e0b3c368ff33543042f830c9806fad9 Mon Sep 17 00:00:00 2001 From: Shari Meggs Date: Tue, 4 Oct 2016 15:01:50 -0700 Subject: [PATCH 03/52] WIP routes users/markets --- app/assets/javascripts/users.coffee | 3 +++ app/assets/stylesheets/users.scss | 3 +++ app/controllers/users_controller.rb | 7 +++++++ app/helpers/users_helper.rb | 2 ++ app/views/users/index.html.erb | 0 app/views/users/markets.html.erb | 0 config/routes.rb | 7 +++++++ test/controllers/users_controller_test.rb | 7 +++++++ 8 files changed, 29 insertions(+) create mode 100644 app/assets/javascripts/users.coffee create mode 100644 app/assets/stylesheets/users.scss create mode 100644 app/controllers/users_controller.rb create mode 100644 app/helpers/users_helper.rb create mode 100644 app/views/users/index.html.erb create mode 100644 app/views/users/markets.html.erb create mode 100644 test/controllers/users_controller_test.rb diff --git a/app/assets/javascripts/users.coffee b/app/assets/javascripts/users.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/users.coffee @@ -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/ diff --git a/app/assets/stylesheets/users.scss b/app/assets/stylesheets/users.scss new file mode 100644 index 00000000..31a2eacb --- /dev/null +++ b/app/assets/stylesheets/users.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Users controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb new file mode 100644 index 00000000..d341d153 --- /dev/null +++ b/app/controllers/users_controller.rb @@ -0,0 +1,7 @@ +class UsersController < ApplicationController + def index + end + + def show + end +end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb new file mode 100644 index 00000000..2310a240 --- /dev/null +++ b/app/helpers/users_helper.rb @@ -0,0 +1,2 @@ +module UsersHelper +end diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb new file mode 100644 index 00000000..e69de29b diff --git a/app/views/users/markets.html.erb b/app/views/users/markets.html.erb new file mode 100644 index 00000000..e69de29b diff --git a/config/routes.rb b/config/routes.rb index 3f66539d..e41d09fa 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,11 @@ Rails.application.routes.draw do + #We have created the first routes for markets and the user page. + root 'users#index' + get '/users' => 'users#index' + get '/users/markets' => 'users#show' + get '/users/markets/:id' => 'users#show' + + resources :markets # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb new file mode 100644 index 00000000..d23f1829 --- /dev/null +++ b/test/controllers/users_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UsersControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end From 4eddb42f54c12c37d5d3bff4a19a8c61734564d1 Mon Sep 17 00:00:00 2001 From: Shari Meggs Date: Tue, 4 Oct 2016 16:26:43 -0700 Subject: [PATCH 04/52] Imported data from market csv file --- app/controllers/users_controller.rb | 6 +++++- app/views/users/index.html.erb | 1 + app/views/users/markets.html.erb | 7 +++++++ app/views/users/show.html.erb | 1 + config/routes.rb | 2 +- db/seeds.rb | 15 +++++++++++++++ 6 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 app/views/users/show.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d341d153..cb1f4756 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,7 +1,11 @@ class UsersController < ApplicationController def index end - + def show end + + def markets + @market = Market.all + end end diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index e69de29b..3966e7fb 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -0,0 +1 @@ +

Main Page with navigation

diff --git a/app/views/users/markets.html.erb b/app/views/users/markets.html.erb index e69de29b..9e73772b 100644 --- a/app/views/users/markets.html.erb +++ b/app/views/users/markets.html.erb @@ -0,0 +1,7 @@ +

This is Where all the Markets live!

+ +

+ <%@market.each do |i|%> + <%=i.name%> + <%end%> +

diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb new file mode 100644 index 00000000..81a341aa --- /dev/null +++ b/app/views/users/show.html.erb @@ -0,0 +1 @@ +

This is how you see an individual market (with attributes and vendors)

diff --git a/config/routes.rb b/config/routes.rb index e41d09fa..79140b3c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,7 +2,7 @@ #We have created the first routes for markets and the user page. root 'users#index' get '/users' => 'users#index' - get '/users/markets' => 'users#show' + get '/users/markets' => 'users#markets' get '/users/markets/:id' => 'users#show' resources :markets diff --git a/db/seeds.rb b/db/seeds.rb index 4edb1e85..173c5684 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -5,3 +5,18 @@ # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel', city: cities.first) +require 'csv' + + + farm_mrkt = [] + CSV.open('./seed_csvs/markets.csv', 'r'). each do |place| + markets = {} + markets[:id] = place[0].to_i + markets[:name] = place[1] + markets[:address] = place[2] + markets[:city] = place[3] + markets[:county] = place[4] + markets[:state] = place[5] + markets[:zip] = place[6] + farm_mrkt << Market.create(markets) + end From f3505dcd1907ef62ca6f7f97469feae5c361e4a2 Mon Sep 17 00:00:00 2001 From: Shari Meggs Date: Tue, 4 Oct 2016 16:37:16 -0700 Subject: [PATCH 05/52] Seeded all data from CSV --- db/seeds.rb | 56 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index 173c5684..8fd732b5 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -8,15 +8,47 @@ require 'csv' - farm_mrkt = [] - CSV.open('./seed_csvs/markets.csv', 'r'). each do |place| - markets = {} - markets[:id] = place[0].to_i - markets[:name] = place[1] - markets[:address] = place[2] - markets[:city] = place[3] - markets[:county] = place[4] - markets[:state] = place[5] - markets[:zip] = place[6] - farm_mrkt << Market.create(markets) - end +farm_mrkt = [] +CSV.open('./seed_csvs/markets.csv', 'r'). each do |place| + markets = {} + markets[:id] = place[0].to_i + markets[:name] = place[1] + markets[:address] = place[2] + markets[:city] = place[3] + markets[:county] = place[4] + markets[:state] = place[5] + markets[:zip] = place[6] + farm_mrkt << Market.create(markets) +end + + +farm_vend = [] +CSV.open('./seed_csvs/vendors.csv', 'r').each do |vend| + vendors = {} + vendors[:id] = vend[0].to_i + vendors[:name] = vend[1] + vendors[:employee_number] = vend[2] + vendors[:market_id] = vend[3].to_i + farm_vend << Vendor.create(vendors) +end + +merch = [] +CSV.open('./seed_csvs/products.csv', 'r').each do |line| + products = {} + products[:id] = line[0].to_i + products[:name] = line[1] + products[:vendor_id] = line[2].to_i + merch << Product.create(products) +end + + +discount = [] +CSV.open('./seed_csvs/sales.csv', 'r').each do |line| + sales = {} + sales[:id] = line[0].to_i + sales[:amount] = line[1].to_i + sales[:purchase_time] = line[2] + sales[:vendor_id] = line[3].to_i + sales[:product_id] = line[4].to_i + discount << Sale.create(sales) +end From 10c1b469b5eea253a4c0088941fa0661565ba6a7 Mon Sep 17 00:00:00 2001 From: heatherherrington Date: Tue, 4 Oct 2016 16:54:55 -0700 Subject: [PATCH 06/52] Added text on pages regarding what info needs to go there --- app/views/layouts/application.html.erb | 4 ++++ app/views/users/index.html.erb | 3 +++ app/views/users/markets.html.erb | 3 +++ app/views/users/show.html.erb | 2 +- config/routes.rb | 4 +++- 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 443f3152..e369f996 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -10,5 +10,9 @@ <%= yield %> +
+ © 2016 by Shari and Heather!!! +
+ diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 3966e7fb..3110d408 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1 +1,4 @@

Main Page with navigation

+

+ Links to: Home, List of all Markets, "I wanna be a vendor", "I wanna be a market" +

diff --git a/app/views/users/markets.html.erb b/app/views/users/markets.html.erb index 9e73772b..67a39467 100644 --- a/app/views/users/markets.html.erb +++ b/app/views/users/markets.html.erb @@ -1,4 +1,7 @@

This is Where all the Markets live!

+

+ This will include a link for each market to its show page. +

<%@market.each do |i|%> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 81a341aa..e4258db5 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1 +1 @@ -

This is how you see an individual market (with attributes and vendors)

+

This is how you see an individual market (with attributes and vendors), no interactivity

diff --git a/config/routes.rb b/config/routes.rb index 79140b3c..bdc46f68 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,7 +5,9 @@ get '/users/markets' => 'users#markets' get '/users/markets/:id' => 'users#show' - resources :markets + resources :markets, except: [:destroy] + + # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". From 443475c31eda4fff2b55f42320b3ba3bd260b219 Mon Sep 17 00:00:00 2001 From: heatherherrington Date: Tue, 4 Oct 2016 21:35:27 -0700 Subject: [PATCH 07/52] Links and minor styling added to pages --- app/assets/stylesheets/application.css | 32 ++++++++++++++++++++++++++ app/views/layouts/application.html.erb | 23 +++++++++++++++++- app/views/users/markets.html.erb | 8 ++++--- 3 files changed, 59 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index f9cd5b34..5938d52c 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -13,3 +13,35 @@ *= require_tree . *= require_self */ +html { + font: normal normal 14px/1 "Helvetica Neue", Helvetica, Arial, sans-serif; +} + +header a { + color: white; + font-size: 18px; + margin: 0 15px; +} + +header { + padding: 30px 0; +} + +header li { + display: inline-block; +} + +.main-body { + padding-left: 20px; + padding-right: 20px; +} + +footer { + padding: 10px 0; +} + +header, footer { + background-color: #009900; + color: white; + text-align: center; +} diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index e369f996..18d74ad2 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -8,7 +8,28 @@ -<%= yield %> +
+
    +
  • + <%= link_to "Home Page", root_path %> +
  • +
  • + <%= link_to "List of All Markets", users_markets_path %> +
  • +
  • + <%= link_to "Market Main Page", markets_path %> +
  • +
  • + <%= link_to "Vendor Main Page", vendors_path %> +
  • +
+
+ +
+ + <%= yield %> + +