From 088b26138b57894fdf7f6b8d911a8d48681b7278 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Tue, 26 Apr 2016 14:04:41 -0700 Subject: [PATCH 01/53] First commit. Testing that we understand branching correctly. --- test.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 test.md diff --git a/test.md b/test.md new file mode 100644 index 00000000..7920506e --- /dev/null +++ b/test.md @@ -0,0 +1,7 @@ +This is a test. Can we branch and not mess things up? + +Whoo. + +Yeah. + +Tests. From bad5254cc69325b4ba9a403ef7388ab4ad2f689f Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Tue, 26 Apr 2016 14:08:28 -0700 Subject: [PATCH 02/53] Test continuation this time, ON A BRANCH oooh aaaaah. --- test.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/test.md b/test.md index 7920506e..ccc89ad5 100644 --- a/test.md +++ b/test.md @@ -1,7 +1,3 @@ This is a test. Can we branch and not mess things up? -Whoo. - -Yeah. - -Tests. +I have deleted some stuff, and now I am adding some stuff. From 1573135637a0e69280284c84986157c035452698 Mon Sep 17 00:00:00 2001 From: Cristal Tay Date: Tue, 26 Apr 2016 14:11:19 -0700 Subject: [PATCH 03/53] cristal making changes on the same file. we gonna try to merge our branches. --- test.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test.md b/test.md index 7920506e..5a46ed34 100644 --- a/test.md +++ b/test.md @@ -1,7 +1,9 @@ This is a test. Can we branch and not mess things up? -Whoo. - -Yeah. - -Tests. +lalalalalalala +lalalalalalala +lalalalalalala +lalalalalalala +lalalalalalala +lalalalalalala +lalalalalalala From b733aa5ae4724499775c34ecf6acb17088d6aa25 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Tue, 26 Apr 2016 14:16:53 -0700 Subject: [PATCH 04/53] Test number two. Are we doing this right? Whooooo knows! Not me. --- test.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test.md b/test.md index 92979179..10290384 100644 --- a/test.md +++ b/test.md @@ -13,3 +13,5 @@ I have deleted some stuff, and now I am adding some stuff. TRYING git checkout foo git checkout master + +This is Jillian, in her new branch. Trying to branch and merge again! From 4c5b52bd147e17b2a484d5dfbade51909de766e2 Mon Sep 17 00:00:00 2001 From: Cristal Tay Date: Tue, 26 Apr 2016 14:17:28 -0700 Subject: [PATCH 05/53] CT adding another branch --- test.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test.md b/test.md index 92979179..2714b405 100644 --- a/test.md +++ b/test.md @@ -13,3 +13,6 @@ I have deleted some stuff, and now I am adding some stuff. TRYING git checkout foo git checkout master + +ADDING MY OWN SHIT YO +meow meow meow From 7ccf7b8b4db5472a4267d214f934ba71353a3662 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Tue, 26 Apr 2016 14:25:09 -0700 Subject: [PATCH 06/53] Removed the test file. Now we make trello and ERD. --- test.md | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 test.md diff --git a/test.md b/test.md deleted file mode 100644 index e5eb0b1f..00000000 --- a/test.md +++ /dev/null @@ -1,21 +0,0 @@ -This is a test. Can we branch and not mess things up? - -lalalalalalala -lalalalalalala -lalalalalalala -lalalalalalala -lalalalalalala -lalalalalalala -lalalalalalala - -I have deleted some stuff, and now I am adding some stuff. - - -TRYING git checkout foo -git checkout master - - -This is Jillian, in her new branch. Trying to branch and merge again! - -ADDING MY OWN SHIT YO -meow meow meow From f9ff0db8fb608521b73db1b0a9a48020e5239036 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Tue, 26 Apr 2016 15:59:15 -0700 Subject: [PATCH 07/53] Set up new Rails app, added controllers and models. Have not yet seeded database. We're currently discussing if we would like to override the primary key to the id already contained within the csv files. --- .gitignore | 18 +- Gemfile | 47 +++++ Gemfile.lock | 160 ++++++++++++++++++ README.rdoc | 28 +++ Rakefile | 6 + app/assets/images/.keep | 0 app/assets/javascripts/application.js | 16 ++ app/assets/javascripts/markets.coffee | 3 + app/assets/javascripts/products.coffee | 3 + app/assets/javascripts/sales.coffee | 3 + app/assets/javascripts/vendors.coffee | 3 + app/assets/stylesheets/application.css | 15 ++ app/assets/stylesheets/markets.scss | 3 + app/assets/stylesheets/products.scss | 3 + app/assets/stylesheets/sales.scss | 3 + app/assets/stylesheets/vendors.scss | 3 + app/controllers/application_controller.rb | 5 + app/controllers/concerns/.keep | 0 app/controllers/markets_controller.rb | 2 + app/controllers/products_controller.rb | 2 + app/controllers/sales_controller.rb | 2 + app/controllers/vendors_controller.rb | 2 + app/helpers/application_helper.rb | 2 + app/helpers/markets_helper.rb | 2 + app/helpers/products_helper.rb | 2 + app/helpers/sales_helper.rb | 2 + app/helpers/vendors_helper.rb | 2 + app/mailers/.keep | 0 app/models/.keep | 0 app/models/concerns/.keep | 0 app/models/market.rb | 2 + app/models/product.rb | 2 + app/models/sale.rb | 2 + app/models/vendor.rb | 2 + app/views/layouts/application.html.erb | 14 ++ bin/bundle | 3 + bin/rails | 9 + bin/rake | 9 + bin/setup | 29 ++++ bin/spring | 15 ++ config.ru | 4 + config/application.rb | 26 +++ config/boot.rb | 3 + config/database.yml | 25 +++ config/environment.rb | 5 + config/environments/development.rb | 41 +++++ config/environments/production.rb | 79 +++++++++ config/environments/test.rb | 42 +++++ config/initializers/assets.rb | 11 ++ config/initializers/backtrace_silencers.rb | 7 + config/initializers/cookies_serializer.rb | 3 + .../initializers/filter_parameter_logging.rb | 4 + config/initializers/inflections.rb | 16 ++ config/initializers/mime_types.rb | 4 + config/initializers/session_store.rb | 3 + config/initializers/wrap_parameters.rb | 14 ++ config/locales/en.yml | 23 +++ config/routes.rb | 56 ++++++ config/secrets.yml | 22 +++ db/migrate/20160426222652_create_markets.rb | 15 ++ db/migrate/20160426222717_create_sales.rb | 13 ++ db/migrate/20160426222723_create_vendors.rb | 12 ++ db/migrate/20160426222728_create_products.rb | 11 ++ db/seeds.rb | 7 + lib/assets/.keep | 0 lib/tasks/.keep | 0 log/.keep | 0 public/404.html | 67 ++++++++ public/422.html | 67 ++++++++ public/500.html | 66 ++++++++ public/favicon.ico | 0 public/robots.txt | 5 + test/controllers/.keep | 0 test/controllers/markets_controller_test.rb | 7 + test/controllers/products_controller_test.rb | 7 + test/controllers/sales_controller_test.rb | 7 + test/controllers/vendors_controller_test.rb | 7 + test/fixtures/.keep | 0 test/fixtures/markets.yml | 11 ++ test/fixtures/products.yml | 11 ++ test/fixtures/sales.yml | 11 ++ test/fixtures/vendors.yml | 11 ++ test/helpers/.keep | 0 test/integration/.keep | 0 test/mailers/.keep | 0 test/models/.keep | 0 test/models/market_test.rb | 7 + test/models/product_test.rb | 7 + test/models/sale_test.rb | 7 + test/models/vendor_test.rb | 7 + test/test_helper.rb | 10 ++ vendor/assets/javascripts/.keep | 0 vendor/assets/stylesheets/.keep | 0 93 files changed, 1184 insertions(+), 1 deletion(-) create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 README.rdoc create mode 100644 Rakefile create mode 100644 app/assets/images/.keep create mode 100644 app/assets/javascripts/application.js create mode 100644 app/assets/javascripts/markets.coffee create mode 100644 app/assets/javascripts/products.coffee create mode 100644 app/assets/javascripts/sales.coffee create mode 100644 app/assets/javascripts/vendors.coffee create mode 100644 app/assets/stylesheets/application.css create mode 100644 app/assets/stylesheets/markets.scss create mode 100644 app/assets/stylesheets/products.scss create mode 100644 app/assets/stylesheets/sales.scss create mode 100644 app/assets/stylesheets/vendors.scss create mode 100644 app/controllers/application_controller.rb create mode 100644 app/controllers/concerns/.keep create mode 100644 app/controllers/markets_controller.rb create mode 100644 app/controllers/products_controller.rb create mode 100644 app/controllers/sales_controller.rb create mode 100644 app/controllers/vendors_controller.rb create mode 100644 app/helpers/application_helper.rb create mode 100644 app/helpers/markets_helper.rb create mode 100644 app/helpers/products_helper.rb create mode 100644 app/helpers/sales_helper.rb create mode 100644 app/helpers/vendors_helper.rb create mode 100644 app/mailers/.keep create mode 100644 app/models/.keep create mode 100644 app/models/concerns/.keep 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 app/views/layouts/application.html.erb create mode 100755 bin/bundle create mode 100755 bin/rails create mode 100755 bin/rake create mode 100755 bin/setup create mode 100755 bin/spring create mode 100644 config.ru create mode 100644 config/application.rb create mode 100644 config/boot.rb create mode 100644 config/database.yml create mode 100644 config/environment.rb create mode 100644 config/environments/development.rb create mode 100644 config/environments/production.rb create mode 100644 config/environments/test.rb create mode 100644 config/initializers/assets.rb create mode 100644 config/initializers/backtrace_silencers.rb create mode 100644 config/initializers/cookies_serializer.rb create mode 100644 config/initializers/filter_parameter_logging.rb create mode 100644 config/initializers/inflections.rb create mode 100644 config/initializers/mime_types.rb create mode 100644 config/initializers/session_store.rb create mode 100644 config/initializers/wrap_parameters.rb create mode 100644 config/locales/en.yml create mode 100644 config/routes.rb create mode 100644 config/secrets.yml create mode 100644 db/migrate/20160426222652_create_markets.rb create mode 100644 db/migrate/20160426222717_create_sales.rb create mode 100644 db/migrate/20160426222723_create_vendors.rb create mode 100644 db/migrate/20160426222728_create_products.rb create mode 100644 db/seeds.rb create mode 100644 lib/assets/.keep create mode 100644 lib/tasks/.keep create mode 100644 log/.keep create mode 100644 public/404.html create mode 100644 public/422.html create mode 100644 public/500.html create mode 100644 public/favicon.ico create mode 100644 public/robots.txt create mode 100644 test/controllers/.keep create mode 100644 test/controllers/markets_controller_test.rb create mode 100644 test/controllers/products_controller_test.rb create mode 100644 test/controllers/sales_controller_test.rb create mode 100644 test/controllers/vendors_controller_test.rb create mode 100644 test/fixtures/.keep 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/helpers/.keep create mode 100644 test/integration/.keep create mode 100644 test/mailers/.keep create mode 100644 test/models/.keep 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 create mode 100644 test/test_helper.rb create mode 100644 vendor/assets/javascripts/.keep create mode 100644 vendor/assets/stylesheets/.keep diff --git a/.gitignore b/.gitignore index e43b0f98..050c9d95 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,17 @@ -.DS_Store +# See https://help.github.com/articles/ignoring-files for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile '~/.gitignore_global' + +# Ignore bundler config. +/.bundle + +# Ignore the default SQLite database. +/db/*.sqlite3 +/db/*.sqlite3-journal + +# Ignore all logfiles and tempfiles. +/log/* +!/log/.keep +/tmp diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..d0ca1fdd --- /dev/null +++ b/Gemfile @@ -0,0 +1,47 @@ +source 'https://rubygems.org' + + +# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' +gem 'rails', '4.2.6' +# 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 +gem 'uglifier', '>= 1.3.0' +# Use CoffeeScript for .coffee assets and views +gem 'coffee-rails', '~> 4.1.0' +# See https://github.com/rails/execjs#readme for more supported runtimes +# gem 'therubyracer', platforms: :ruby + +# Use jquery as the JavaScript library +gem 'jquery-rails' +# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks +gem 'turbolinks' +# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder +gem 'jbuilder', '~> 2.0' +# bundle exec rake doc:rails generates the API under doc/api. +gem 'sdoc', '~> 0.4.0', group: :doc + +# Use ActiveModel has_secure_password +# gem 'bcrypt', '~> 3.1.7' + +# Use Unicorn as the app server +# gem 'unicorn' + +# Use Capistrano for deployment +# gem 'capistrano-rails', group: :development + +group :development, :test do + # Call 'byebug' anywhere in the code to stop execution and get a debugger console + gem 'byebug' +end + +group :development do + # Access an IRB console on exception pages or by using <%= console %> in views + gem 'web-console', '~> 2.0' + + # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring + gem 'spring' +end + diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 00000000..d4b12fb3 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,160 @@ +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.2.6) + actionpack (= 4.2.6) + actionview (= 4.2.6) + activejob (= 4.2.6) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.6) + actionview (= 4.2.6) + activesupport (= 4.2.6) + rack (~> 1.6) + rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.6) + activesupport (= 4.2.6) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + activejob (4.2.6) + activesupport (= 4.2.6) + globalid (>= 0.3.0) + activemodel (4.2.6) + activesupport (= 4.2.6) + builder (~> 3.1) + activerecord (4.2.6) + activemodel (= 4.2.6) + activesupport (= 4.2.6) + arel (~> 6.0) + activesupport (4.2.6) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + arel (6.0.3) + binding_of_caller (0.7.2) + debug_inspector (>= 0.0.1) + builder (3.2.2) + byebug (8.2.4) + coffee-rails (4.1.1) + coffee-script (>= 2.2.0) + railties (>= 4.0.0, < 5.1.x) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.10.0) + concurrent-ruby (1.0.1) + debug_inspector (0.0.2) + erubis (2.7.0) + execjs (2.6.0) + globalid (0.3.6) + activesupport (>= 4.1.0) + i18n (0.7.0) + jbuilder (2.4.1) + activesupport (>= 3.0.0, < 5.1) + multi_json (~> 1.2) + jquery-rails (4.1.1) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) + json (1.8.3) + loofah (2.0.3) + nokogiri (>= 1.5.9) + mail (2.6.4) + mime-types (>= 1.16, < 4) + mime-types (3.0) + mime-types-data (~> 3.2015) + mime-types-data (3.2016.0221) + mini_portile2 (2.0.0) + minitest (5.8.4) + multi_json (1.11.3) + nokogiri (1.6.7.2) + mini_portile2 (~> 2.0.0.rc2) + rack (1.6.4) + rack-test (0.6.3) + rack (>= 1.0) + rails (4.2.6) + actionmailer (= 4.2.6) + actionpack (= 4.2.6) + actionview (= 4.2.6) + activejob (= 4.2.6) + activemodel (= 4.2.6) + activerecord (= 4.2.6) + activesupport (= 4.2.6) + bundler (>= 1.3.0, < 2.0) + railties (= 4.2.6) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.7) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.3) + loofah (~> 2.0) + railties (4.2.6) + actionpack (= 4.2.6) + activesupport (= 4.2.6) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (11.1.2) + rdoc (4.2.2) + json (~> 1.4) + sass (3.4.22) + sass-rails (5.0.4) + railties (>= 4.0.0, < 5.0) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (>= 1.1, < 3) + sdoc (0.4.1) + json (~> 1.7, >= 1.7.7) + rdoc (~> 4.0) + spring (1.7.1) + sprockets (3.6.0) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.0.4) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.3.11) + thor (0.19.1) + thread_safe (0.3.5) + tilt (2.0.2) + turbolinks (2.5.3) + coffee-rails + tzinfo (1.2.2) + thread_safe (~> 0.1) + uglifier (3.0.0) + execjs (>= 0.3.0, < 3) + web-console (2.3.0) + activemodel (>= 4.0) + binding_of_caller (>= 0.7.2) + railties (>= 4.0) + sprockets-rails (>= 2.0, < 4.0) + +PLATFORMS + ruby + +DEPENDENCIES + byebug + coffee-rails (~> 4.1.0) + jbuilder (~> 2.0) + jquery-rails + rails (= 4.2.6) + sass-rails (~> 5.0) + sdoc (~> 0.4.0) + spring + sqlite3 + turbolinks + uglifier (>= 1.3.0) + web-console (~> 2.0) + +BUNDLED WITH + 1.11.2 diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 00000000..dd4e97e2 --- /dev/null +++ b/README.rdoc @@ -0,0 +1,28 @@ +== README + +This README would normally document whatever steps are necessary to get the +application up and running. + +Things you may want to cover: + +* Ruby version + +* System dependencies + +* Configuration + +* Database creation + +* Database initialization + +* How to run the test suite + +* Services (job queues, cache servers, search engines, etc.) + +* Deployment instructions + +* ... + + +Please feel free to use a different markup language if you do not plan to run +rake doc:app. diff --git a/Rakefile b/Rakefile new file mode 100644 index 00000000..ba6b733d --- /dev/null +++ b/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +Rails.application.load_tasks diff --git a/app/assets/images/.keep b/app/assets/images/.keep new file mode 100644 index 00000000..e69de29b diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 00000000..e07c5a83 --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,16 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// compiled file. +// +// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details +// about supported directives. +// +//= require jquery +//= require jquery_ujs +//= require turbolinks +//= require_tree . diff --git a/app/assets/javascripts/markets.coffee b/app/assets/javascripts/markets.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/markets.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/javascripts/products.coffee b/app/assets/javascripts/products.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/products.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/javascripts/sales.coffee b/app/assets/javascripts/sales.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/sales.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/javascripts/vendors.coffee b/app/assets/javascripts/vendors.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/vendors.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/application.css b/app/assets/stylesheets/application.css new file mode 100644 index 00000000..f9cd5b34 --- /dev/null +++ b/app/assets/stylesheets/application.css @@ -0,0 +1,15 @@ +/* + * 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. + * + *= require_tree . + *= require_self + */ diff --git a/app/assets/stylesheets/markets.scss b/app/assets/stylesheets/markets.scss new file mode 100644 index 00000000..98116b70 --- /dev/null +++ b/app/assets/stylesheets/markets.scss @@ -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/ diff --git a/app/assets/stylesheets/products.scss b/app/assets/stylesheets/products.scss new file mode 100644 index 00000000..bff386e5 --- /dev/null +++ b/app/assets/stylesheets/products.scss @@ -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/ diff --git a/app/assets/stylesheets/sales.scss b/app/assets/stylesheets/sales.scss new file mode 100644 index 00000000..5126e4bf --- /dev/null +++ b/app/assets/stylesheets/sales.scss @@ -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/ diff --git a/app/assets/stylesheets/vendors.scss b/app/assets/stylesheets/vendors.scss new file mode 100644 index 00000000..2dccbc2b --- /dev/null +++ b/app/assets/stylesheets/vendors.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Vendors 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/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 00000000..d83690e1 --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,5 @@ +class ApplicationController < ActionController::Base + # Prevent CSRF attacks by raising an exception. + # For APIs, you may want to use :null_session instead. + protect_from_forgery with: :exception +end diff --git a/app/controllers/concerns/.keep b/app/controllers/concerns/.keep new file mode 100644 index 00000000..e69de29b diff --git a/app/controllers/markets_controller.rb b/app/controllers/markets_controller.rb new file mode 100644 index 00000000..fa158671 --- /dev/null +++ b/app/controllers/markets_controller.rb @@ -0,0 +1,2 @@ +class MarketsController < ApplicationController +end diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb new file mode 100644 index 00000000..f1ad12dd --- /dev/null +++ b/app/controllers/products_controller.rb @@ -0,0 +1,2 @@ +class ProductsController < ApplicationController +end diff --git a/app/controllers/sales_controller.rb b/app/controllers/sales_controller.rb new file mode 100644 index 00000000..1b778cf3 --- /dev/null +++ b/app/controllers/sales_controller.rb @@ -0,0 +1,2 @@ +class SalesController < ApplicationController +end diff --git a/app/controllers/vendors_controller.rb b/app/controllers/vendors_controller.rb new file mode 100644 index 00000000..f14c7ec9 --- /dev/null +++ b/app/controllers/vendors_controller.rb @@ -0,0 +1,2 @@ +class VendorsController < ApplicationController +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb new file mode 100644 index 00000000..de6be794 --- /dev/null +++ b/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/app/helpers/markets_helper.rb b/app/helpers/markets_helper.rb new file mode 100644 index 00000000..655b79b7 --- /dev/null +++ b/app/helpers/markets_helper.rb @@ -0,0 +1,2 @@ +module MarketsHelper +end diff --git a/app/helpers/products_helper.rb b/app/helpers/products_helper.rb new file mode 100644 index 00000000..ab5c42b3 --- /dev/null +++ b/app/helpers/products_helper.rb @@ -0,0 +1,2 @@ +module ProductsHelper +end diff --git a/app/helpers/sales_helper.rb b/app/helpers/sales_helper.rb new file mode 100644 index 00000000..8611c4a0 --- /dev/null +++ b/app/helpers/sales_helper.rb @@ -0,0 +1,2 @@ +module SalesHelper +end diff --git a/app/helpers/vendors_helper.rb b/app/helpers/vendors_helper.rb new file mode 100644 index 00000000..5429ffa4 --- /dev/null +++ b/app/helpers/vendors_helper.rb @@ -0,0 +1,2 @@ +module VendorsHelper +end diff --git a/app/mailers/.keep b/app/mailers/.keep new file mode 100644 index 00000000..e69de29b diff --git a/app/models/.keep b/app/models/.keep new file mode 100644 index 00000000..e69de29b diff --git a/app/models/concerns/.keep b/app/models/concerns/.keep new file mode 100644 index 00000000..e69de29b diff --git a/app/models/market.rb b/app/models/market.rb new file mode 100644 index 00000000..1a4a52dd --- /dev/null +++ b/app/models/market.rb @@ -0,0 +1,2 @@ +class Market < ActiveRecord::Base +end diff --git a/app/models/product.rb b/app/models/product.rb new file mode 100644 index 00000000..077a8197 --- /dev/null +++ b/app/models/product.rb @@ -0,0 +1,2 @@ +class Product < ActiveRecord::Base +end diff --git a/app/models/sale.rb b/app/models/sale.rb new file mode 100644 index 00000000..870f2c20 --- /dev/null +++ b/app/models/sale.rb @@ -0,0 +1,2 @@ +class Sale < ActiveRecord::Base +end diff --git a/app/models/vendor.rb b/app/models/vendor.rb new file mode 100644 index 00000000..dac23f0a --- /dev/null +++ b/app/models/vendor.rb @@ -0,0 +1,2 @@ +class Vendor < ActiveRecord::Base +end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb new file mode 100644 index 00000000..443f3152 --- /dev/null +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ + + + + FarMarRails + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> + <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> + <%= csrf_meta_tags %> + + + +<%= yield %> + + + diff --git a/bin/bundle b/bin/bundle new file mode 100755 index 00000000..66e9889e --- /dev/null +++ b/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails new file mode 100755 index 00000000..0138d79b --- /dev/null +++ b/bin/rails @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby +begin + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') +end +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake new file mode 100755 index 00000000..d87d5f57 --- /dev/null +++ b/bin/rake @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby +begin + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') +end +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/bin/setup b/bin/setup new file mode 100755 index 00000000..acdb2c13 --- /dev/null +++ b/bin/setup @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'pathname' + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +Dir.chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file: + + puts "== Installing dependencies ==" + system "gem install bundler --conservative" + system "bundle check || bundle install" + + # puts "\n== Copying sample files ==" + # unless File.exist?("config/database.yml") + # system "cp config/database.yml.sample config/database.yml" + # end + + puts "\n== Preparing database ==" + system "bin/rake db:setup" + + puts "\n== Removing old logs and tempfiles ==" + system "rm -f log/*" + system "rm -rf tmp/cache" + + puts "\n== Restarting application server ==" + system "touch tmp/restart.txt" +end diff --git a/bin/spring b/bin/spring new file mode 100755 index 00000000..7fe232c3 --- /dev/null +++ b/bin/spring @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby + +# This file loads spring without using Bundler, in order to be fast. +# It gets overwritten when you run the `spring binstub` command. + +unless defined?(Spring) + require 'rubygems' + require 'bundler' + + if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)) + Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(Gem.path_separator) } + gem 'spring', match[1] + require 'spring/binstub' + end +end diff --git a/config.ru b/config.ru new file mode 100644 index 00000000..bd83b254 --- /dev/null +++ b/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Rails.application diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 00000000..c3f9fb91 --- /dev/null +++ b/config/application.rb @@ -0,0 +1,26 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module FarMarRails + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + + # Do not swallow errors in after_commit/after_rollback callbacks. + config.active_record.raise_in_transactional_callbacks = true + end +end diff --git a/config/boot.rb b/config/boot.rb new file mode 100644 index 00000000..6b750f00 --- /dev/null +++ b/config/boot.rb @@ -0,0 +1,3 @@ +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + +require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 00000000..1c1a37ca --- /dev/null +++ b/config/database.yml @@ -0,0 +1,25 @@ +# SQLite version 3.x +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem 'sqlite3' +# +default: &default + adapter: sqlite3 + pool: 5 + timeout: 5000 + +development: + <<: *default + database: db/development.sqlite3 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + <<: *default + database: db/test.sqlite3 + +production: + <<: *default + database: db/production.sqlite3 diff --git a/config/environment.rb b/config/environment.rb new file mode 100644 index 00000000..ee8d90dc --- /dev/null +++ b/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require File.expand_path('../application', __FILE__) + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb new file mode 100644 index 00000000..b55e2144 --- /dev/null +++ b/config/environments/development.rb @@ -0,0 +1,41 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise an error on page load if there are pending migrations. + config.active_record.migration_error = :page_load + + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. + config.assets.debug = true + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # Adds additional error checking when serving assets at runtime. + # Checks for improperly declared sprockets dependencies. + # Raises helpful error messages. + config.assets.raise_runtime_errors = true + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/config/environments/production.rb b/config/environments/production.rb new file mode 100644 index 00000000..5c1b32e4 --- /dev/null +++ b/config/environments/production.rb @@ -0,0 +1,79 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both threaded web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true + + # Full error reports are disabled and caching is turned on. + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Enable Rack::Cache to put a simple HTTP cache in front of your application + # Add `rack-cache` to your Gemfile before enabling this. + # For large-scale production use, consider using a caching reverse proxy like + # NGINX, varnish or squid. + # config.action_dispatch.rack_cache = true + + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? + + # Compress JavaScripts and CSS. + config.assets.js_compressor = :uglifier + # config.assets.css_compressor = :sass + + # Do not fallback to assets pipeline if a precompiled asset is missed. + config.assets.compile = false + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :debug + + # Prepend all log lines with the following tags. + # config.log_tags = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups. + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # config.action_mailer.raise_delivery_errors = false + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners. + config.active_support.deprecation = :notify + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false +end diff --git a/config/environments/test.rb b/config/environments/test.rb new file mode 100644 index 00000000..1c19f08b --- /dev/null +++ b/config/environments/test.rb @@ -0,0 +1,42 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false + + # Configure static file server for tests with Cache-Control for performance. + config.serve_static_files = true + config.static_cache_control = 'public, max-age=3600' + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Randomize the order test cases are executed. + config.active_support.test_order = :random + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb new file mode 100644 index 00000000..01ef3e66 --- /dev/null +++ b/config/initializers/assets.rb @@ -0,0 +1,11 @@ +# Be sure to restart your server when you modify this file. + +# Version of your assets, change this if you want to expire all your assets. +Rails.application.config.assets.version = '1.0' + +# Add additional assets to the asset load path +# Rails.application.config.assets.paths << Emoji.images_path + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. +# Rails.application.config.assets.precompile += %w( search.js ) diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb new file mode 100644 index 00000000..59385cdf --- /dev/null +++ b/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb new file mode 100644 index 00000000..7f70458d --- /dev/null +++ b/config/initializers/cookies_serializer.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb new file mode 100644 index 00000000..4a994e1e --- /dev/null +++ b/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb new file mode 100644 index 00000000..ac033bf9 --- /dev/null +++ b/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb new file mode 100644 index 00000000..dc189968 --- /dev/null +++ b/config/initializers/mime_types.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb new file mode 100644 index 00000000..1c93e57e --- /dev/null +++ b/config/initializers/session_store.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.session_store :cookie_store, key: '_FarMarRails_session' diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb new file mode 100644 index 00000000..33725e95 --- /dev/null +++ b/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] if respond_to?(:wrap_parameters) +end + +# To enable root element in JSON for ActiveRecord objects. +# ActiveSupport.on_load(:active_record) do +# self.include_root_in_json = true +# end diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 00000000..06539571 --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,23 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 00000000..3f66539d --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,56 @@ +Rails.application.routes.draw do + # The priority is based upon order of creation: first created -> highest priority. + # See how all your routes lay out with "rake routes". + + # You can have the root of your site routed with "root" + # root 'welcome#index' + + # Example of regular route: + # get 'products/:id' => 'catalog#view' + + # Example of named route that can be invoked with purchase_url(id: product.id) + # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase + + # Example resource route (maps HTTP verbs to controller actions automatically): + # resources :products + + # Example resource route with options: + # resources :products do + # member do + # get 'short' + # post 'toggle' + # end + # + # collection do + # get 'sold' + # end + # end + + # Example resource route with sub-resources: + # resources :products do + # resources :comments, :sales + # resource :seller + # end + + # Example resource route with more complex sub-resources: + # resources :products do + # resources :comments + # resources :sales do + # get 'recent', on: :collection + # end + # end + + # Example resource route with concerns: + # concern :toggleable do + # post 'toggle' + # end + # resources :posts, concerns: :toggleable + # resources :photos, concerns: :toggleable + + # Example resource route within a namespace: + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products + # end +end diff --git a/config/secrets.yml b/config/secrets.yml new file mode 100644 index 00000000..777b755b --- /dev/null +++ b/config/secrets.yml @@ -0,0 +1,22 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rake secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +development: + secret_key_base: 71cd0110123b07466530abb2ca90129ee20699d14de7e41b7636984fcca223fea6c3d63f79e6591a994bf971590f3de3bab392ac172fd222fc02819a7097ed69 + +test: + secret_key_base: 95110a6e77fc6970682b33e79a5a9b40f35ab1188d5c13c998718e8c7df73ea777255ad5de5ba2a6e8f97626d7290e9a064b0e90bff9da6da94e7f226dae93db + +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/db/migrate/20160426222652_create_markets.rb b/db/migrate/20160426222652_create_markets.rb new file mode 100644 index 00000000..873fa5f6 --- /dev/null +++ b/db/migrate/20160426222652_create_markets.rb @@ -0,0 +1,15 @@ +class CreateMarkets < ActiveRecord::Migration + def change + create_table :markets do |t| + t.integer :market_id + t.string :market_name + t.string :address + t.string :city + t.string :county + t.string :state + t.integer :zip + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20160426222717_create_sales.rb b/db/migrate/20160426222717_create_sales.rb new file mode 100644 index 00000000..fa4cbdc6 --- /dev/null +++ b/db/migrate/20160426222717_create_sales.rb @@ -0,0 +1,13 @@ +class CreateSales < ActiveRecord::Migration + def change + create_table :sales do |t| + t.integer :sale_id + t.integer :amount + t.datetime :purchase_time + t.integer :vendor_id + t.integer :product_id + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20160426222723_create_vendors.rb b/db/migrate/20160426222723_create_vendors.rb new file mode 100644 index 00000000..0c9cf524 --- /dev/null +++ b/db/migrate/20160426222723_create_vendors.rb @@ -0,0 +1,12 @@ +class CreateVendors < ActiveRecord::Migration + def change + create_table :vendors do |t| + t.integer :vendor_id + t.string :vendor_name + t.integer :num_of_employees + t.integer :market_id + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20160426222728_create_products.rb b/db/migrate/20160426222728_create_products.rb new file mode 100644 index 00000000..c26b394a --- /dev/null +++ b/db/migrate/20160426222728_create_products.rb @@ -0,0 +1,11 @@ +class CreateProducts < ActiveRecord::Migration + def change + create_table :products do |t| + t.integer :product_id + t.string :product_name + t.integer :vendor_id + + t.timestamps null: false + end + end +end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 00000000..4edb1e85 --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,7 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) +# Mayor.create(name: 'Emanuel', city: cities.first) diff --git a/lib/assets/.keep b/lib/assets/.keep new file mode 100644 index 00000000..e69de29b diff --git a/lib/tasks/.keep b/lib/tasks/.keep new file mode 100644 index 00000000..e69de29b diff --git a/log/.keep b/log/.keep new file mode 100644 index 00000000..e69de29b diff --git a/public/404.html b/public/404.html new file mode 100644 index 00000000..b612547f --- /dev/null +++ b/public/404.html @@ -0,0 +1,67 @@ + + + + The page you were looking for doesn't exist (404) + + + + + + +
+
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/public/422.html b/public/422.html new file mode 100644 index 00000000..a21f82b3 --- /dev/null +++ b/public/422.html @@ -0,0 +1,67 @@ + + + + The change you wanted was rejected (422) + + + + + + +
+
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/public/500.html b/public/500.html new file mode 100644 index 00000000..061abc58 --- /dev/null +++ b/public/500.html @@ -0,0 +1,66 @@ + + + + We're sorry, but something went wrong (500) + + + + + + +
+
+

We're sorry, but something went wrong.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 00000000..e69de29b diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 00000000..3c9c7c01 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,5 @@ +# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +# User-agent: * +# Disallow: / diff --git a/test/controllers/.keep b/test/controllers/.keep new file mode 100644 index 00000000..e69de29b diff --git a/test/controllers/markets_controller_test.rb b/test/controllers/markets_controller_test.rb new file mode 100644 index 00000000..f43ed535 --- /dev/null +++ b/test/controllers/markets_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class MarketsControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/products_controller_test.rb b/test/controllers/products_controller_test.rb new file mode 100644 index 00000000..c881fa68 --- /dev/null +++ b/test/controllers/products_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ProductsControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/sales_controller_test.rb b/test/controllers/sales_controller_test.rb new file mode 100644 index 00000000..669ca5cf --- /dev/null +++ b/test/controllers/sales_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SalesControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/vendors_controller_test.rb b/test/controllers/vendors_controller_test.rb new file mode 100644 index 00000000..2a6edb24 --- /dev/null +++ b/test/controllers/vendors_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class VendorsControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/fixtures/.keep b/test/fixtures/.keep new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/markets.yml b/test/fixtures/markets.yml new file mode 100644 index 00000000..937a0c00 --- /dev/null +++ b/test/fixtures/markets.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/products.yml b/test/fixtures/products.yml new file mode 100644 index 00000000..937a0c00 --- /dev/null +++ b/test/fixtures/products.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/sales.yml b/test/fixtures/sales.yml new file mode 100644 index 00000000..937a0c00 --- /dev/null +++ b/test/fixtures/sales.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/vendors.yml b/test/fixtures/vendors.yml new file mode 100644 index 00000000..937a0c00 --- /dev/null +++ b/test/fixtures/vendors.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/helpers/.keep b/test/helpers/.keep new file mode 100644 index 00000000..e69de29b diff --git a/test/integration/.keep b/test/integration/.keep new file mode 100644 index 00000000..e69de29b diff --git a/test/mailers/.keep b/test/mailers/.keep new file mode 100644 index 00000000..e69de29b diff --git a/test/models/.keep b/test/models/.keep new file mode 100644 index 00000000..e69de29b 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 diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 00000000..92e39b2d --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,10 @@ +ENV['RAILS_ENV'] ||= 'test' +require File.expand_path('../../config/environment', __FILE__) +require 'rails/test_help' + +class ActiveSupport::TestCase + # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. + fixtures :all + + # Add more helper methods to be used by all tests here... +end diff --git a/vendor/assets/javascripts/.keep b/vendor/assets/javascripts/.keep new file mode 100644 index 00000000..e69de29b diff --git a/vendor/assets/stylesheets/.keep b/vendor/assets/stylesheets/.keep new file mode 100644 index 00000000..e69de29b From 7b326911328d2857c5cfd689eb3569c4823c668f Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Tue, 26 Apr 2016 16:40:05 -0700 Subject: [PATCH 08/53] Set up seed file and schema. Have not yet seeded. --- db/migrate/20160426222652_create_markets.rb | 8 +-- db/migrate/20160426222717_create_sales.rb | 6 +-- db/migrate/20160426222723_create_vendors.rb | 6 +-- db/migrate/20160426222728_create_products.rb | 4 +- db/schema.rb | 55 ++++++++++++++++++++ db/seeds.rb | 26 +++++++++ seed_csvs/markets.csv | 1 + seed_csvs/products.csv | 1 + seed_csvs/sales.csv | 1 + seed_csvs/vendors.csv | 1 + 10 files changed, 97 insertions(+), 12 deletions(-) create mode 100644 db/schema.rb diff --git a/db/migrate/20160426222652_create_markets.rb b/db/migrate/20160426222652_create_markets.rb index 873fa5f6..dc21a395 100644 --- a/db/migrate/20160426222652_create_markets.rb +++ b/db/migrate/20160426222652_create_markets.rb @@ -2,11 +2,11 @@ class CreateMarkets < ActiveRecord::Migration def change create_table :markets do |t| t.integer :market_id - t.string :market_name - t.string :address - t.string :city + t.string :market_name, null: false + t.string :address, null: false + t.string :city, null: false t.string :county - t.string :state + t.string :state, null: false t.integer :zip t.timestamps null: false diff --git a/db/migrate/20160426222717_create_sales.rb b/db/migrate/20160426222717_create_sales.rb index fa4cbdc6..a0897dc3 100644 --- a/db/migrate/20160426222717_create_sales.rb +++ b/db/migrate/20160426222717_create_sales.rb @@ -2,10 +2,10 @@ class CreateSales < ActiveRecord::Migration def change create_table :sales do |t| t.integer :sale_id - t.integer :amount + t.integer :amount, null: false t.datetime :purchase_time - t.integer :vendor_id - t.integer :product_id + t.integer :vendor_id, null: false + t.integer :product_id, null: false t.timestamps null: false end diff --git a/db/migrate/20160426222723_create_vendors.rb b/db/migrate/20160426222723_create_vendors.rb index 0c9cf524..d689200a 100644 --- a/db/migrate/20160426222723_create_vendors.rb +++ b/db/migrate/20160426222723_create_vendors.rb @@ -2,9 +2,9 @@ class CreateVendors < ActiveRecord::Migration def change create_table :vendors do |t| t.integer :vendor_id - t.string :vendor_name - t.integer :num_of_employees - t.integer :market_id + t.string :vendor_name, null: false + t.integer :num_of_employees, null: false + t.integer :market_id, null: false t.timestamps null: false end diff --git a/db/migrate/20160426222728_create_products.rb b/db/migrate/20160426222728_create_products.rb index c26b394a..03a901e1 100644 --- a/db/migrate/20160426222728_create_products.rb +++ b/db/migrate/20160426222728_create_products.rb @@ -2,8 +2,8 @@ class CreateProducts < ActiveRecord::Migration def change create_table :products do |t| t.integer :product_id - t.string :product_name - t.integer :vendor_id + t.string :product_name, null: false + t.integer :vendor_id, null: false t.timestamps null: false end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 00000000..479ab06c --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,55 @@ +# 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: 20160426222728) do + + create_table "markets", force: :cascade do |t| + t.integer "market_id" + t.string "market_name", null: false + t.string "address", null: false + t.string "city", null: false + t.string "county" + t.string "state", null: false + t.integer "zip" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "products", force: :cascade do |t| + t.integer "product_id" + t.string "product_name", null: false + t.integer "vendor_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "sales", force: :cascade do |t| + t.integer "sale_id" + t.integer "amount", null: false + t.datetime "purchase_time" + t.integer "vendor_id", null: false + t.integer "product_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "vendors", force: :cascade do |t| + t.integer "vendor_id" + t.string "vendor_name", null: false + t.integer "num_of_employees", null: false + t.integer "market_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + +end diff --git a/db/seeds.rb b/db/seeds.rb index 4edb1e85..f359f522 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -5,3 +5,29 @@ # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel', city: cities.first) + +require 'csv' +MARKET = "seed_csvs/markets.csv" +VENDOR = "seed_csvs/vendors.csv" +PRODUCT = "seed_csvs/products.csv" +SALE = "seed_csvs/sales.csv" + +CSV.foreach(MARKET, headers: true) do |row| + row_hash = row.to_h + Market.create(row_hash) +end + +CSV.foreach(VENDOR, headers: true) do |row| + row_hash = row.to_h + Vendor.create(row_hash) +end + +CSV.foreach(PRODUCT, headers: true) do |row| + row_hash = row.to_h + Product.create(row_hash) +end + +CSV.foreach(SALE, headers: true) do |row| + row_hash = row.to_h + Sale.create(row_hash) +end diff --git a/seed_csvs/markets.csv b/seed_csvs/markets.csv index 9860f59f..ce023cd0 100644 --- a/seed_csvs/markets.csv +++ b/seed_csvs/markets.csv @@ -1,3 +1,4 @@ +market_id, market_name, address, city, county, state, zip 1,"People's Co-op Farmers Market","30th and Burnside",Portland,Multnomah,Oregon,97202 2,"Silverdale Farmers Market",98383,Silverdale,Kitsap,Washington,98383 3,"Dolgeville Farmer's Market","(Parking Lot) Between Main St. and Helmer Ave",Dolgeville,Herkimer,"New York",13329 diff --git a/seed_csvs/products.csv b/seed_csvs/products.csv index ac508548..e7be2c39 100644 --- a/seed_csvs/products.csv +++ b/seed_csvs/products.csv @@ -1,3 +1,4 @@ +product_id, product_name, vendor_id 1,"Dry Beets",1 2,"Fierce Greens",2 3,"Heavy Chicken",2 diff --git a/seed_csvs/sales.csv b/seed_csvs/sales.csv index 67cfa4be..5ac04b9e 100644 --- a/seed_csvs/sales.csv +++ b/seed_csvs/sales.csv @@ -1,3 +1,4 @@ +sale_id, amount, purchase_time, vendor_id, product_id 1,9290,"2013-11-07 12:34:56.000000",1,1 2,2262,"2013-11-10 10:44:56.000000",1,1 3,9588,"2013-11-13 09:49:37.000000",1,1 diff --git a/seed_csvs/vendors.csv b/seed_csvs/vendors.csv index a2bec328..2358893a 100644 --- a/seed_csvs/vendors.csv +++ b/seed_csvs/vendors.csv @@ -1,3 +1,4 @@ +vendor_id, vendor_name, num_of_employees, market_id 1,Feil-Farrell,8,1 2,"Hamill, Kilback and Pfeffer",5,1 3,"Breitenberg Inc",5,1 From be4dd36e95be57a2972f8a9db899359c1b52cc41 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Tue, 26 Apr 2016 16:43:18 -0700 Subject: [PATCH 09/53] SEEDED. USING GIT RELENTLESSLY. --- seed_csvs/markets.csv | 2 +- seed_csvs/products.csv | 2 +- seed_csvs/sales.csv | 2 +- seed_csvs/vendors.csv | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/seed_csvs/markets.csv b/seed_csvs/markets.csv index ce023cd0..0f1d0b8d 100644 --- a/seed_csvs/markets.csv +++ b/seed_csvs/markets.csv @@ -1,4 +1,4 @@ -market_id, market_name, address, city, county, state, zip +market_id,market_name,address,city,county,state,zip 1,"People's Co-op Farmers Market","30th and Burnside",Portland,Multnomah,Oregon,97202 2,"Silverdale Farmers Market",98383,Silverdale,Kitsap,Washington,98383 3,"Dolgeville Farmer's Market","(Parking Lot) Between Main St. and Helmer Ave",Dolgeville,Herkimer,"New York",13329 diff --git a/seed_csvs/products.csv b/seed_csvs/products.csv index e7be2c39..e95c6494 100644 --- a/seed_csvs/products.csv +++ b/seed_csvs/products.csv @@ -1,4 +1,4 @@ -product_id, product_name, vendor_id +product_id,product_name,vendor_id 1,"Dry Beets",1 2,"Fierce Greens",2 3,"Heavy Chicken",2 diff --git a/seed_csvs/sales.csv b/seed_csvs/sales.csv index 5ac04b9e..e3959ebf 100644 --- a/seed_csvs/sales.csv +++ b/seed_csvs/sales.csv @@ -1,4 +1,4 @@ -sale_id, amount, purchase_time, vendor_id, product_id +sale_id,amount,purchase_time,vendor_id,product_id 1,9290,"2013-11-07 12:34:56.000000",1,1 2,2262,"2013-11-10 10:44:56.000000",1,1 3,9588,"2013-11-13 09:49:37.000000",1,1 diff --git a/seed_csvs/vendors.csv b/seed_csvs/vendors.csv index 2358893a..14c56b5d 100644 --- a/seed_csvs/vendors.csv +++ b/seed_csvs/vendors.csv @@ -1,4 +1,4 @@ -vendor_id, vendor_name, num_of_employees, market_id +vendor_id,vendor_name,num_of_employees,market_id 1,Feil-Farrell,8,1 2,"Hamill, Kilback and Pfeffer",5,1 3,"Breitenberg Inc",5,1 From b45915e517d6006bfdd72d5f551117bf3a2c3769 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Tue, 26 Apr 2016 16:54:03 -0700 Subject: [PATCH 10/53] All classes are now facebook official, and have defined relationships. --- app/models/market.rb | 1 + app/models/product.rb | 1 + app/models/sale.rb | 2 ++ app/models/vendor.rb | 2 ++ 4 files changed, 6 insertions(+) diff --git a/app/models/market.rb b/app/models/market.rb index 1a4a52dd..6a148291 100644 --- a/app/models/market.rb +++ b/app/models/market.rb @@ -1,2 +1,3 @@ class Market < ActiveRecord::Base + has_many :vendors end diff --git a/app/models/product.rb b/app/models/product.rb index 077a8197..106023d1 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -1,2 +1,3 @@ class Product < ActiveRecord::Base + belongs_to :vendor end diff --git a/app/models/sale.rb b/app/models/sale.rb index 870f2c20..7142a28c 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -1,2 +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 index dac23f0a..656fc636 100644 --- a/app/models/vendor.rb +++ b/app/models/vendor.rb @@ -1,2 +1,4 @@ class Vendor < ActiveRecord::Base + has_many :products + belongs_to :market end From 849e49dd6ca0cca9de9caf57b3180bc5031e6ecc Mon Sep 17 00:00:00 2001 From: Cristal Tay Date: Wed, 27 Apr 2016 09:35:43 -0700 Subject: [PATCH 11/53] branch to create home routes and new homes controller. --- app/assets/javascripts/homes.coffee | 3 +++ app/assets/stylesheets/homes.scss | 3 +++ app/controllers/homes_controller.rb | 9 +++++++++ app/controllers/markets_controller.rb | 3 +++ app/helpers/homes_helper.rb | 2 ++ config/routes.rb | 6 +++++- test/controllers/homes_controller_test.rb | 7 +++++++ 7 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 app/assets/javascripts/homes.coffee create mode 100644 app/assets/stylesheets/homes.scss create mode 100644 app/controllers/homes_controller.rb create mode 100644 app/helpers/homes_helper.rb create mode 100644 test/controllers/homes_controller_test.rb diff --git a/app/assets/javascripts/homes.coffee b/app/assets/javascripts/homes.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/homes.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/homes.scss b/app/assets/stylesheets/homes.scss new file mode 100644 index 00000000..06b5a471 --- /dev/null +++ b/app/assets/stylesheets/homes.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Homes 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/homes_controller.rb b/app/controllers/homes_controller.rb new file mode 100644 index 00000000..a35d2065 --- /dev/null +++ b/app/controllers/homes_controller.rb @@ -0,0 +1,9 @@ +class HomesController < ApplicationController + def index + @markets = Market.order(market_name: :asc) + end + + def show + + end +end diff --git a/app/controllers/markets_controller.rb b/app/controllers/markets_controller.rb index fa158671..d0252e7b 100644 --- a/app/controllers/markets_controller.rb +++ b/app/controllers/markets_controller.rb @@ -1,2 +1,5 @@ class MarketsController < ApplicationController + def index + end + end diff --git a/app/helpers/homes_helper.rb b/app/helpers/homes_helper.rb new file mode 100644 index 00000000..2a8ce49d --- /dev/null +++ b/app/helpers/homes_helper.rb @@ -0,0 +1,2 @@ +module HomesHelper +end diff --git a/config/routes.rb b/config/routes.rb index 3f66539d..0792ab3b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,8 +2,12 @@ # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". + # only generate the specified routes + resources :markets + + # You can have the root of your site routed with "root" - # root 'welcome#index' + root 'home#index' # Example of regular route: # get 'products/:id' => 'catalog#view' diff --git a/test/controllers/homes_controller_test.rb b/test/controllers/homes_controller_test.rb new file mode 100644 index 00000000..1c666f23 --- /dev/null +++ b/test/controllers/homes_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class HomesControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end From d2f19d1a9b4ce1bd08ec39185ec7c0acacda7c3b Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Wed, 27 Apr 2016 09:35:44 -0700 Subject: [PATCH 12/53] Started work on Vendors controller methods. --- app/controllers/vendors_controller.rb | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/app/controllers/vendors_controller.rb b/app/controllers/vendors_controller.rb index f14c7ec9..8444cb7d 100644 --- a/app/controllers/vendors_controller.rb +++ b/app/controllers/vendors_controller.rb @@ -1,2 +1,32 @@ class VendorsController < ApplicationController + + def index + @vendors = Vendor.find.all + render :index + end + + def show + @vendors_listed = Vendor.find.(params[:id]) + render :index + end + + def new + @new_vendor = Vendor.new + end + + def create + + end + + def edit + + end + + def update + + end + + def destroy + + end end From 53faa985d8c21ffc61d6a8e13bdf81d5254be7ab Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Wed, 27 Apr 2016 09:40:22 -0700 Subject: [PATCH 13/53] More git playing. --- app/controllers/vendors_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/vendors_controller.rb b/app/controllers/vendors_controller.rb index 8444cb7d..44764e10 100644 --- a/app/controllers/vendors_controller.rb +++ b/app/controllers/vendors_controller.rb @@ -12,6 +12,7 @@ def show def new @new_vendor = Vendor.new + #this is a small change, because git is weird and we are trying a thing. end def create From 0cbfb03779c66107d670c89ddb745b5feaa802dd Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Wed, 27 Apr 2016 09:42:29 -0700 Subject: [PATCH 14/53] Making a view for Cristal, git is weird. --- app/views/markets/index.html.erb | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 app/views/markets/index.html.erb diff --git a/app/views/markets/index.html.erb b/app/views/markets/index.html.erb new file mode 100644 index 00000000..e69de29b From 95e56041e53c3ed53cda9153130010b6ad65e586 Mon Sep 17 00:00:00 2001 From: Cristal Tay Date: Wed, 27 Apr 2016 09:43:17 -0700 Subject: [PATCH 15/53] added homes --- app/views/homes/index.html.erb | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 app/views/homes/index.html.erb diff --git a/app/views/homes/index.html.erb b/app/views/homes/index.html.erb new file mode 100644 index 00000000..e69de29b From 905be5d7f998519c7aaecb42cedb7d71d5cac3d8 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Wed, 27 Apr 2016 09:43:37 -0700 Subject: [PATCH 16/53] Added more views for Cristal. --- app/views/products/index.html.erb | 0 app/views/sales/index.html.erb | 0 app/views/vendors/index.html.erb | 0 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 app/views/products/index.html.erb create mode 100644 app/views/sales/index.html.erb create mode 100644 app/views/vendors/index.html.erb diff --git a/app/views/products/index.html.erb b/app/views/products/index.html.erb new file mode 100644 index 00000000..e69de29b diff --git a/app/views/sales/index.html.erb b/app/views/sales/index.html.erb new file mode 100644 index 00000000..e69de29b diff --git a/app/views/vendors/index.html.erb b/app/views/vendors/index.html.erb new file mode 100644 index 00000000..e69de29b From 9eeeab287c2b423dd253f1cabec177d47dbb6105 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Wed, 27 Apr 2016 09:56:05 -0700 Subject: [PATCH 17/53] Finished (maybe? hahaha) vendor controller methods. --- app/controllers/vendors_controller.rb | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/app/controllers/vendors_controller.rb b/app/controllers/vendors_controller.rb index 44764e10..264f5cb7 100644 --- a/app/controllers/vendors_controller.rb +++ b/app/controllers/vendors_controller.rb @@ -12,22 +12,40 @@ def show def new @new_vendor = Vendor.new - #this is a small change, because git is weird and we are trying a thing. + render :new end def create - + @new_vendor = Vendor.new(new_vendor_create_params[:vendor]) + if @new_vendor.save + redirect_to root_path + else + render :new + end end def edit - + @vendor = Vendor.find(params[:id]) + render :edit end def update - + @vendor = Vendor.find(params[:id]) + if @vendor.update(new_vendor_create_params[:vendor]) + redirect_to root_path + else + render :edit + end end def destroy + @vendor = Vendor.destroy(params[:id]) + redirect_to root_path + end + + private + def new_vendor_create_params + params.permit(vendor: [:vendor_id, :vendor_name, :num_of_employees, :market_id]) #you must permit parameters when you want to allow access to the user to create new data using the params. The user is ONLY permitted to access the artist and title parameters. end end From 7f57f66e0f36cdeca32ddd4e4effa5a58d2688f8 Mon Sep 17 00:00:00 2001 From: Cristal Tay Date: Wed, 27 Apr 2016 10:00:19 -0700 Subject: [PATCH 18/53] added some css to the home page. can view all markets with links --- app/assets/stylesheets/application.css | 53 ++++++++++++++++++++++++++ app/controllers/homes_controller.rb | 6 +-- app/views/homes/index.html.erb | 9 +++++ app/views/layouts/application.html.erb | 15 +++++++- config/routes.rb | 4 +- 5 files changed, 82 insertions(+), 5 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index f9cd5b34..1f1b417c 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -13,3 +13,56 @@ *= require_tree . *= require_self */ + + +/*html { + background-color: red; + }*/ + +a{ + /*color: rgb(0, 224, 224);*/ +} + +h1{ + /*background-color: green;*/ + text-align: center; + font-size: 3vw; + /*color: white;*/ +} + +ul li{ + list-style: none; +} + +ul li a { + text-decoration: none; +} + +form { + display: inline; +} + +.homeheader { + /*font-family: "Arial Black", Gadget, sans-serif; + font-size: 0.1vw;*/ + /*background-color: rgba(255, 255, 255, 0.4);*/ + width: 100%; + /*border: solid white;*/ + height: 15%; +} +header nav ul{ + text-align: center; + +} +header nav ul li{ + display: inline; +} + +header nav ul li a{ + padding-left: 7px; + padding-right: 7px; +} + +/*h2{ + color:green; +}*/ diff --git a/app/controllers/homes_controller.rb b/app/controllers/homes_controller.rb index a35d2065..aaa54a76 100644 --- a/app/controllers/homes_controller.rb +++ b/app/controllers/homes_controller.rb @@ -3,7 +3,7 @@ def index @markets = Market.order(market_name: :asc) end - def show - - end + # def show + # @market = Mar + # end end diff --git a/app/views/homes/index.html.erb b/app/views/homes/index.html.erb index e69de29b..a23afea1 100644 --- a/app/views/homes/index.html.erb +++ b/app/views/homes/index.html.erb @@ -0,0 +1,9 @@ +
    + <% @markets.each do |market| %> +
  • + <%= link_to market.market_name, "/market/#{market.id}"%> + + +
  • + <% end %> +
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 443f3152..1a94b7a4 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -7,7 +7,20 @@ <%= csrf_meta_tags %> - +
+

FarMar

+ +
<%= yield %> diff --git a/config/routes.rb b/config/routes.rb index 0792ab3b..201f383b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,10 +4,12 @@ # only generate the specified routes resources :markets + resources :vendors + resources :products # You can have the root of your site routed with "root" - root 'home#index' + root 'homes#index' # Example of regular route: # get 'products/:id' => 'catalog#view' From 374a012d40a6a52badf9a08a1273c18f1a2670b2 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Wed, 27 Apr 2016 10:01:18 -0700 Subject: [PATCH 19/53] Added vendors routes. --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 0792ab3b..43246a3d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,7 +4,7 @@ # only generate the specified routes resources :markets - + resources :vendors # You can have the root of your site routed with "root" root 'home#index' From 8bff91df590ebf415bfde595a91d960b6c968e2c Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Wed, 27 Apr 2016 10:02:21 -0700 Subject: [PATCH 20/53] Small vendors controller change. --- app/controllers/vendors_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/vendors_controller.rb b/app/controllers/vendors_controller.rb index 264f5cb7..88d39bac 100644 --- a/app/controllers/vendors_controller.rb +++ b/app/controllers/vendors_controller.rb @@ -1,7 +1,7 @@ class VendorsController < ApplicationController def index - @vendors = Vendor.find.all + @vendors = Vendor.all render :index end From 82430b383d04ef7e6162ace40dcef5a5898f0acc Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Wed, 27 Apr 2016 14:38:40 -0700 Subject: [PATCH 21/53] Fixes to vendor controller, views for vendor index and single view of vendor are now completed. --- app/views/vendors/index.html.erb | 5 +++++ app/views/vendors/single_vendor_view.html.erb | 15 +++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 app/views/vendors/single_vendor_view.html.erb diff --git a/app/views/vendors/index.html.erb b/app/views/vendors/index.html.erb index e69de29b..7ff70902 100644 --- a/app/views/vendors/index.html.erb +++ b/app/views/vendors/index.html.erb @@ -0,0 +1,5 @@ +
    + <% @vendors.each do |vendor| %> +
  • <%= link_to vendor.vendor_name, vendor_path(vendor.id) %>
  • + <% end %> +
diff --git a/app/views/vendors/single_vendor_view.html.erb b/app/views/vendors/single_vendor_view.html.erb new file mode 100644 index 00000000..f06ebc11 --- /dev/null +++ b/app/views/vendors/single_vendor_view.html.erb @@ -0,0 +1,15 @@ + + + + + + + + + + <% @vendors.each do |vendor| %> + + + + <% end %> + From 37ea28478be8afcf1dd4e3b84a1e004738589979 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Wed, 27 Apr 2016 14:50:30 -0700 Subject: [PATCH 22/53] I guess I didn't catch all the changes I made in the last commit. --- app/controllers/vendors_controller.rb | 6 +++--- config/routes.rb | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/controllers/vendors_controller.rb b/app/controllers/vendors_controller.rb index 88d39bac..fb46761b 100644 --- a/app/controllers/vendors_controller.rb +++ b/app/controllers/vendors_controller.rb @@ -1,13 +1,13 @@ class VendorsController < ApplicationController def index - @vendors = Vendor.all + @vendors = Vendor.order(vendor_name: :asc) render :index end def show - @vendors_listed = Vendor.find.(params[:id]) - render :index + @vendors = Vendor.where(id: params[:id]) + render :single_vendor_view end def new diff --git a/config/routes.rb b/config/routes.rb index 8927951c..201f383b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,11 +5,8 @@ # only generate the specified routes resources :markets resources :vendors -<<<<<<< HEAD -======= resources :products ->>>>>>> 136c2acbdfc4d187cb62cd80850963e4bbec7f7d # You can have the root of your site routed with "root" root 'homes#index' From 489daa4c5890661c3a909d02bdd843315ca6f421 Mon Sep 17 00:00:00 2001 From: Cristal Tay Date: Wed, 27 Apr 2016 15:04:14 -0700 Subject: [PATCH 23/53] finished linking for user views --- app/controllers/homes_controller.rb | 7 ++++--- app/controllers/markets_controller.rb | 6 ++++++ app/controllers/vendors_controller.rb | 2 +- app/views/homes/_taskform.html.erb | 7 +++++++ app/views/homes/index.html.erb | 10 +--------- app/views/homes/show.html.erb | 19 +++++++++++++++++++ app/views/markets/show.html.erb | 19 +++++++++++++++++++ config/routes.rb | 6 ++---- 8 files changed, 59 insertions(+), 17 deletions(-) create mode 100644 app/views/homes/_taskform.html.erb create mode 100644 app/views/homes/show.html.erb create mode 100644 app/views/markets/show.html.erb diff --git a/app/controllers/homes_controller.rb b/app/controllers/homes_controller.rb index aaa54a76..11c7d6df 100644 --- a/app/controllers/homes_controller.rb +++ b/app/controllers/homes_controller.rb @@ -3,7 +3,8 @@ def index @markets = Market.order(market_name: :asc) end - # def show - # @market = Mar - # end + def show + @market = Market.find(params[:id]) + @vendors = Vendor.where(market_id: params[:id]) + end end diff --git a/app/controllers/markets_controller.rb b/app/controllers/markets_controller.rb index d0252e7b..b6d3845b 100644 --- a/app/controllers/markets_controller.rb +++ b/app/controllers/markets_controller.rb @@ -1,5 +1,11 @@ class MarketsController < ApplicationController def index + @markets = Market.order(market_name: :asc) + end + + def show + @market = Market.find(params[:id]) + @vendors = Vendor.where(market_id: params[:id]) end end diff --git a/app/controllers/vendors_controller.rb b/app/controllers/vendors_controller.rb index 88d39bac..5c511ecc 100644 --- a/app/controllers/vendors_controller.rb +++ b/app/controllers/vendors_controller.rb @@ -6,7 +6,7 @@ def index end def show - @vendors_listed = Vendor.find.(params[:id]) + @vendors_listed = Vendor.find(params[:id]) render :index end diff --git a/app/views/homes/_taskform.html.erb b/app/views/homes/_taskform.html.erb new file mode 100644 index 00000000..aea876bf --- /dev/null +++ b/app/views/homes/_taskform.html.erb @@ -0,0 +1,7 @@ +
    + <% @markets.each do |market| %> +
  • + <%= link_to market.market_name, market_path(market.id)%> +
  • + <% end %> +
diff --git a/app/views/homes/index.html.erb b/app/views/homes/index.html.erb index a23afea1..d376c19e 100644 --- a/app/views/homes/index.html.erb +++ b/app/views/homes/index.html.erb @@ -1,9 +1 @@ -
    - <% @markets.each do |market| %> -
  • - <%= link_to market.market_name, "/market/#{market.id}"%> - - -
  • - <% end %> -
+<%= render 'taskform' %> diff --git a/app/views/homes/show.html.erb b/app/views/homes/show.html.erb new file mode 100644 index 00000000..9e2e62d4 --- /dev/null +++ b/app/views/homes/show.html.erb @@ -0,0 +1,19 @@ +

<%= @market.market_name %>

+
    +
  • <%= "Address"%>
  • +
  • <%="#{ @market.address}," %> + <%="#{@market.city},"%> + <%=" #{@market.state}," unless @market.state.nil?%><%=" #{@market.zip}" unless @market.zip.nil?%>
  • + +
  • <%= "County"%>
  • +
  • <%="#{@market.county}" unless @market.county.nil?%>
  • +
+ +

Market Vendors

+
    + <% @vendors.each do |vendor| %> +
  • + <%= link_to vendor.vendor_name, vendor_path(vendor.id)%> +
  • + <% end %> +
diff --git a/app/views/markets/show.html.erb b/app/views/markets/show.html.erb new file mode 100644 index 00000000..9e2e62d4 --- /dev/null +++ b/app/views/markets/show.html.erb @@ -0,0 +1,19 @@ +

<%= @market.market_name %>

+
    +
  • <%= "Address"%>
  • +
  • <%="#{ @market.address}," %> + <%="#{@market.city},"%> + <%=" #{@market.state}," unless @market.state.nil?%><%=" #{@market.zip}" unless @market.zip.nil?%>
  • + +
  • <%= "County"%>
  • +
  • <%="#{@market.county}" unless @market.county.nil?%>
  • +
+ +

Market Vendors

+
    + <% @vendors.each do |vendor| %> +
  • + <%= link_to vendor.vendor_name, vendor_path(vendor.id)%> +
  • + <% end %> +
diff --git a/config/routes.rb b/config/routes.rb index 8927951c..9968fd90 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,17 +5,15 @@ # only generate the specified routes resources :markets resources :vendors -<<<<<<< HEAD -======= resources :products - ->>>>>>> 136c2acbdfc4d187cb62cd80850963e4bbec7f7d + resources :homes # You can have the root of your site routed with "root" root 'homes#index' # Example of regular route: # get 'products/:id' => 'catalog#view' + # get 'homes/:id/market' => 'homes#show', as: 'hmarket' # Example of named route that can be invoked with purchase_url(id: product.id) # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase From 9dae98e4026b7f70b705dc1d12b65b1b855e588a Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Wed, 27 Apr 2016 15:07:58 -0700 Subject: [PATCH 24/53] Added link_to all products for each vendor in the single vendor view. Will eventually add create, edit, delete, and add sale functionality. --- app/controllers/products_controller.rb | 44 +++++++++++++++++++ app/views/products/index.html.erb | 5 +++ app/views/vendors/single_vendor_view.html.erb | 2 + 3 files changed, 51 insertions(+) diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb index f1ad12dd..5687c37c 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/products_controller.rb @@ -1,2 +1,46 @@ class ProductsController < ApplicationController + + def show + @products = Product.where(vendor_id: params[:id]) + render :index + end + + def new + @new_vendor = Vendor.new + render :new + end + + def create + @new_vendor = Vendor.new(new_vendor_create_params[:vendor]) + if @new_vendor.save + redirect_to root_path + else + render :new + end + end + + def edit + @vendor = Vendor.find(params[:id]) + render :edit + end + + def update + @vendor = Vendor.find(params[:id]) + if @vendor.update(new_vendor_create_params[:vendor]) + redirect_to root_path + else + render :edit + end + end + + def destroy + @vendor = Vendor.destroy(params[:id]) + redirect_to root_path + end + + private + + def new_vendor_create_params + params.permit(vendor: [:vendor_id, :vendor_name, :num_of_employees, :market_id]) #you must permit parameters when you want to allow access to the user to create new data using the params. The user is ONLY permitted to access the artist and title parameters. + end end diff --git a/app/views/products/index.html.erb b/app/views/products/index.html.erb index e69de29b..7f624e9d 100644 --- a/app/views/products/index.html.erb +++ b/app/views/products/index.html.erb @@ -0,0 +1,5 @@ +
    + <% @products.each do |product| %> +
  • <%= product.product_name %>
  • + <% end %> +
diff --git a/app/views/vendors/single_vendor_view.html.erb b/app/views/vendors/single_vendor_view.html.erb index f06ebc11..2e4f17b7 100644 --- a/app/views/vendors/single_vendor_view.html.erb +++ b/app/views/vendors/single_vendor_view.html.erb @@ -4,6 +4,7 @@
+ @@ -11,5 +12,6 @@ + <% end %> From eddd5b24c0ec25aa58dc3374af14c63978aadcff Mon Sep 17 00:00:00 2001 From: Cristal Tay Date: Wed, 27 Apr 2016 15:27:10 -0700 Subject: [PATCH 25/53] deleted the home controller and changed our root path to go to Market since they both display the same thing --- app/controllers/homes_controller.rb | 10 ---------- app/views/homes/_taskform.html.erb | 7 ------- app/views/homes/index.html.erb | 8 +++++++- app/views/homes/show.html.erb | 19 ------------------- app/views/markets/index.html.erb | 7 +++++++ config/routes.rb | 3 +-- 6 files changed, 15 insertions(+), 39 deletions(-) delete mode 100644 app/controllers/homes_controller.rb delete mode 100644 app/views/homes/_taskform.html.erb delete mode 100644 app/views/homes/show.html.erb diff --git a/app/controllers/homes_controller.rb b/app/controllers/homes_controller.rb deleted file mode 100644 index 11c7d6df..00000000 --- a/app/controllers/homes_controller.rb +++ /dev/null @@ -1,10 +0,0 @@ -class HomesController < ApplicationController - def index - @markets = Market.order(market_name: :asc) - end - - def show - @market = Market.find(params[:id]) - @vendors = Vendor.where(market_id: params[:id]) - end -end diff --git a/app/views/homes/_taskform.html.erb b/app/views/homes/_taskform.html.erb deleted file mode 100644 index aea876bf..00000000 --- a/app/views/homes/_taskform.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -
    - <% @markets.each do |market| %> -
  • - <%= link_to market.market_name, market_path(market.id)%> -
  • - <% end %> -
diff --git a/app/views/homes/index.html.erb b/app/views/homes/index.html.erb index d376c19e..357296ff 100644 --- a/app/views/homes/index.html.erb +++ b/app/views/homes/index.html.erb @@ -1 +1,7 @@ -<%= render 'taskform' %> + diff --git a/app/views/homes/show.html.erb b/app/views/homes/show.html.erb deleted file mode 100644 index 9e2e62d4..00000000 --- a/app/views/homes/show.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -

<%= @market.market_name %>

-
    -
  • <%= "Address"%>
  • -
  • <%="#{ @market.address}," %> - <%="#{@market.city},"%> - <%=" #{@market.state}," unless @market.state.nil?%><%=" #{@market.zip}" unless @market.zip.nil?%>
  • - -
  • <%= "County"%>
  • -
  • <%="#{@market.county}" unless @market.county.nil?%>
  • -
- -

Market Vendors

-
    - <% @vendors.each do |vendor| %> -
  • - <%= link_to vendor.vendor_name, vendor_path(vendor.id)%> -
  • - <% end %> -
diff --git a/app/views/markets/index.html.erb b/app/views/markets/index.html.erb index e69de29b..aea876bf 100644 --- a/app/views/markets/index.html.erb +++ b/app/views/markets/index.html.erb @@ -0,0 +1,7 @@ +
    + <% @markets.each do |market| %> +
  • + <%= link_to market.market_name, market_path(market.id)%> +
  • + <% end %> +
diff --git a/config/routes.rb b/config/routes.rb index 9968fd90..91d0b475 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,10 +6,9 @@ resources :markets resources :vendors resources :products - resources :homes # You can have the root of your site routed with "root" - root 'homes#index' + root 'markets#index' # Example of regular route: # get 'products/:id' => 'catalog#view' From 0f909674ad7bc340d50e616a4087dd46a55cd640 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Wed, 27 Apr 2016 15:43:09 -0700 Subject: [PATCH 26/53] Worked on products view. Currently it contains a table that lists all o the products a vendor sells, and also contains the action items edit, delete, and create. I think that those are routed correctly, but the views that the routed methhods call have not yet been created. --- app/controllers/products_controller.rb | 18 +++++++++--------- app/views/products/index.html.erb | 21 +++++++++++++++++---- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb index 5687c37c..627fd76c 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/products_controller.rb @@ -6,13 +6,13 @@ def show end def new - @new_vendor = Vendor.new + @new_product = Product.new render :new end def create - @new_vendor = Vendor.new(new_vendor_create_params[:vendor]) - if @new_vendor.save + @new_product = Product.new(new_product_create_params[:product]) + if @new_product.save redirect_to root_path else render :new @@ -20,13 +20,13 @@ def create end def edit - @vendor = Vendor.find(params[:id]) + @product = Product.find(params[:id]) render :edit end def update - @vendor = Vendor.find(params[:id]) - if @vendor.update(new_vendor_create_params[:vendor]) + @product = Product.find(params[:id]) + if @product.update(new_product_create_params[:product]) redirect_to root_path else render :edit @@ -34,13 +34,13 @@ def update end def destroy - @vendor = Vendor.destroy(params[:id]) + @product = Product.destroy(params[:id]) redirect_to root_path end private - def new_vendor_create_params - params.permit(vendor: [:vendor_id, :vendor_name, :num_of_employees, :market_id]) #you must permit parameters when you want to allow access to the user to create new data using the params. The user is ONLY permitted to access the artist and title parameters. + def new_product_create_params + params.permit(product: [:product_id, :product_name, :vendor_id]) #you must permit parameters when you want to allow access to the user to create new data using the params. The user is ONLY permitted to access the artist and title parameters. end end diff --git a/app/views/products/index.html.erb b/app/views/products/index.html.erb index 7f624e9d..ecf4e64c 100644 --- a/app/views/products/index.html.erb +++ b/app/views/products/index.html.erb @@ -1,5 +1,18 @@ -
    +

    Product List For: <%= Vendor.find(params[:id]).vendor_name %>

    + +
Vendor NameNumber of EmployeesMarket
<%= link_to vendor.vendor_name, vendor_path(vendor.id) %><%= vendor.num_of_employees %><%= link_to Market.find(vendor.market_id).market_name, market_path(vendor.market_id) %>
Vendor Name Number of Employees MarketProducts
<%= link_to vendor.vendor_name, vendor_path(vendor.id) %> <%= vendor.num_of_employees %> <%= link_to Market.find(vendor.market_id).market_name, market_path(vendor.market_id) %><%= link_to "View all #{vendor.vendor_name} products", product_path(vendor.vendor_id) %>
+ + + + + + <% @products.each do |product| %> -
  • <%= product.product_name %>
  • - <% end %> - + + + + <% end %> + +
    Product NameAction
    <%= product.product_name %><%= link_to "Edit", edit_product_path(product.id) %> / <%= link_to "Delete", url_for(action: :destroy, id: product.id), method: :delete, data: {confirm: "Are you sure you'd like to delete #{product.product_name}?"} %>
    + +<%= link_to "Would you like to create a new product?", new_product_path %> From 5d7440502812f5d3461fea4e43cf3142746d194e Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Wed, 27 Apr 2016 15:45:02 -0700 Subject: [PATCH 27/53] Removed homes view since we removed the homes controller. --- app/views/homes/index.html.erb | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 app/views/homes/index.html.erb diff --git a/app/views/homes/index.html.erb b/app/views/homes/index.html.erb deleted file mode 100644 index 357296ff..00000000 --- a/app/views/homes/index.html.erb +++ /dev/null @@ -1,7 +0,0 @@ - From 38a002f069e5d4b93403aa09da421c45df70c6e3 Mon Sep 17 00:00:00 2001 From: Cristal Tay Date: Wed, 27 Apr 2016 15:57:14 -0700 Subject: [PATCH 28/53] there's ability to add a new market. edit seems to be broken.. shall fix it tomorrow. --- app/controllers/markets_controller.rb | 30 +++++++++++++++++++++++++++ app/views/markets/edit.html.erb | 17 +++++++++++++++ app/views/markets/index.html.erb | 4 ++++ app/views/markets/new.html.erb | 17 +++++++++++++++ app/views/markets/show.html.erb | 5 +++++ 5 files changed, 73 insertions(+) create mode 100644 app/views/markets/edit.html.erb create mode 100644 app/views/markets/new.html.erb diff --git a/app/controllers/markets_controller.rb b/app/controllers/markets_controller.rb index b6d3845b..63b7c2b8 100644 --- a/app/controllers/markets_controller.rb +++ b/app/controllers/markets_controller.rb @@ -8,4 +8,34 @@ def show @vendors = Vendor.where(market_id: params[:id]) end + def new + @market = Market.new + end + + def create + @market = Market.new(market_edit_params[:market]) + if @market.save + redirect_to root_path + else + render :new + end + end + + def edit + @market = Market.find(params[:id]) + end + + def update + @market = Market.update(params[:id],market_edit_params[:market]) + if @market.save + redirect_to root_path + else + render :edit + end + end + + private + def market_edit_params + params.permit! + end end diff --git a/app/views/markets/edit.html.erb b/app/views/markets/edit.html.erb new file mode 100644 index 00000000..e53c270f --- /dev/null +++ b/app/views/markets/edit.html.erb @@ -0,0 +1,17 @@ +

    Edit Market

    + +<%= form_for @market , method: :patch, url: edit_market_path(@market) do |f| %> + <%= f.label :market_name%> + <%= f.text_field :market_name %> + <%= f.label :address %> + <%= f.text_field :address %> + <%= f.label :city %> + <%= f.text_field :city %> + <%= f.label :county %> + <%= f.text_field :county %> + <%= f.label :state %> + <%= f.text_field :state %> + <%= f.label :zip %> + <%= f.text_field :zip %> + <%= f.submit :'SUBMIT!!' %> +<%end%> diff --git a/app/views/markets/index.html.erb b/app/views/markets/index.html.erb index aea876bf..2da10d8a 100644 --- a/app/views/markets/index.html.erb +++ b/app/views/markets/index.html.erb @@ -5,3 +5,7 @@ <% end %> + + +<%= link_to "Add A Market", +"/markets/new"%> diff --git a/app/views/markets/new.html.erb b/app/views/markets/new.html.erb new file mode 100644 index 00000000..15affb08 --- /dev/null +++ b/app/views/markets/new.html.erb @@ -0,0 +1,17 @@ +

    Add A Market

    + +<%= form_for @market do |f| %> + <%= f.label :market_name%> + <%= f.text_field :market_name %> + <%= f.label :address %> + <%= f.text_field :address %> + <%= f.label :city %> + <%= f.text_field :city %> + <%= f.label :county %> + <%= f.text_field :county %> + <%= f.label :state %> + <%= f.text_field :state %> + <%= f.label :zip %> + <%= f.text_field :zip %> + <%= f.submit :'SUBMIT!!' %> +<%end%> diff --git a/app/views/markets/show.html.erb b/app/views/markets/show.html.erb index 9e2e62d4..22013118 100644 --- a/app/views/markets/show.html.erb +++ b/app/views/markets/show.html.erb @@ -17,3 +17,8 @@ <% end %> + + + + +<%= button_to 'Edit Market',url_for(action: :edit, id: @market.id), method: :edit, data: {confirm: "Are you sure you want to edit this task?"} %> From 544683e0e8bce7547df2788983280df661986ebc Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Wed, 27 Apr 2016 21:11:47 -0700 Subject: [PATCH 29/53] Edited route for products#new to carry the vendor's ID through params, so that I could assign the vendor_id to the product using the params. Bonus: I can call the vendor by name on the page. The update method is currently garbage, so I'm going to go fix that now. --- app/views/products/edit.html.erb | 0 app/views/products/index.html.erb | 2 +- app/views/products/new.html.erb | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 app/views/products/edit.html.erb create mode 100644 app/views/products/new.html.erb diff --git a/app/views/products/edit.html.erb b/app/views/products/edit.html.erb new file mode 100644 index 00000000..e69de29b diff --git a/app/views/products/index.html.erb b/app/views/products/index.html.erb index ecf4e64c..66c7acb7 100644 --- a/app/views/products/index.html.erb +++ b/app/views/products/index.html.erb @@ -15,4 +15,4 @@ -<%= link_to "Would you like to create a new product?", new_product_path %> +<%= link_to "Would you like to create a new product?", new_product_path(params[:id]) %> diff --git a/app/views/products/new.html.erb b/app/views/products/new.html.erb new file mode 100644 index 00000000..89d6cf0f --- /dev/null +++ b/app/views/products/new.html.erb @@ -0,0 +1,14 @@ +

    Add a Product

    + +<% vendor = Vendor.find(params[:id]) %> + +

    Hello, <%= vendor.vendor_name %>. Fill in the form below to create a new product.

    + +<%= form_for @new_product do |f| %> + <%= f.label :product_name %> + <%= f.text_field :product_name, :required => true %> + + <%= f.submit %> +<% end %> + +<%= link_to "Go back to my products...", product_path(vendor.id) %> From e6b8eb477a88630f79859f6da5b15fd34045b768 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Wed, 27 Apr 2016 21:38:07 -0700 Subject: [PATCH 30/53] Wow. I need to stop trying to commit things when I'm in the wrong directory. Vendors can now delete and create new products. --- app/controllers/products_controller.rb | 7 +++++-- app/controllers/vendors_controller.rb | 2 -- app/views/products/{edit.html.erb => _edit.html.erb} | 0 app/views/products/index.html.erb | 1 + app/views/products/new.html.erb | 2 ++ config/routes.rb | 3 ++- 6 files changed, 10 insertions(+), 5 deletions(-) rename app/views/products/{edit.html.erb => _edit.html.erb} (100%) diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb index 627fd76c..9cdc88c3 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/products_controller.rb @@ -7,13 +7,16 @@ def show def new @new_product = Product.new + @vendor = Vendor.find(params[:id]) render :new end def create @new_product = Product.new(new_product_create_params[:product]) if @new_product.save - redirect_to root_path + @new_product[:product_id] = @new_product[:id] + @new_product.save + redirect_to product_path(@new_product.vendor_id) else render :new end @@ -35,7 +38,7 @@ def update def destroy @product = Product.destroy(params[:id]) - redirect_to root_path + redirect_to product_path(@product.vendor_id) end private diff --git a/app/controllers/vendors_controller.rb b/app/controllers/vendors_controller.rb index a6fb26c3..fb46761b 100644 --- a/app/controllers/vendors_controller.rb +++ b/app/controllers/vendors_controller.rb @@ -6,8 +6,6 @@ def index end def show - @vendors_listed = Vendor.find(params[:id]) - render :index @vendors = Vendor.where(id: params[:id]) render :single_vendor_view end diff --git a/app/views/products/edit.html.erb b/app/views/products/_edit.html.erb similarity index 100% rename from app/views/products/edit.html.erb rename to app/views/products/_edit.html.erb diff --git a/app/views/products/index.html.erb b/app/views/products/index.html.erb index 66c7acb7..7f4c8028 100644 --- a/app/views/products/index.html.erb +++ b/app/views/products/index.html.erb @@ -1,5 +1,6 @@

    Product List For: <%= Vendor.find(params[:id]).vendor_name %>

    + diff --git a/app/views/products/new.html.erb b/app/views/products/new.html.erb index 89d6cf0f..1b9ef7cc 100644 --- a/app/views/products/new.html.erb +++ b/app/views/products/new.html.erb @@ -8,6 +8,8 @@ <%= f.label :product_name %> <%= f.text_field :product_name, :required => true %> + <%= f.hidden_field :vendor_id, :value => vendor.id %> + <%= f.submit %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index 91d0b475..c191ad3c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,14 +1,15 @@ Rails.application.routes.draw do # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". + root 'markets#index' + get "products/new/:id" => "products#new", as: "new_product" # only generate the specified routes resources :markets resources :vendors resources :products # You can have the root of your site routed with "root" - root 'markets#index' # Example of regular route: # get 'products/:id' => 'catalog#view' From 4456fd1b1f10fca5ed80bade34af4c075860f0de Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Wed, 27 Apr 2016 22:21:22 -0700 Subject: [PATCH 31/53] Moved form from product 'new' view to _form partial. This partial is being rendered by the product new and product edit views. Create, edit, destroy all work for products. Ordered products by name on product show page. Added link back to vendor info. --- app/controllers/products_controller.rb | 16 ++++++++-------- app/views/products/_edit.html.erb | 0 app/views/products/_form.html.erb | 18 ++++++++++++++++++ app/views/products/edit.html.erb | 8 ++++++++ app/views/products/index.html.erb | 5 ++++- app/views/products/new.html.erb | 11 +---------- 6 files changed, 39 insertions(+), 19 deletions(-) delete mode 100644 app/views/products/_edit.html.erb create mode 100644 app/views/products/_form.html.erb create mode 100644 app/views/products/edit.html.erb diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb index 9cdc88c3..5c0d823a 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/products_controller.rb @@ -1,22 +1,22 @@ class ProductsController < ApplicationController def show - @products = Product.where(vendor_id: params[:id]) + @products = Product.where(vendor_id: params[:id]).order(product_name: :asc) render :index end def new - @new_product = Product.new + @product = Product.new @vendor = Vendor.find(params[:id]) render :new end def create - @new_product = Product.new(new_product_create_params[:product]) - if @new_product.save - @new_product[:product_id] = @new_product[:id] - @new_product.save - redirect_to product_path(@new_product.vendor_id) + @product = Product.new(new_product_create_params[:product]) + if @product.save + @product[:product_id] = @product[:id] + @product.save + redirect_to product_path(@product.vendor_id) else render :new end @@ -30,7 +30,7 @@ def edit def update @product = Product.find(params[:id]) if @product.update(new_product_create_params[:product]) - redirect_to root_path + redirect_to product_path(@product.vendor_id) else render :edit end diff --git a/app/views/products/_edit.html.erb b/app/views/products/_edit.html.erb deleted file mode 100644 index e69de29b..00000000 diff --git a/app/views/products/_form.html.erb b/app/views/products/_form.html.erb new file mode 100644 index 00000000..34d239bb --- /dev/null +++ b/app/views/products/_form.html.erb @@ -0,0 +1,18 @@ +<% if @product.id == nil %> +<% vendor = Vendor.find(params[:id]) %> +<% else %> +<% product = Product.find(params[:id]) %> +<% vendor = Vendor.find_by(vendor_id: product.vendor_id) %> +<% end %> + + +<%= form_for @product do |f| %> + <%= f.label :product_name %> + <%= f.text_field :product_name, :required => true, :value => @product.product_name %> + + <%= f.hidden_field :vendor_id, :value => vendor.id %> + + <%= f.submit %> +<% end %> + +<%= link_to "Go back to my products...", product_path(vendor.id) %> diff --git a/app/views/products/edit.html.erb b/app/views/products/edit.html.erb new file mode 100644 index 00000000..ddb1a6da --- /dev/null +++ b/app/views/products/edit.html.erb @@ -0,0 +1,8 @@ +

    Edit a Product

    + +<% product = Product.find(params[:id]) %> +<% vendor = Vendor.find_by(vendor_id: product.vendor_id) %> + +

    Hello, <%= vendor.vendor_name %>. Fill in the form below to edit your product.

    + +<%= render partial: "form" %> diff --git a/app/views/products/index.html.erb b/app/views/products/index.html.erb index 7f4c8028..15420625 100644 --- a/app/views/products/index.html.erb +++ b/app/views/products/index.html.erb @@ -1,4 +1,6 @@ -

    Product List For: <%= Vendor.find(params[:id]).vendor_name %>

    +<% vendor = Vendor.find(params[:id]) %> + +

    Product List For: <%= vendor.vendor_name %>

    @@ -16,4 +18,5 @@
    +<%= link_to "Would you like to view your market info again, #{vendor.vendor_name}?", vendor_path(vendor.id) %> <%= link_to "Would you like to create a new product?", new_product_path(params[:id]) %> diff --git a/app/views/products/new.html.erb b/app/views/products/new.html.erb index 1b9ef7cc..3a10d1e9 100644 --- a/app/views/products/new.html.erb +++ b/app/views/products/new.html.erb @@ -4,13 +4,4 @@

    Hello, <%= vendor.vendor_name %>. Fill in the form below to create a new product.

    -<%= form_for @new_product do |f| %> - <%= f.label :product_name %> - <%= f.text_field :product_name, :required => true %> - - <%= f.hidden_field :vendor_id, :value => vendor.id %> - - <%= f.submit %> -<% end %> - -<%= link_to "Go back to my products...", product_path(vendor.id) %> +<%= render partial: "form" %> From 2eac1a809386991a989b8ef2c5531b5bf84b35da Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Thu, 28 Apr 2016 09:12:58 -0700 Subject: [PATCH 32/53] Added rails-erd gem. --- Gemfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index d0ca1fdd..483b3430 100644 --- a/Gemfile +++ b/Gemfile @@ -43,5 +43,6 @@ 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 'rails-erd' +end From 8a2e4a6eb264a51df1a332626c5c2b14dacb77c8 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Thu, 28 Apr 2016 09:14:33 -0700 Subject: [PATCH 33/53] Added better_errors gem --- Gemfile | 3 +++ Gemfile.lock | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/Gemfile b/Gemfile index 483b3430..d5742658 100644 --- a/Gemfile +++ b/Gemfile @@ -45,4 +45,7 @@ group :development do gem 'spring' gem 'rails-erd' + + gem "better_errors" + gem "binding_of_caller" end diff --git a/Gemfile.lock b/Gemfile.lock index d4b12fb3..a7e07517 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,10 +37,16 @@ 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 (8.2.4) + choice (0.2.0) + coderay (1.1.1) coffee-rails (4.1.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.1.x) @@ -95,6 +101,11 @@ GEM activesupport (>= 4.2.0.beta, < 5.0) nokogiri (~> 1.6.0) rails-deprecated_sanitizer (>= 1.0.1) + rails-erd (1.4.7) + activerecord (>= 3.2) + activesupport (>= 3.2) + choice (~> 0.2.0) + ruby-graphviz (~> 1.2) rails-html-sanitizer (1.0.3) loofah (~> 2.0) railties (4.2.6) @@ -105,6 +116,7 @@ GEM rake (11.1.2) rdoc (4.2.2) json (~> 1.4) + ruby-graphviz (1.2.2) sass (3.4.22) sass-rails (5.0.4) railties (>= 4.0.0, < 5.0) @@ -143,11 +155,14 @@ PLATFORMS ruby DEPENDENCIES + better_errors + binding_of_caller byebug coffee-rails (~> 4.1.0) jbuilder (~> 2.0) jquery-rails rails (= 4.2.6) + rails-erd sass-rails (~> 5.0) sdoc (~> 0.4.0) spring From ab42394b3aaa955b6a765162dcd6a9bffc898a43 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Thu, 28 Apr 2016 09:20:31 -0700 Subject: [PATCH 34/53] Commiting erd generated by rails-erd gem. --- erd.pdf | Bin 0 -> 32362 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 erd.pdf diff --git a/erd.pdf b/erd.pdf new file mode 100644 index 0000000000000000000000000000000000000000..adbcc5647606aa48d54ef0fd0e40ce30a7386ec3 GIT binary patch literal 32362 zcmb@s18`ojbN|+qP{R6Wi9rww;{J^Sp0;->JV&ovKr(wpOp! z>R!F~x~{HGEGsBXMMup5McluCvwvEAn={=%2*rp;i)XE82F1yVM>cb30hUlMz>R7W(O66fU9T!B8kfFN+2;>T zh*&WMh)(_BxxdVqX`Db(Aw{>BZWD3$FV3@8(EFjlmzJ&CHKVJ!-Fe1TZt6WAc1rdg z63E}3Go}mUOA66n={~Jj#|}A4Epck(&F6-;zL{nof3IB|Gj7iu3~q0}L0$3mCRDOE zcsvmHN)PB8Bl%F|Xgw7;Z|z2O{g6vS_9_?fRs?i^oGDzt2S%v?V@J5IhwzA0UJ z#cZD2cu?`|Y>rt3pf(RcG}AOi;OT-{7St9!+L5HuCQOn@(Q0Ix38T$KJ^d1!yw{#) zbrX}0Q*z{#a9uy)v?^cehbnQdv2NjUA@Hq9kg6%q>4m72BrPr z-UsL>E)lMjlg=SC(t_7~)=-8~AK**??Oab}B8!qaLB>P?+Y(m_1{(GQ6*J0hEGWX& zTj^@2qy)IWhFoNyNg3PH8f%~ZxJG%Q0=*r}gv1E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5Zmf7+w*9RJtbbr4#knKOu z+0F)ZOY7VG$loq&>;k$MK-qO0Bv1neIToWt}alI3;Mqo`QyhLTRYI##E+W`2w-4gfF>s9mlS~h EKWj!}*#H0l literal 0 HcmV?d00001 From ae9bbbda6be506a62add7fa47342677938edc24b Mon Sep 17 00:00:00 2001 From: Cristal Tay Date: Thu, 28 Apr 2016 11:42:19 -0700 Subject: [PATCH 35/53] make changes to fix edit and show --- app/controllers/markets_controller.rb | 2 +- app/views/markets/edit.html.erb | 4 +++- app/views/markets/show.html.erb | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/markets_controller.rb b/app/controllers/markets_controller.rb index 63b7c2b8..e4881c9c 100644 --- a/app/controllers/markets_controller.rb +++ b/app/controllers/markets_controller.rb @@ -30,7 +30,7 @@ def update if @market.save redirect_to root_path else - render :edit + render :market end end diff --git a/app/views/markets/edit.html.erb b/app/views/markets/edit.html.erb index e53c270f..ea47dc52 100644 --- a/app/views/markets/edit.html.erb +++ b/app/views/markets/edit.html.erb @@ -1,6 +1,7 @@

    Edit Market

    -<%= form_for @market , method: :patch, url: edit_market_path(@market) do |f| %> + +<%= form_for @market do |f| %> <%= f.label :market_name%> <%= f.text_field :market_name %> <%= f.label :address %> @@ -13,5 +14,6 @@ <%= f.text_field :state %> <%= f.label :zip %> <%= f.text_field :zip %> + <%= f.submit :'SUBMIT!!' %> <%end%> diff --git a/app/views/markets/show.html.erb b/app/views/markets/show.html.erb index 22013118..16e69213 100644 --- a/app/views/markets/show.html.erb +++ b/app/views/markets/show.html.erb @@ -21,4 +21,4 @@ -<%= button_to 'Edit Market',url_for(action: :edit, id: @market.id), method: :edit, data: {confirm: "Are you sure you want to edit this task?"} %> +<%= link_to 'Edit Market', edit_market_path(@market)%> From c0e354f4b85429132708c2f68d87c60f33e8b3b1 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Thu, 28 Apr 2016 11:43:00 -0700 Subject: [PATCH 36/53] Started work on 'As a vendor, I can create a sale for one of my products.' Route and form are up, still need to look into stripping the decimal from the number amount before storing it in the data. Is that needed? --- app/controllers/sales_controller.rb | 50 +++++++++++++++++++++++++++++ app/views/products/index.html.erb | 2 +- app/views/sales/new.html.erb | 17 ++++++++++ config/routes.rb | 4 +++ 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 app/views/sales/new.html.erb diff --git a/app/controllers/sales_controller.rb b/app/controllers/sales_controller.rb index 1b778cf3..af0cdc61 100644 --- a/app/controllers/sales_controller.rb +++ b/app/controllers/sales_controller.rb @@ -1,2 +1,52 @@ class SalesController < ApplicationController + + # def show + # @products = Product.where(vendor_id: params[:id]).order(product_name: :asc) + # render :index + # end + + def new + @sale = Sale.new + @product = Product.find(params[:id]) + @vendor = Vendor.find(@product.vendor_id) + render :new + end + + def create + @sale = Sale.new(new_product_create_params[:sale]) + if @sale.save + @sale[:sale_id] = @sale[:id] + @sale[:product_id] = @product[:id] + @sale[:vendor_id] = @vendor[:id] + @sale.save + redirect_to product_path(@product.vendor_id) + else + render :new + end + end + + # def edit + # @product = Product.find(params[:id]) + # render :edit + # end + # + # def update + # @product = Product.find(params[:id]) + # if @product.update(new_product_create_params[:product]) + # redirect_to product_path(@product.vendor_id) + # else + # render :edit + # end + # end + # + # def destroy + # @product = Product.destroy(params[:id]) + # redirect_to product_path(@product.vendor_id) + # end + + private + + def new_sale_create_params + params.permit(sale: [:sale_id, :amount, :vendor_id, :product_id]) #you must permit parameters when you want to allow access to the user to create new data using the params. The user is ONLY permitted to access the artist and title parameters. + end end diff --git a/app/views/products/index.html.erb b/app/views/products/index.html.erb index 15420625..9ab24f64 100644 --- a/app/views/products/index.html.erb +++ b/app/views/products/index.html.erb @@ -13,7 +13,7 @@ <% @products.each do |product| %> <%= product.product_name %> - <%= link_to "Edit", edit_product_path(product.id) %> / <%= link_to "Delete", url_for(action: :destroy, id: product.id), method: :delete, data: {confirm: "Are you sure you'd like to delete #{product.product_name}?"} %> + <%= link_to "Edit", edit_product_path(product.id) %> / <%= link_to "Delete", url_for(action: :destroy, id: product.id), method: :delete, data: {confirm: "Are you sure you'd like to delete #{product.product_name}?"} %> / <%= link_to "Add a Sale", new_sale_path(product.id) %> <% end %> diff --git a/app/views/sales/new.html.erb b/app/views/sales/new.html.erb new file mode 100644 index 00000000..108de297 --- /dev/null +++ b/app/views/sales/new.html.erb @@ -0,0 +1,17 @@ + + +Please enter the dollar amount for the sale of <%= @product.product_name %>. Enter as dollars and cents, e.g. 50.00. + +<%= form_for @sale do |f| %> + <%= f.label :amount %> + $ <%= f.number_field :amount, :class => "text_field", :step => "any", :required => true %> + + <%= f.submit %> +<% end %> + +<%= link_to "Go back to my products...", product_path(vendor.id) %> diff --git a/config/routes.rb b/config/routes.rb index c191ad3c..04e8b933 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,10 +4,14 @@ root 'markets#index' get "products/new/:id" => "products#new", as: "new_product" + + get "sales/new/:id" => "sales#new", as: "new_sale" + # only generate the specified routes resources :markets resources :vendors resources :products + resources :sales # You can have the root of your site routed with "root" From 55655c97f13d658582966fd5d64d2db694e93245 Mon Sep 17 00:00:00 2001 From: Cristal Tay Date: Thu, 28 Apr 2016 13:39:20 -0700 Subject: [PATCH 37/53] added a edit and new vendor page --- app/controllers/vendors_controller.rb | 2 +- app/views/markets/index.html.erb | 3 +-- app/views/markets/new.html.erb | 2 +- app/views/markets/show.html.erb | 2 ++ app/views/vendors/new.html.erb | 11 +++++++++++ app/views/vendors/single_vendor_view.html.erb | 2 +- config/routes.rb | 1 + 7 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 app/views/vendors/new.html.erb diff --git a/app/controllers/vendors_controller.rb b/app/controllers/vendors_controller.rb index fb46761b..b5044cc1 100644 --- a/app/controllers/vendors_controller.rb +++ b/app/controllers/vendors_controller.rb @@ -12,7 +12,7 @@ def show def new @new_vendor = Vendor.new - render :new + @market = Market.where(id: params[:id]).first end def create diff --git a/app/views/markets/index.html.erb b/app/views/markets/index.html.erb index 2da10d8a..bc9f5f0e 100644 --- a/app/views/markets/index.html.erb +++ b/app/views/markets/index.html.erb @@ -7,5 +7,4 @@ -<%= link_to "Add A Market", -"/markets/new"%> +<%= link_to "Add Market", new_market_path(@markets)%> diff --git a/app/views/markets/new.html.erb b/app/views/markets/new.html.erb index 15affb08..683cbebb 100644 --- a/app/views/markets/new.html.erb +++ b/app/views/markets/new.html.erb @@ -1,4 +1,4 @@ -

    Add A Market

    +

    Add A New Market

    <%= form_for @market do |f| %> <%= f.label :market_name%> diff --git a/app/views/markets/show.html.erb b/app/views/markets/show.html.erb index 16e69213..587a32f6 100644 --- a/app/views/markets/show.html.erb +++ b/app/views/markets/show.html.erb @@ -22,3 +22,5 @@ <%= link_to 'Edit Market', edit_market_path(@market)%> + +<%= link_to "Add Vendor", new_vendor_path%> diff --git a/app/views/vendors/new.html.erb b/app/views/vendors/new.html.erb new file mode 100644 index 00000000..5ebdeb21 --- /dev/null +++ b/app/views/vendors/new.html.erb @@ -0,0 +1,11 @@ +

    Add A New Vendor

    +<% @new_vendor.market_id = @market.id %> +<%= form_for @new_vendor do |f| %> + <%= f.label :vendor_name%> + <%= f.text_field :vendor_name %> + <%= f.label :num_of_employees %> + <%= f.text_field :num_of_employees %> + <%= f.hidden_field :market_id %> + <%= hidden_field_tag :market_id %> + <%= f.submit :'SUBMIT!!' %> +<%end%> diff --git a/app/views/vendors/single_vendor_view.html.erb b/app/views/vendors/single_vendor_view.html.erb index 2e4f17b7..3242c222 100644 --- a/app/views/vendors/single_vendor_view.html.erb +++ b/app/views/vendors/single_vendor_view.html.erb @@ -12,6 +12,6 @@ <%= link_to vendor.vendor_name, vendor_path(vendor.id) %> <%= vendor.num_of_employees %> <%= link_to Market.find(vendor.market_id).market_name, market_path(vendor.market_id) %> - <%= link_to "View all #{vendor.vendor_name} products", product_path(vendor.vendor_id) %> + <%= link_to "View all #{vendor.vendor_name} products", product_path(vendor.id) %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index 04e8b933..92c73b5c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,6 +7,7 @@ get "sales/new/:id" => "sales#new", as: "new_sale" + get "vendors/new/:id" => "vendors#new", as: "new_vendor" # only generate the specified routes resources :markets resources :vendors From ae8a7691558a46e9943dfc5df134848168a3e1dc Mon Sep 17 00:00:00 2001 From: Cristal Tay Date: Thu, 28 Apr 2016 14:22:34 -0700 Subject: [PATCH 38/53] holy crap I added a delete button and figured out how to redirect the user back to the previous page instead of just the home page. --- app/controllers/markets_controller.rb | 8 +++++++- app/controllers/vendors_controller.rb | 3 ++- app/views/markets/index.html.erb | 2 +- app/views/markets/show.html.erb | 6 +++++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/controllers/markets_controller.rb b/app/controllers/markets_controller.rb index e4881c9c..6a32715d 100644 --- a/app/controllers/markets_controller.rb +++ b/app/controllers/markets_controller.rb @@ -28,12 +28,18 @@ def edit def update @market = Market.update(params[:id],market_edit_params[:market]) if @market.save - redirect_to root_path + redirect_to market_path else render :market end end + def destroy + @mark_id = Vendor.find(params[:id]).market_id + @vendor = Vendor.find(params[:id]).destroy + redirect_to market_path(@mark_id) + end + private def market_edit_params params.permit! diff --git a/app/controllers/vendors_controller.rb b/app/controllers/vendors_controller.rb index b5044cc1..301eecfc 100644 --- a/app/controllers/vendors_controller.rb +++ b/app/controllers/vendors_controller.rb @@ -17,8 +17,9 @@ def new def create @new_vendor = Vendor.new(new_vendor_create_params[:vendor]) + @mark_id = @new_vendor.market_id if @new_vendor.save - redirect_to root_path + redirect_to market_path(@mark_id) else render :new end diff --git a/app/views/markets/index.html.erb b/app/views/markets/index.html.erb index bc9f5f0e..7141e942 100644 --- a/app/views/markets/index.html.erb +++ b/app/views/markets/index.html.erb @@ -7,4 +7,4 @@ -<%= link_to "Add Market", new_market_path(@markets)%> +<%= link_to "Add Market", new_market_path%> diff --git a/app/views/markets/show.html.erb b/app/views/markets/show.html.erb index 587a32f6..30fa1e93 100644 --- a/app/views/markets/show.html.erb +++ b/app/views/markets/show.html.erb @@ -9,12 +9,16 @@
  • <%="#{@market.county}" unless @market.county.nil?%>
  • -

    Market Vendors

    +

    Vendors

      <% @vendors.each do |vendor| %>
    • <%= link_to vendor.vendor_name, vendor_path(vendor.id)%> + + <%= button_to 'Delete', url_for(action: :destroy, id: vendor.id),method: :delete, data: {confirm: "Are you sure you want to delete this task?"} %> +
    • + <% end %>
    From 4dc4286ee3b7de1a675e8b25964a997ed6c08d60 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Thu, 28 Apr 2016 14:37:03 -0700 Subject: [PATCH 39/53] After much consternation, the create sale method works. --- app/controllers/sales_controller.rb | 30 ++++++----------------------- app/views/sales/new.html.erb | 16 ++++++--------- 2 files changed, 12 insertions(+), 34 deletions(-) diff --git a/app/controllers/sales_controller.rb b/app/controllers/sales_controller.rb index af0cdc61..6d0f5904 100644 --- a/app/controllers/sales_controller.rb +++ b/app/controllers/sales_controller.rb @@ -13,40 +13,22 @@ def new end def create - @sale = Sale.new(new_product_create_params[:sale]) +#I HATE THIS IT IS THE WORST: + params[:sale][:amount] = params[:sale][:amount].to_s.gsub(/\./, '') +#END OF HATE + @sale = Sale.new(new_sale_create_params[:sale]) if @sale.save @sale[:sale_id] = @sale[:id] - @sale[:product_id] = @product[:id] - @sale[:vendor_id] = @vendor[:id] @sale.save - redirect_to product_path(@product.vendor_id) + redirect_to product_path(@sale.vendor_id) else render :new end end - # def edit - # @product = Product.find(params[:id]) - # render :edit - # end - # - # def update - # @product = Product.find(params[:id]) - # if @product.update(new_product_create_params[:product]) - # redirect_to product_path(@product.vendor_id) - # else - # render :edit - # end - # end - # - # def destroy - # @product = Product.destroy(params[:id]) - # redirect_to product_path(@product.vendor_id) - # end - private def new_sale_create_params - params.permit(sale: [:sale_id, :amount, :vendor_id, :product_id]) #you must permit parameters when you want to allow access to the user to create new data using the params. The user is ONLY permitted to access the artist and title parameters. + params.permit(sale: [:sale_id, :amount, :vendor_id, :product_id]) end end diff --git a/app/views/sales/new.html.erb b/app/views/sales/new.html.erb index 108de297..e9c3d579 100644 --- a/app/views/sales/new.html.erb +++ b/app/views/sales/new.html.erb @@ -1,17 +1,13 @@ - - -Please enter the dollar amount for the sale of <%= @product.product_name %>. Enter as dollars and cents, e.g. 50.00. +Please enter the dollar amount for the sale of <%= @product.product_name %>. Enter as dollars and cents, e.g. 50.00. <%= form_for @sale do |f| %> <%= f.label :amount %> - $ <%= f.number_field :amount, :class => "text_field", :step => "any", :required => true %> + $<%= f.text_field :amount, :required => true %> + + <%= f.hidden_field :vendor_id, :value => @vendor.vendor_id %> + <%= f.hidden_field :product_id, :value => @product.product_id %> <%= f.submit %> <% end %> -<%= link_to "Go back to my products...", product_path(vendor.id) %> +<%= link_to "Go back to my products...", product_path(@vendor.id) %> From b75c818dd3d6cff75bc6d2239795aab290692448 Mon Sep 17 00:00:00 2001 From: Cristal Tay Date: Thu, 28 Apr 2016 14:40:09 -0700 Subject: [PATCH 40/53] done edit and delete for markets. all good --- app/controllers/vendors_controller.rb | 2 +- app/views/markets/show.html.erb | 3 ++- app/views/vendors/edit.html.erb | 11 +++++++++++ app/views/vendors/new.html.erb | 5 ++++- 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 app/views/vendors/edit.html.erb diff --git a/app/controllers/vendors_controller.rb b/app/controllers/vendors_controller.rb index 301eecfc..63ae98f5 100644 --- a/app/controllers/vendors_controller.rb +++ b/app/controllers/vendors_controller.rb @@ -33,7 +33,7 @@ def edit def update @vendor = Vendor.find(params[:id]) if @vendor.update(new_vendor_create_params[:vendor]) - redirect_to root_path + redirect_to market_path(@vendor.market_id) else render :edit end diff --git a/app/views/markets/show.html.erb b/app/views/markets/show.html.erb index 30fa1e93..b52ecec8 100644 --- a/app/views/markets/show.html.erb +++ b/app/views/markets/show.html.erb @@ -15,8 +15,9 @@
  • <%= link_to vendor.vendor_name, vendor_path(vendor.id)%> - <%= button_to 'Delete', url_for(action: :destroy, id: vendor.id),method: :delete, data: {confirm: "Are you sure you want to delete this task?"} %> + <%= button_to 'Edit', edit_vendor_path(vendor.id), method: :get, data: {confirm: "Please sign in to edit."} %> + <%= button_to 'Delete', url_for(action: :destroy, id: vendor.id),method: :delete, data: {confirm: "Are you sure you want to delete this task?"} %>
  • <% end %> diff --git a/app/views/vendors/edit.html.erb b/app/views/vendors/edit.html.erb new file mode 100644 index 00000000..3ce5ecec --- /dev/null +++ b/app/views/vendors/edit.html.erb @@ -0,0 +1,11 @@ +

    Edit Vendor

    + +<%= form_for @vendor do |f| %> + <%= f.label :vendor_name%> + <%= f.text_field :vendor_name %> + <%= f.label :num_of_employees %> + <%= f.text_field :num_of_employees %> + <%= f.hidden_field :market_id %> + <%= hidden_field_tag :market_id %> + <%= f.submit :'SUBMIT!!' %> +<%end%> diff --git a/app/views/vendors/new.html.erb b/app/views/vendors/new.html.erb index 5ebdeb21..b9a955cf 100644 --- a/app/views/vendors/new.html.erb +++ b/app/views/vendors/new.html.erb @@ -1,5 +1,6 @@ -

    Add A New Vendor

    <% @new_vendor.market_id = @market.id %> +

    <%= "#{@new_vendor.market.market_name} Market" %>

    +

    Add A New Vendor

    <%= form_for @new_vendor do |f| %> <%= f.label :vendor_name%> <%= f.text_field :vendor_name %> @@ -7,5 +8,7 @@ <%= f.text_field :num_of_employees %> <%= f.hidden_field :market_id %> <%= hidden_field_tag :market_id %> + + <%= f.submit :'SUBMIT!!' %> <%end%> From ea2dcc7939d0dced63fd821a03bc2b35431894a6 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Thu, 28 Apr 2016 14:45:02 -0700 Subject: [PATCH 41/53] Small change to single view. --- app/views/vendors/single_vendor_view.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/vendors/single_vendor_view.html.erb b/app/views/vendors/single_vendor_view.html.erb index 3242c222..949f6a7c 100644 --- a/app/views/vendors/single_vendor_view.html.erb +++ b/app/views/vendors/single_vendor_view.html.erb @@ -12,6 +12,6 @@ <%= link_to vendor.vendor_name, vendor_path(vendor.id) %> <%= vendor.num_of_employees %> <%= link_to Market.find(vendor.market_id).market_name, market_path(vendor.market_id) %> - <%= link_to "View all #{vendor.vendor_name} products", product_path(vendor.id) %> + <%= link_to "View all products", product_path(vendor.id) %> <% end %> From b95eacd719943adef21d9af2cfbb4f79e4a65832 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Thu, 28 Apr 2016 14:58:11 -0700 Subject: [PATCH 42/53] Minor fix added. --- app/controllers/vendors_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/vendors_controller.rb b/app/controllers/vendors_controller.rb index 63ae98f5..cdc202ec 100644 --- a/app/controllers/vendors_controller.rb +++ b/app/controllers/vendors_controller.rb @@ -19,6 +19,8 @@ def create @new_vendor = Vendor.new(new_vendor_create_params[:vendor]) @mark_id = @new_vendor.market_id if @new_vendor.save + @new_vendor[:vendor_id] = @new_vendor[:id] + @new_vendor.save redirect_to market_path(@mark_id) else render :new From 40536d0c29c4d8e8ecf3c80c174f0940a11aed4e Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Thu, 28 Apr 2016 15:07:26 -0700 Subject: [PATCH 43/53] Added links to See All Sales and See All Sales For the Current Month --- app/views/products/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/products/index.html.erb b/app/views/products/index.html.erb index 9ab24f64..c9001c6f 100644 --- a/app/views/products/index.html.erb +++ b/app/views/products/index.html.erb @@ -13,7 +13,7 @@ <% @products.each do |product| %> <%= product.product_name %> - <%= link_to "Edit", edit_product_path(product.id) %> / <%= link_to "Delete", url_for(action: :destroy, id: product.id), method: :delete, data: {confirm: "Are you sure you'd like to delete #{product.product_name}?"} %> / <%= link_to "Add a Sale", new_sale_path(product.id) %> + <%= link_to "Edit", edit_product_path(product.id) %> / <%= link_to "Delete", url_for(action: :destroy, id: product.id), method: :delete, data: {confirm: "Are you sure you'd like to delete #{product.product_name}?"} %> / <%= link_to "Add a Sale", new_sale_path(product.id) %> / <%= link_to "See All Sales", sale_path(vendor.id) %> / <%= link_to "See All Sales For The Current Month", sale_path(vendor.id) %> <% end %> From 97d18e6e066839c938473dab56b462e3dacd3454 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Thu, 28 Apr 2016 15:35:14 -0700 Subject: [PATCH 44/53] Hahahahaha, don't look at show.html.erb yet. It's a mess! TOTAL MESS. --- app/controllers/sales_controller.rb | 8 ++++---- app/views/sales/show.html.erb | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 app/views/sales/show.html.erb diff --git a/app/controllers/sales_controller.rb b/app/controllers/sales_controller.rb index 6d0f5904..3a7b9014 100644 --- a/app/controllers/sales_controller.rb +++ b/app/controllers/sales_controller.rb @@ -1,9 +1,9 @@ class SalesController < ApplicationController - # def show - # @products = Product.where(vendor_id: params[:id]).order(product_name: :asc) - # render :index - # end + def show + @sale = Sale.where(vendor_id: params[:id]).order(purchase_time: :asc) + render :show + end def new @sale = Sale.new diff --git a/app/views/sales/show.html.erb b/app/views/sales/show.html.erb new file mode 100644 index 00000000..eb8c8ff0 --- /dev/null +++ b/app/views/sales/show.html.erb @@ -0,0 +1,27 @@ +<% vendor = Vendor.find(params[:id]) %> + +

    Total Sale List For: <%= vendor.vendor_name %>

    + + + + + + + + + + <% @total = 0.to_i %> + <%= @total.inspect %> + <% @sale.each do |sal| %> + <% name = Sale.find(sal.id) %> + <%= @total += sal.amount.to_i %> + + + + <% end %> +

    Total sales are <%= @total %>.

    + +
    Product NameAmount
    <%= name %><%= sal.amount %>
    + +<%= link_to "Would you like to view your market info again, #{vendor.vendor_name}?", vendor_path(vendor.id) %> +<%= link_to "Would you like to create a new product?", new_product_path(params[:id]) %> From ad9c8eb8aba094ac8ac878ebd23ca09644e8a570 Mon Sep 17 00:00:00 2001 From: Jillian Boshart Date: Thu, 28 Apr 2016 16:58:13 -0700 Subject: [PATCH 45/53] View all sales is working, total is listed on that main page. --- app/controllers/products_controller.rb | 2 +- app/controllers/sales_controller.rb | 2 +- app/views/products/index.html.erb | 5 ++++- app/views/sales/show.html.erb | 24 ++++++++++++------------ 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb index 5c0d823a..94d4c9f7 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/products_controller.rb @@ -5,7 +5,7 @@ def show render :index end - def new + def new @product = Product.new @vendor = Vendor.find(params[:id]) render :new diff --git a/app/controllers/sales_controller.rb b/app/controllers/sales_controller.rb index 3a7b9014..0e36d205 100644 --- a/app/controllers/sales_controller.rb +++ b/app/controllers/sales_controller.rb @@ -7,7 +7,7 @@ def show def new @sale = Sale.new - @product = Product.find(params[:id]) + @product = Product.where(vendor_id: params[:id]) @vendor = Vendor.find(@product.vendor_id) render :new end diff --git a/app/views/products/index.html.erb b/app/views/products/index.html.erb index c9001c6f..88d338b3 100644 --- a/app/views/products/index.html.erb +++ b/app/views/products/index.html.erb @@ -13,10 +13,13 @@ <% @products.each do |product| %> <%= product.product_name %> - <%= link_to "Edit", edit_product_path(product.id) %> / <%= link_to "Delete", url_for(action: :destroy, id: product.id), method: :delete, data: {confirm: "Are you sure you'd like to delete #{product.product_name}?"} %> / <%= link_to "Add a Sale", new_sale_path(product.id) %> / <%= link_to "See All Sales", sale_path(vendor.id) %> / <%= link_to "See All Sales For The Current Month", sale_path(vendor.id) %> + <%= link_to "Edit", edit_product_path(product.id) %> / <%= link_to "Delete", url_for(action: :destroy, id: product.id), method: :delete, data: {confirm: "Are you sure you'd like to delete #{product.product_name}?"} %> / <%= link_to "Add a Sale", new_sale_path(product.id) %> + <% end %> +<%= link_to "See All Sales", sale_path(vendor.id) %> +<%= link_to "See All Sales For The Current Month", sale_path(vendor.id) %> <%= link_to "Would you like to view your market info again, #{vendor.vendor_name}?", vendor_path(vendor.id) %> <%= link_to "Would you like to create a new product?", new_product_path(params[:id]) %> diff --git a/app/views/sales/show.html.erb b/app/views/sales/show.html.erb index eb8c8ff0..1a3a3fec 100644 --- a/app/views/sales/show.html.erb +++ b/app/views/sales/show.html.erb @@ -1,27 +1,27 @@ <% vendor = Vendor.find(params[:id]) %> +<% @sale.each do |thing| %> +<%= thing.product_id %> +<% end %>

    Total Sale List For: <%= vendor.vendor_name %>

    - - + <% @total = 0.to_i %> - <%= @total.inspect %> <% @sale.each do |sal| %> - <% name = Sale.find(sal.id) %> - <%= @total += sal.amount.to_i %> - - - - <% end %> -

    Total sales are <%= @total %>.

    - -
    Product NameSale Time Amount
    <%= name %><%= sal.amount %>
    + <% @total += sal.amount.to_i %> + + <%= sal.purchase_time %> + <%= sal.amount %> + <% end %> +

    Total sales are <%= @total %>.

    + + <%= link_to "Would you like to view your market info again, #{vendor.vendor_name}?", vendor_path(vendor.id) %> <%= link_to "Would you like to create a new product?", new_product_path(params[:id]) %> From 0a7678f321bb8ad34aebb77cb3d92383206596b8 Mon Sep 17 00:00:00 2001 From: Cristal Tay Date: Thu, 28 Apr 2016 20:33:06 -0700 Subject: [PATCH 46/53] figured out how to group by month --- app/controllers/markets_controller.rb | 2 +- app/controllers/sales_controller.rb | 9 +++++++++ app/views/sales/month_sale.html.erb | 9 +++++++++ app/views/sales/show.html.erb | 12 ++++++++++++ config/routes.rb | 2 ++ 5 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 app/views/sales/month_sale.html.erb diff --git a/app/controllers/markets_controller.rb b/app/controllers/markets_controller.rb index 6a32715d..f5df5db7 100644 --- a/app/controllers/markets_controller.rb +++ b/app/controllers/markets_controller.rb @@ -15,7 +15,7 @@ def new def create @market = Market.new(market_edit_params[:market]) if @market.save - redirect_to root_path + redirect_to market_path(@market.id) else render :new end diff --git a/app/controllers/sales_controller.rb b/app/controllers/sales_controller.rb index 3a7b9014..d2347784 100644 --- a/app/controllers/sales_controller.rb +++ b/app/controllers/sales_controller.rb @@ -1,10 +1,19 @@ +require 'date' + class SalesController < ApplicationController def show @sale = Sale.where(vendor_id: params[:id]).order(purchase_time: :asc) + @group = Sale.group("strftime('%m', purchase_time)").count render :show end + def month_sale + @group = Sale.group("strftime('%m', purchase_time)").count + @v_id = params[:id] + @month = params[:name] + end + def new @sale = Sale.new @product = Product.find(params[:id]) diff --git a/app/views/sales/month_sale.html.erb b/app/views/sales/month_sale.html.erb new file mode 100644 index 00000000..c430ec2d --- /dev/null +++ b/app/views/sales/month_sale.html.erb @@ -0,0 +1,9 @@ +<% @month_num = {'JAN' => "01", 'FEB' => "02", 'MAR' => "03", 'APR' => "04", 'MAY' => "05", 'JUN' => "06",'JUL' => "07", 'AUG' => "08",'SEP' => "09", 'OCT' => "10", 'NOV' => "11", 'DEC' => "12"} %> + +<% @num = @month_num[@month] %> +<% @month_sales = Sale.where("cast(strftime('%m', purchase_time) as int) = ?", @num).where("vendor_id = ?", @v_id) %> + +

    <%= Vendor.find(@v_id).vendor_name%>

    + +<% @total = @month_sales.sum('amount') %> +<%= "Total sales for #{@month.downcase.capitalize}: $#{@total}" %> diff --git a/app/views/sales/show.html.erb b/app/views/sales/show.html.erb index eb8c8ff0..dbdb85c4 100644 --- a/app/views/sales/show.html.erb +++ b/app/views/sales/show.html.erb @@ -1,3 +1,14 @@ +<% @month_num = { "01" => 'JAN', "02" => 'FEB', "03" => 'MAR', "04" => 'APR', "05" => 'MAY', "06" => 'JUN', "07" => 'JUL', "08" => 'AUG', "09" => 'SEP', "10" => 'OCT', "11" => 'NOV', "12" => 'DEC'} %> +
      + <% @group.each do |key, value| %> +
    • + <% v_id = params[:id] %> + <% used_month = @month_num[key] %> + <%= link_to used_month, "/sales/#{v_id}/#{used_month}", method: :get %> +
    • + <% end %> +
    + <% vendor = Vendor.find(params[:id]) %>

    Total Sale List For: <%= vendor.vendor_name %>

    @@ -18,6 +29,7 @@ <%= name %> <%= sal.amount %> + <%= sal.purchase_time %> <% end %>

    Total sales are <%= @total %>.

    diff --git a/config/routes.rb b/config/routes.rb index 92c73b5c..7ab36f88 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,6 +8,8 @@ get "sales/new/:id" => "sales#new", as: "new_sale" get "vendors/new/:id" => "vendors#new", as: "new_vendor" + + get "sales/:id/:name" => "sales#month_sale", as: "month_sale" # only generate the specified routes resources :markets resources :vendors From 388d217b9f419c68e9ef9bc1dc0c205a154ffb11 Mon Sep 17 00:00:00 2001 From: Cristal Tay Date: Thu, 28 Apr 2016 21:28:24 -0700 Subject: [PATCH 47/53] cleaned up sales show pages all and monthly --- app/assets/stylesheets/application.css | 7 ++++ app/controllers/sales_controller.rb | 3 ++ app/views/sales/_salelist.html.erb | 50 ++++++++++++++++++++++++++ app/views/sales/month_sale.html.erb | 10 ++---- app/views/sales/show.html.erb | 50 ++------------------------ 5 files changed, 64 insertions(+), 56 deletions(-) create mode 100644 app/views/sales/_salelist.html.erb diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 1f1b417c..108864e3 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -38,6 +38,7 @@ ul li a { text-decoration: none; } + form { display: inline; } @@ -66,3 +67,9 @@ header nav ul li a{ /*h2{ color:green; }*/ +.groupheading{ + text-align: center; +} +.groupheading li{ + display: inline; +} diff --git a/app/controllers/sales_controller.rb b/app/controllers/sales_controller.rb index a057be86..ae3c944a 100644 --- a/app/controllers/sales_controller.rb +++ b/app/controllers/sales_controller.rb @@ -12,6 +12,9 @@ def month_sale @group = Sale.group("strftime('%m', purchase_time)").count @v_id = params[:id] @month = params[:name] + @month_num = {'JAN' => "01", 'FEB' => "02", 'MAR' => "03", 'APR' => "04", 'MAY' => "05", 'JUN' => "06",'JUL' => "07", 'AUG' => "08",'SEP' => "09", 'OCT' => "10", 'NOV' => "11", 'DEC' => "12"} + @num = @month_num[@month] + @sale = Sale.where("cast(strftime('%m', purchase_time) as int) = ?", @num).where("vendor_id = ?", @v_id) end def new diff --git a/app/views/sales/_salelist.html.erb b/app/views/sales/_salelist.html.erb new file mode 100644 index 00000000..1523dfe9 --- /dev/null +++ b/app/views/sales/_salelist.html.erb @@ -0,0 +1,50 @@ +<% @month_num = { "01" => 'JAN', "02" => 'FEB', "03" => 'MAR', "04" => 'APR', "05" => 'MAY', "06" => 'JUN', "07" => 'JUL', "08" => 'AUG', "09" => 'SEP', "10" => 'OCT', "11" => 'NOV', "12" => 'DEC'} %> + +
      + <% @group.each do |key, value| %> +
    • + <% v_id = params[:id] %> + <% used_month = @month_num[key] %> + <%= link_to used_month, "/sales/#{v_id}/#{used_month}", method: :get %> +
    • + <% end %> +
    • + <%="|"%> +
    • +
    • + <%= link_to "ALL", "/sales/#{params[:id]}", method: :get %> +
    • +
    + +<% vendor = Vendor.find(params[:id]) %> +<% @sale.each do |thing| %> +<% thing.product_id %> +<% end %> + +

    <%= vendor.vendor_name %>

    +

    List of Sales

    + + + + + + + + + + + <% @total = 0.to_i %> + <% @sale.each do |sal| %> + <% name = Sale.find(sal.id) %> + <% @total += sal.amount.to_i %> + <% date = DateTime.parse("#{sal.purchase_time}") %> + + + + + + <% end %> + + +<%= link_to "Vendor Info", vendor_path(vendor.id) %> +<%= link_to "Add Product", new_product_path(params[:id]) %> diff --git a/app/views/sales/month_sale.html.erb b/app/views/sales/month_sale.html.erb index c430ec2d..ab15dc5e 100644 --- a/app/views/sales/month_sale.html.erb +++ b/app/views/sales/month_sale.html.erb @@ -1,9 +1,3 @@ -<% @month_num = {'JAN' => "01", 'FEB' => "02", 'MAR' => "03", 'APR' => "04", 'MAY' => "05", 'JUN' => "06",'JUL' => "07", 'AUG' => "08",'SEP' => "09", 'OCT' => "10", 'NOV' => "11", 'DEC' => "12"} %> +<%= render "salelist" %> -<% @num = @month_num[@month] %> -<% @month_sales = Sale.where("cast(strftime('%m', purchase_time) as int) = ?", @num).where("vendor_id = ?", @v_id) %> - -

    <%= Vendor.find(@v_id).vendor_name%>

    - -<% @total = @month_sales.sum('amount') %> -<%= "Total sales for #{@month.downcase.capitalize}: $#{@total}" %> +

    <%="Total Sales for #{@month.downcase.capitalize}: $#{@total} "%>

    diff --git a/app/views/sales/show.html.erb b/app/views/sales/show.html.erb index 678a7a9d..255db4ef 100644 --- a/app/views/sales/show.html.erb +++ b/app/views/sales/show.html.erb @@ -1,49 +1,3 @@ -<% @month_num = { "01" => 'JAN', "02" => 'FEB', "03" => 'MAR', "04" => 'APR', "05" => 'MAY', "06" => 'JUN', "07" => 'JUL', "08" => 'AUG', "09" => 'SEP', "10" => 'OCT', "11" => 'NOV', "12" => 'DEC'} %> -
      - <% @group.each do |key, value| %> -
    • - <% v_id = params[:id] %> - <% used_month = @month_num[key] %> - <%= link_to used_month, "/sales/#{v_id}/#{used_month}", method: :get %> -
    • - <% end %> -
    +<%= render "salelist" %> -<% vendor = Vendor.find(params[:id]) %> -<% @sale.each do |thing| %> -<%= thing.product_id %> -<% end %> - -

    Total Sale List For: <%= vendor.vendor_name %>

    - -
    Sale ItemsAmount ($)Purchase DatePurchase Time
    <%= Product.find(sal.product_id).product_name %><%= sal.amount %><%= date.strftime('%Y-%m-%d') %><%= date.strftime('%H:%M') %>
    - - - - - - - <% @total = 0.to_i %> - <% @sale.each do |sal| %> - <% name = Sale.find(sal.id) %> - <%= @total += sal.amount.to_i %> - - - - - <% end %> -

    Total sales are <%= @total %>.

    - -
    Sale TimeAmount
    <%= name %><%= sal.amount %><%= sal.purchase_time %>
    - - <% @total += sal.amount.to_i %> - - <%= sal.purchase_time %> - <%= sal.amount %> - <% end %> -

    Total sales are <%= @total %>.

    - - - -<%= link_to "Would you like to view your market info again, #{vendor.vendor_name}?", vendor_path(vendor.id) %> -<%= link_to "Would you like to create a new product?", new_product_path(params[:id]) %> +

    Total overall sales: $<%= @total %>

    From 6d8eae039ebcac4668588f5b364ba236f1143789 Mon Sep 17 00:00:00 2001 From: Cristal Tay Date: Fri, 29 Apr 2016 14:46:47 -0700 Subject: [PATCH 48/53] found a way to group the markets to be searched for by the first letter of their name --- app/assets/stylesheets/application.css | 6 +++-- app/controllers/markets_controller.rb | 7 ++++++ app/views/layouts/application.html.erb | 2 +- app/views/markets/_marketlist.html.erb | 31 +++++++++++++++++++++++++ app/views/markets/index.html.erb | 11 +-------- app/views/markets/lettermarket.html.erb | 1 + app/views/markets/show.html.erb | 1 + app/views/products/index.html.erb | 11 ++++----- app/views/products/new.html.erb | 5 ++-- app/views/sales/_salelist.html.erb | 3 ++- config/routes.rb | 5 ++++ 11 files changed, 61 insertions(+), 22 deletions(-) create mode 100644 app/views/markets/_marketlist.html.erb create mode 100644 app/views/markets/lettermarket.html.erb diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 108864e3..30755108 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -23,10 +23,10 @@ a{ /*color: rgb(0, 224, 224);*/ } -h1{ +.header{ /*background-color: green;*/ text-align: center; - font-size: 3vw; + font-size: 5vw; /*color: white;*/ } @@ -53,6 +53,8 @@ form { } header nav ul{ text-align: center; + margin: 0; + padding: 0; } header nav ul li{ diff --git a/app/controllers/markets_controller.rb b/app/controllers/markets_controller.rb index f5df5db7..4c48cd00 100644 --- a/app/controllers/markets_controller.rb +++ b/app/controllers/markets_controller.rb @@ -1,11 +1,18 @@ class MarketsController < ApplicationController def index @markets = Market.order(market_name: :asc) + @all_markets = Market.order(market_name: :asc) end def show @market = Market.find(params[:id]) @vendors = Vendor.where(market_id: params[:id]) + render :show + end + + def lettermarket + @markets = Market.where("market_name LIKE :prefix", prefix: "#{params[:letter]}%") + @all_markets = Market.order(market_name: :asc) end def new diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 1a94b7a4..3ece0a85 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -8,7 +8,7 @@
    -

    FarMar

    +

    FarMar