<%= @market.name %>
+-
+
- <%= @market.address %> +
- <%= "#{@market.city}, #{@market.state} #{@market.zip}" %> +
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/FarmarSS.png b/FarmarSS.png
new file mode 100644
index 00000000..d28c2aa5
Binary files /dev/null and b/FarmarSS.png differ
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 00000000..54333f51
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,57 @@
+source 'https://rubygems.org'
+
+#Gem for searching
+gem 'ransack'
+# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
+gem 'rails', '4.2.7'
+# Use Awesome Print for better printing
+gem 'awesome_print', require: 'ap'
+# Use Better Errors for erro handling
+gem 'better_errors'
+# Use Quiet Assets for server log handling
+gem 'quiet_assets', group: :development
+# Use sqlite3 as the database for Active Record
+gem 'sqlite3', group: [:development, :test]
+# 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
+
+# Use these gems for heroku
+gem 'pg', group: :production
+gem 'rails_12factor', group: :production
+
+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..ef3a37b2
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,190 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actionmailer (4.2.7)
+ actionpack (= 4.2.7)
+ actionview (= 4.2.7)
+ activejob (= 4.2.7)
+ mail (~> 2.5, >= 2.5.4)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ actionpack (4.2.7)
+ actionview (= 4.2.7)
+ activesupport (= 4.2.7)
+ 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.7)
+ activesupport (= 4.2.7)
+ 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.7)
+ activesupport (= 4.2.7)
+ globalid (>= 0.3.0)
+ activemodel (4.2.7)
+ activesupport (= 4.2.7)
+ builder (~> 3.1)
+ activerecord (4.2.7)
+ activemodel (= 4.2.7)
+ activesupport (= 4.2.7)
+ arel (~> 6.0)
+ activesupport (4.2.7)
+ 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)
+ awesome_print (1.7.0)
+ better_errors (2.1.1)
+ coderay (>= 1.0.0)
+ erubis (>= 2.6.6)
+ rack (>= 0.9.0)
+ binding_of_caller (0.7.2)
+ debug_inspector (>= 0.0.1)
+ builder (3.2.2)
+ byebug (9.0.6)
+ coderay (1.1.1)
+ coffee-rails (4.1.1)
+ coffee-script (>= 2.2.0)
+ railties (>= 4.0.0, < 5.1.x)
+ coffee-script (2.4.1)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.10.0)
+ concurrent-ruby (1.0.2)
+ debug_inspector (0.0.2)
+ erubis (2.7.0)
+ execjs (2.7.0)
+ globalid (0.3.7)
+ activesupport (>= 4.1.0)
+ i18n (0.7.0)
+ jbuilder (2.6.0)
+ activesupport (>= 3.0.0, < 5.1)
+ multi_json (~> 1.2)
+ jquery-rails (4.2.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.1)
+ mime-types-data (~> 3.2015)
+ mime-types-data (3.2016.0521)
+ mini_portile2 (2.1.0)
+ minitest (5.9.1)
+ multi_json (1.12.1)
+ nokogiri (1.6.8.1)
+ mini_portile2 (~> 2.1.0)
+ pg (0.19.0)
+ polyamorous (1.3.1)
+ activerecord (>= 3.0)
+ quiet_assets (1.1.0)
+ railties (>= 3.1, < 5.0)
+ rack (1.6.4)
+ rack-test (0.6.3)
+ rack (>= 1.0)
+ rails (4.2.7)
+ actionmailer (= 4.2.7)
+ actionpack (= 4.2.7)
+ actionview (= 4.2.7)
+ activejob (= 4.2.7)
+ activemodel (= 4.2.7)
+ activerecord (= 4.2.7)
+ activesupport (= 4.2.7)
+ bundler (>= 1.3.0, < 2.0)
+ railties (= 4.2.7)
+ 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)
+ rails_12factor (0.0.3)
+ rails_serve_static_assets
+ rails_stdout_logging
+ rails_serve_static_assets (0.0.5)
+ rails_stdout_logging (0.0.5)
+ railties (4.2.7)
+ actionpack (= 4.2.7)
+ activesupport (= 4.2.7)
+ rake (>= 0.8.7)
+ thor (>= 0.18.1, < 2.0)
+ rake (11.3.0)
+ ransack (1.8.2)
+ actionpack (>= 3.0)
+ activerecord (>= 3.0)
+ activesupport (>= 3.0)
+ i18n
+ polyamorous (~> 1.3)
+ rdoc (4.2.2)
+ json (~> 1.4)
+ sass (3.4.22)
+ sass-rails (5.0.6)
+ railties (>= 4.0.0, < 6)
+ 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 (2.0.0)
+ activesupport (>= 4.2)
+ sprockets (3.7.0)
+ concurrent-ruby (~> 1.0)
+ rack (> 1, < 3)
+ sprockets-rails (3.2.0)
+ 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.5)
+ turbolinks (5.0.1)
+ turbolinks-source (~> 5)
+ turbolinks-source (5.0.0)
+ tzinfo (1.2.2)
+ thread_safe (~> 0.1)
+ uglifier (3.0.2)
+ 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
+ awesome_print
+ better_errors
+ byebug
+ coffee-rails (~> 4.1.0)
+ jbuilder (~> 2.0)
+ jquery-rails
+ pg
+ quiet_assets
+ rails (= 4.2.7)
+ rails_12factor
+ ransack
+ sass-rails (~> 5.0)
+ sdoc (~> 0.4.0)
+ spring
+ sqlite3
+ turbolinks
+ uglifier (>= 1.3.0)
+ web-console (~> 2.0)
+
+BUNDLED WITH
+ 1.13.1
diff --git a/README.md b/README.md
index e6ed6722..09e42420 100644
--- a/README.md
+++ b/README.md
@@ -1,58 +1,36 @@
-# FarMar Rails
-Build a database backend application to view, create, and manage farmers markets as well as their vendors, products, and sales.
-In this implementation we'll be seeding with static data, and also building a tool to allow markets and/or vendors to sign up and add their own data.
+# Farmers Market Database
+A Ruby on Rails web application built by [Briana Eng](https://www.github.com/brianaeng) and [Alyssa Hursh](https://www.github.com/alyssahursh). Our first Rails application, with a SQLite database seeded by CSV import. Interact with it [here](https://farmar-app.herokuapp.com). (This application is deployed on Heroku, so you may need to give the site a minute to wake up the server.)
-As you are using ActiveRecord to access the database compare the methods that are given to those you had to create in the CSV implementation of FarMar.
+![Farmar screen shots](/FarmarSS.png?raw=true "Farmar screen shots")
-This project is meant to be exploratory. Take time to try to dive into each piece of Rails (routes, controllers, models, views). This project is built so that you and your partner can create the waves yourself based on the dependencies of the requirements given.
-## Best Practices
-- Use git relentlessly
-- Pair program on difficult problems and to share learning experiences
+## Technologies
+* Primary language: Ruby 2.3.1
+* Framework: Rails 4.7.2
+* Database: SQLite
+* Database seeding from CSV import
+* HTML/CSS
+* Deployed on Heroku.
-## Baseline
-Before you start writing _any_ code:
+## Successes
+* We worked very well together, splitting up front-end and back-end work to avoid merge conflicts and maintain project velocity. We were able to break the project into micro tasks and checked in with each other frequently. Well-matched communications styles made this project especially enjoyable.
+* We created a mock login feature, redirecting to a "logged in" view from certain ingresses (we hadn't yet learned user authentication).
+* The layout and design turned out quite well (especially given that this was our second project with substantial HTML/CSS).
-- Review the requirements with your partner
-- Create a Trello board
- - Organize your tasks/stories
- - Discuss who will do which tasks and when you will target completion
- - What things should be done together as pairs vs individually?
- - Organize your tasks/stories into iterations (a.k.a waves)
-- Create a data diagram based on the original data [specification](https://github.com/Ada-C6/FarMar)
-
-Once the above is complete, this project:
-
-- requires a shared repo with your partner as a collaborator
-- requires you to create a Rails application
- - conform to Rails conventions on naming and inflection
- - by using `rails new .` you will create a new rails app _inside_ of the fork folder instead of creating a _new_ folder for your rails app
-
-**Your team shall submit a pull request with a link to your Trello board once you are done with the baseline which shall be reviewed before moving onto implementing the requirements**
-
-## Requirements
-However far you and your partner get, the application should have, at a minimum, the following features:
-- Seeded data in your database from the original CSV files
-- Multiple Active Record models
-- RESTful routing
-- Deployed application to Heroku
-- A "look and feel" that will make you and your partner happy!
-
-## User Stories
+## User Stories Implemented
### Overall
- As a user, when I visit "/", I can choose whether I want to act as a Market or a Vendor
- As a user, I can view all Markets
-- As a user, I can view a specific Market, viewing it's attributes as well as a list of it's vendors
+- As a user, I can view a specific Market, viewing its attributes as well as a list of its vendors
### Market
-- As a market, I can create or edit a Market
-- As a market, I can create, edit, or delete any Vendor
+- As a market, I can create or edit my Market
+- As a market, I can create, edit, or delete any Vendors
### Vendor
- As a vendor, I can create, edit, or delete my Products
- As a vendor, I can create a Sale for one of my Products
-- As a vendor, I can see a list of my Sales
-- As a vendor, I can see a total of all of my Sales
-- As a vendor, I can see a list of my Sales for the current month
-- As a vendor, I can see a total of my Sales for the current month
+
+### Admin
+- As an admin, I can add add Markets
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/images/Market-logo-black.png b/app/assets/images/Market-logo-black.png
new file mode 100644
index 00000000..6942c0f5
Binary files /dev/null and b/app/assets/images/Market-logo-black.png differ
diff --git a/app/assets/images/Market-logo-white.png b/app/assets/images/Market-logo-white.png
new file mode 100644
index 00000000..14f2ec09
Binary files /dev/null and b/app/assets/images/Market-logo-white.png differ
diff --git a/app/assets/images/Vendor-logo-black.png b/app/assets/images/Vendor-logo-black.png
new file mode 100644
index 00000000..ff8058ab
Binary files /dev/null and b/app/assets/images/Vendor-logo-black.png differ
diff --git a/app/assets/images/Vendor-logo-white.png b/app/assets/images/Vendor-logo-white.png
new file mode 100644
index 00000000..6bc666ee
Binary files /dev/null and b/app/assets/images/Vendor-logo-white.png differ
diff --git a/app/assets/images/admin.jpg b/app/assets/images/admin.jpg
new file mode 100644
index 00000000..0e5e4f53
Binary files /dev/null and b/app/assets/images/admin.jpg differ
diff --git a/app/assets/images/cabbage.jpg b/app/assets/images/cabbage.jpg
new file mode 100644
index 00000000..dc2a2831
Binary files /dev/null and b/app/assets/images/cabbage.jpg differ
diff --git a/app/assets/images/food-board.jpg b/app/assets/images/food-board.jpg
new file mode 100644
index 00000000..1cd5e893
Binary files /dev/null and b/app/assets/images/food-board.jpg differ
diff --git a/app/assets/images/market-banner.jpg b/app/assets/images/market-banner.jpg
new file mode 100644
index 00000000..47618cc7
Binary files /dev/null and b/app/assets/images/market-banner.jpg differ
diff --git a/app/assets/images/market-splash.jpg b/app/assets/images/market-splash.jpg
new file mode 100644
index 00000000..3259e8f5
Binary files /dev/null and b/app/assets/images/market-splash.jpg differ
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/pages.coffee b/app/assets/javascripts/pages.coffee
new file mode 100644
index 00000000..24f83d18
--- /dev/null
+++ b/app/assets/javascripts/pages.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..fd7d91ac
--- /dev/null
+++ b/app/assets/stylesheets/application.css
@@ -0,0 +1,689 @@
+/**********************************************/
+/******** GENERAL STYLING **************/
+/**********************************************/
+
+a:link,
+a:visited {
+ color: #000;
+ text-decoration: none;
+}
+
+a:hover {
+ color: #333333;
+}
+
+section.body {
+ padding: 10vw 0 0 0;
+ margin: 0 20vw 0 20vw;
+}
+
+.list-break {
+ border-bottom: 1px solid #d8d8d8;
+ height: 3vw;
+ margin: 0 0 3vw 0;
+}
+
+::-webkit-input-placeholder {
+ color: #585858;
+ font-weight: 300;
+}
+
+footer {
+ height: 10vw;
+}
+
+.space {
+ height: 2vw;
+}
+
+.sale-display {
+ margin: 0 12.5vw ;
+ width: 35vw;
+}
+
+
+/**********************************************/
+/********** NAVIGATION **************/
+/**********************************************/
+
+nav {
+ background-color: #FFF;
+ border: 1px solid transparent;
+ border-bottom: solid #d8d8d8 1px;
+ height: 5vw;
+ opacity: .8;
+ position: fixed;
+ width: 100vw;
+ z-index: 1;
+}
+
+nav p {
+ display: inline-block;
+ font: normal normal 1.6vw/1 'Playfair Display', sans-serif;
+ height: 1.6vw;
+ letter-spacing: .15em;
+ margin: 0 2vw;
+ padding: 1.7vw 0;
+ position: relative;
+ text-transform: uppercase;
+ width: 18.5vw;
+}
+
+nav ul {
+ float: right;
+ text-align: right;
+ width: 77vw;
+}
+
+nav ul li {
+ display: inline-block;
+ height: 1vw;
+ text-align: center;
+ padding: 2vw 0;
+}
+
+nav ul li a:hover {
+ background-color: #000;
+ color: #FFF;
+}
+
+nav ul li a {
+ border: transparent;
+ border-left: solid #d8d8d8 1px;
+ font: normal 300 1vw/1 'Lato', sans-serif;
+ letter-spacing: .1em;
+ padding: 2vw 3.5vw;
+ text-transform: uppercase;
+ width: 10vw;
+}
+
+
+
+
+
+/**********************************************/
+/******* FULL SCREEN IMAGES ***********/
+/**********************************************/
+
+.banner-image {
+ width: 100vw;
+}
+
+
+
+
+
+/**********************************************/
+/********** SEARCH FORMS ***********/
+/**********************************************/
+
+div.search {
+ position: fixed;
+ margin: 36vh 25vw;
+ width: 50vw;
+}
+
+div.search form:nth-of-type(2) {
+ margin: 5vh 0;
+}
+
+div.no-selector {
+ margin: 45vh 25vw;
+ z-index: 0;
+}
+
+div.search-low {
+ margin: 55vh 25vw;
+}
+
+div.search-high {
+ background-color: #fafafa;
+ border: solid #d8d8d8 1px;
+ margin: 0 auto 5vw;
+ position: relative;
+ z-index: 0;
+}
+
+div.search form {
+ background: rgba(255,255,255,0.7);
+ border: 1px solid transparent;
+ height: 4.25vw;
+}
+
+div.search input {
+ display: inline-block;
+ font: normal normal 1.5vw/1 'Lato', sans-serif;
+ margin: 1.125vw;
+ width: 38vw;
+}
+
+div.search ul.search-selector li {
+ display: inline-block;
+ margin: 0 .7vw 2vw 0;
+}
+
+div.search input.search-button,
+div.search ul.search-selector li a {
+ border: 1px solid transparent;
+ color: white;
+ font: normal normal 1.5vw/1 'Lato', sans-serif;
+ text-align: center;
+}
+
+div.search ul.search-selector li a {
+ background: rgba(255, 255, 255, .7);
+ border: solid #d8d8d8 1px;
+ padding: .75vw 1.75vw 1vw 1.75vw;
+}
+
+div.search ul.search-selector li a:link,
+div.search ul.search-selector li a:visited {
+ color: #000;
+}
+
+div.search ul.search-selector li a:hover,
+div.search ul.search-selector li.current a:hover {
+ background: #80b36e;
+ border: 1px solid transparent;
+}
+
+div.search ul.search-selector li.current a {
+ background-color: #61964f;
+ border: 1px solid transparent;
+ color: white;
+ opacity: 1;
+}
+
+div.search ul.search-selector li.current a:link,
+div.search ul.search-selector li.current a:visited {
+ color: #FFF;
+}
+
+div.search ul.search-selector li a:hover {
+ color: #FFF;
+}
+
+div.search input.search-button {
+ background-color: #da392a;
+ border-radius: .4vw;
+ float: right;
+ height: 3.25vw;
+ margin: .5vw;
+ text-align: center;
+ opacity: 1;
+ padding: .5vw;
+ width: 7vw;
+}
+
+
+
+
+/**********************************************/
+/****** COLORIZATION OF LOGIN BUTTONS *********/
+/**********************************************/
+
+div.search input.vendor{
+ background-color: #61964f;
+}
+
+div.search input.market {
+ background-color: #423d61;
+}
+
+
+
+
+
+/**********************************************/
+/****** SEARCH RESULTS *********/
+/**********************************************/
+
+p.error-message {
+ color: #da392a;
+ font: normal normal 2vw 'Lato', sans-serif;
+ margin: 8vw 0 0 0;
+ text-align: center;
+}
+
+
+
+
+
+/**********************************************/
+/****** SEE ALL BUTTONS *********/
+/**********************************************/
+
+div.see-all {
+ margin: 75vh 35vw;
+ position: fixed;
+ text-align: center;
+ width: 30vw;
+}
+
+div.see-all h5 {
+ font: normal 300 1.35vw/1 'Lato', sans-serif;
+ letter-spacing: .25em;
+ padding: 0 0 .5vw 0;
+}
+
+div.see-all ul li {
+ display: inline-block;
+}
+
+div.see-all ul li a {
+ background: rgba(255, 255, 255, .6);
+ border: 1px solid #d8d8d8;
+ border-radius: 100%;
+ color: #000;
+ display: inline-block;
+ font: normal normal 1.5vw/1 'Lato', sans-serif;
+ height: 1.5vw;
+ margin: 2vw 1.5vw 0 1.5vw;
+ padding: 1vw 1vw;
+ text-align: center;
+ width: 1.5vw;
+}
+
+div.see-all ul li a:link,
+div.see-all ul li a:visited {
+ color: #000;
+}
+
+div.see-all ul li a:hover {
+ background: rgba(255, 255, 255, .8);
+}
+
+
+
+
+
+/**********************************************/
+/********** HEADING TAGS ***********/
+/**********************************************/
+
+/* H3 Heading is used for Vendor or Market name in entity displays, available for similar*/
+div.entity-text h3 {
+ display: inline-block;
+ font: normal normal 1.75vw/1.75vw 'Josefin Sans', sans-serif;
+ letter-spacing: .15em;
+ text-transform: uppercase;
+}
+
+h3.large-dollar {
+ display: inline-block;
+ float: right;
+}
+
+/*H4 Heading is used for Vendor's Market text in entity displays, available for similar*/
+div.entity-text h4 {
+ font: normal 300 1vw/1.5 'Lato', sans-serif;
+ letter-spacing: .15em;
+ /*padding: .5vw 0 .5 0;*/
+ text-transform: uppercase;
+}
+
+h4 a:hover {
+ color: #dadada;
+}
+
+/*h5 Heading is used for Vendor descriptions*/
+h5{
+ color: #FFF;
+ font: normal 300 1.5vw/1 'Lato', sans-serif;
+ letter-spacing: .15em;
+ text-shadow: 2px 2px #404040;
+}
+
+
+
+
+
+
+/**********************************************/
+/********** ENTITY DISPLAYS ***********/
+/**********************************************/
+
+article.entity-display {
+ position: relative;
+}
+
+article.entity-display img {
+ border-radius: .5vw;
+ display: inline-block;
+ height: 15vw;
+ width: 15vw;
+}
+
+article.entity-display img.vendor {
+ background-color: #61964f;
+}
+
+article.entity-display img.market {
+ background-color: #423d61;
+}
+
+article.entity-display div.entity-text {
+ display: inline-block;
+ padding: 0 0 0 2vw;
+ vertical-align: top;
+ width: 40vw;
+}
+
+article.entity-display p {
+ font: normal 400 1vw/1 'Lato', sans-serif;
+ letter-spacing: .15em;
+ padding: 3vw 0 0 0;
+}
+
+article.entity-display ul.address-block li {
+ font: normal 300 1vw/1 'Lato', sans-serif;
+ letter-spacing: .15em;
+ padding: .5vw 0 0 0;
+ text-transform: uppercase;
+}
+
+article.entity-display ul.address-block li:first-of-type {
+ margin: 3vw 0 0 0;
+}
+
+article.entity-display button {
+ background-color: red;
+ height: 5vw;
+ width: 10vw;
+}
+
+
+
+
+
+/**********************************************/
+/********** TABLES ***********/
+/**********************************************/
+
+
+table th {
+ font: normal normal 1.3vw/1.3vw 'Josefin Sans', sans-serif;
+ letter-spacing: .15em;
+ padding: 0 0 2vw 0;
+ text-transform: uppercase;
+}
+
+table td {
+ font: normal 300 1vw/1vw 'Lato', sans-serif;
+ height: 2.5vw;
+ letter-spacing: .15em;
+ text-transform: uppercase;
+}
+
+
+
+
+/**********************************************/
+/********** TABLE AND FORM WIDTHS ***********/
+/**********************************************/
+
+.table17{
+ width: 17vw;
+}
+
+.table25 {
+ width: 24vw;
+}
+
+.table10 {
+ width: 7vw;
+}
+
+.table48 {
+ width: 48vw
+}
+
+.in-page-input-form li.form17 {
+ margin: 0 2vw 0 0 ;
+ width: calc(15vw - 6px);
+}
+
+.in-page-input-form li.form25 {
+ position: absolute;
+ margin: 0 2vw 0 17vw; ;
+ width: calc(22vw - 6px);
+}
+
+.in-page-input-form li.form10 {
+ position: absolute;
+ margin: 0 2vw 0 41vw ;
+ width: calc(6vw - 6px);
+}
+
+.in-page-input-form li.form48 {
+ position: absolute;
+ margin: 0 2vw 0 0 ;
+ width: calc(46vw - 6px);
+}
+
+
+
+/**********************************************/
+/********** BUTTONS???? ***********/
+/**********************************************/
+
+article.entity-display div.entity-buttons {
+ position: absolute;
+ top: 12.1vw;
+ left: 17vw;
+}
+
+.entity-buttons li {
+ display: inline-block;
+}
+
+.entity-buttons input {
+ border: 1px solid #000;
+ display: inline-block;
+ font: normal 400 .8vw/1 'Lato', sans-serif;
+ height: 3vw;
+ letter-spacing: .15em;
+ margin: 0 .25vw .5vw 0;
+ padding: .75vw 1.25vw;
+ text-transform: uppercase;
+ width: 11vw;
+}
+
+.entity-buttons input:hover {
+ color: #dadada;
+}
+
+.in-page-input-form .entity-buttons {
+ float: right;
+}
+
+.in-page-input-form {
+ margin: 2vw 0 0 0;
+ position: relative;
+}
+
+.in-page-input-form li {
+ background-color: #fafafa;
+ border: solid #d8d8d8 1px;
+ display: inline-block;
+ font: normal normal 1vw/1 'Lato', sans-serif;
+ height: 2.2vw;
+ padding: .8vw 0 0 1vw;
+ position: absolute;
+ top: 0;
+}
+
+textarea {
+ width: 21vw;
+}
+
+.table-button input {
+ border: 1px solid transparent;
+ border-radius: .25vw;
+ color: #FFF;
+ height: 2.5vw;
+ letter-spacing: .1em;
+ margin: 0 0 1vw 1vw;
+ padding: 0 1vw;
+ text-align: center;
+ /*width: 4.2vw;*/
+}
+
+.table-button.market input {
+ background-color: #423d61;
+}
+
+.table-button.vendor input {
+ background-color: #61964f;
+}
+
+.table-button.market input:hover {
+ background-color: #5b5385;
+}
+
+.table-button.vendor input:hover {
+ background-color: #74ac61;
+}
+
+
+form#new_market.new_market,
+section.stand-alone-form {
+ position: fixed;
+ margin: 10vw 24.5vw;
+}
+
+form#new_market.new_market input,
+section.stand-alone-form input,
+section.stand-alone-form select,
+section.top-of-page-form input,
+section.top-of-page-form select {
+ background-color: #FFF;
+ border: solid #d8d8d8 1px;
+ height: 4vw;
+ margin: 0 .5vw 1vw .5vw;
+ width: 15.125vw;
+ font: normal normal 1.5vw/1 'Lato', sans-serif;
+ padding: 0 0 0 1.125vw;
+}
+
+form#new_market.new_market input {
+ opacity: .8;
+}
+
+form#new_market.new_market input.name {
+ width: 50vw;
+}
+
+form#new_market.new_market input.search-button {
+ background-color: #da392a;
+ border: 1px solid transparent;
+ border-radius: .4vw;
+ color: #FFF;
+ height: 3.25vw;
+ margin: 1vw;
+ text-align: center;
+ text-transform: lowercase;
+ opacity: 1;
+ padding: .5vw;
+ width: 15.125vw;
+}
+
+
+section.stand-alone-form li label {
+ display: inline-block;
+ font: normal normal 1.5vw/1 'Lato', sans-serif;
+ width: 8vw;
+}
+
+section.stand-alone-form input {
+ width: 38vw;
+}
+
+section.stand-alone-form select {
+ border-radius: 0;
+ width: 39.25vw;
+}
+
+section.stand-alone-form input.search-button {
+ border-radius: .4vw;
+ color: #FFF;
+ margin: 2vw 12.5vw 12vw;
+ width: 25vw;
+}
+
+section.stand-alone-form.market input.search-button {
+ background-color: #423d61;
+}
+
+section.stand-alone-form.vendor input.search-button {
+ background-color: #61964f;
+}
+
+section.top-of-page-form {
+ font: normal normal 1.5vw/1 'Lato', sans-serif;
+ margin: 0 0 5vw 0;
+}
+
+section.top-of-page-form input {
+ height: 4vw;
+ margin: 0 0 0 0;
+ width: 16.3vw;
+}
+
+section.top-of-page-form select {
+ margin: 0 0 1vw 0;
+ width: 35vw;
+}
+
+section.top-of-page-form input.search-button {
+ background-color: #61964f;
+ border-radius: .4vw;
+ color: #FFF;
+ display: inline-block;
+ float: right;
+ height: 4vw;
+ padding: .5vw 1vw;
+ text-transform: lowercase;
+}
+
+section.top-of-page-form input,
+section.top-of-page-form select {
+ display: inline-block;
+}
+
+/**********************************************/
+/********** WHYYYYYY??? ***********/
+/**********************************************/
+
+/*form.button_to input,
+li.form-submit {
+
+}
+
+form.button_to input:hover,
+li.form-submit:hover {
+ color: #dadada;
+ font: normal 400 .8vw/1 'Lato', sans-serif;
+ letter-spacing: .15em;
+ text-transform: uppercase;
+}
+
+
+
+
+td.table-button form.button_to {
+ text-align: center;
+ margin: 0 0 1vw 1vw;
+ width: 4.5vw;
+}*/
+
+input#vendor_num_of_employees {
+ width: 8vw;
+}
+
+li.hide {
+ background-color: transparent;
+ border: transparent;
+ margin: none;
+ padding: none;
+}
diff --git a/app/assets/stylesheets/markets.scss b/app/assets/stylesheets/markets.scss
new file mode 100644
index 00000000..d357089c
--- /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/pages.scss b/app/assets/stylesheets/pages.scss
new file mode 100644
index 00000000..0d6878aa
--- /dev/null
+++ b/app/assets/stylesheets/pages.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the pages 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..89e2e8db
--- /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/reset.css b/app/assets/stylesheets/reset.css
new file mode 100644
index 00000000..12db26db
--- /dev/null
+++ b/app/assets/stylesheets/reset.css
@@ -0,0 +1,56 @@
+/*
+Theme Name:
+Theme URI:
+Description:
+Version: 1.0
+Author:
+Author URI:
+*/
+
+/* reset styles */
+html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp,
+small, strike, strong, sub, sup, tt, var, b, u, i, center,
+dl, dt, dd, ol, ul, li, fieldset, form, label, legend,
+table, caption, tbody, tfoot, thead, tr, th, td, textarea {
+ margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%;
+ vertical-align: baseline; background: transparent;
+}
+body { line-height: 1; }
+ol, ul { list-style: none; }
+blockquote, q { quotes: none; }
+blockquote:before, blockquote:after, q:before, q:after { content: ''; }
+:focus { outline: 0; }
+ins { text-decoration: none; }
+del { text-decoration: line-through; }
+table { border-collapse: collapse; border-spacing: 0; }
+
+body {
+ font-size: 1vw;
+ text-align: left;
+ color: #000000;
+}
+
+input {
+ font-size: 100%;
+ background-color: transparent;
+ border: transparent;
+ cursor: pointer;
+ overflow: hidden;
+}
+
+/* container - place inside each section or around the entire page depending on your layout */
+.container {
+ width: 960px;
+ margin: 0 auto;
+ text-align: left;
+ position: relative;
+}
+
+/* for clearing any floats
*/
+.clearfloat {
+ clear:both;
+ height:0;
+ font-size: 1px;
+ line-height: 0px;
+}
diff --git a/app/assets/stylesheets/sales.scss b/app/assets/stylesheets/sales.scss
new file mode 100644
index 00000000..6f3405b9
--- /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..1ca74408
--- /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..423b52c1
--- /dev/null
+++ b/app/controllers/application_controller.rb
@@ -0,0 +1,11 @@
+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
+
+ def set_search
+ @search_market = Market.search(params[:q])
+ @search_vendor = Vendor.search(params[:q])
+ @search_product = Product.search(params[:q])
+ end
+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..5ed65bd7
--- /dev/null
+++ b/app/controllers/markets_controller.rb
@@ -0,0 +1,83 @@
+class MarketsController < ApplicationController
+ before_filter :set_search
+
+ def index
+ if params[:commit] == "search"
+ if !params[:q].blank?
+ @results = Market.search(params[:q])
+ else
+ @results = Market.search({:id_eq => 0})
+ end
+
+ @markets = @results.result
+
+ else
+ @markets = Market.all
+ end
+
+ end
+
+ def all
+ @markets = Market.all
+ end
+
+ def show
+ find
+
+ @vendor = Vendor.new
+ end
+
+ def guest_show
+ find
+ end
+
+ def new
+ @market = Market.new
+ end
+
+ def create
+ @market = Market.new
+
+ @market.name = params[:market][:name]
+ @market.address = params[:market][:address]
+ @market.city = params[:market][:city]
+ @market.county = params[:market][:county]
+ @market.state = params[:market][:state]
+ @market.zip = params[:market][:zip]
+
+ @market.save
+
+ redirect_to action: 'show', id: @market.id
+ end
+
+ def edit
+ find
+ end
+
+ def update
+ find
+
+ @market.name = params[:market][:name]
+ @market.address = params[:market][:address]
+ @market.city = params[:market][:city]
+ @market.county = params[:market][:county]
+ @market.state = params[:market][:state]
+ @market.zip = params[:market][:zip]
+
+ @market.save
+
+ redirect_to action: 'show', id: @market.id
+ end
+
+ def destroy
+ find
+ @market.destroy
+
+ redirect_to markets_url
+ end
+
+ private
+ def find
+ @market = Market.find(params[:id].to_i)
+ end
+end
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
new file mode 100644
index 00000000..41358d0c
--- /dev/null
+++ b/app/controllers/pages_controller.rb
@@ -0,0 +1,57 @@
+class PagesController < ApplicationController
+ before_filter :set_search
+
+ def home
+ end
+
+ def admin
+ @market = Market.new
+ end
+
+ def market
+ @id = 10
+ end
+
+ def default_market_login
+ if !Market.exists?(id: params[:market][:id].to_i)
+ redirect_to @redirect
+ else
+ @id = params[:market][:id].to_i
+ redirect_to controller: 'markets', action: 'show', id: @id
+ end
+ end
+
+ def admin_market_login
+ @redirect = '/admin'
+ default_market_login
+ end
+
+ def market_login
+ @redirect = '/market'
+ default_market_login
+ end
+
+ def vendor
+ @id = 10
+ end
+
+ def default_vendor_login
+ if !Vendor.exists?(id: params[:vendor][:id].to_i)
+ redirect_to @redirect
+ else
+ @id = params[:vendor][:id].to_i
+ redirect_to controller: 'vendors', action: 'show', id: @id
+ end
+ end
+
+ def vendor_login
+ @redirect = '/vendor'
+ default_vendor_login
+ end
+
+ def admin_vendor_login
+ @redirect = '/admin'
+ default_vendor_login
+ end
+
+end
diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb
new file mode 100644
index 00000000..bcdbdc6a
--- /dev/null
+++ b/app/controllers/products_controller.rb
@@ -0,0 +1,64 @@
+class ProductsController < ApplicationController
+ before_filter :set_search
+
+ def index
+ if params[:commit] == "search"
+ if !params[:q].blank?
+ @results = Product.search(params[:q])
+ else
+ @results = Product.search({:id_eq => 0})
+ end
+
+ @products = @results.result
+
+ else
+ @products = Product.all
+ end
+ end
+
+ def show
+ find
+ end
+
+ def new
+ @product = Product.new
+ end
+
+ def create
+ @product = Product.new
+
+ @product.name = params[:product][:name]
+ @product.vendor_id = params[:product][:vendor_id]
+
+ @product.save
+
+ redirect_to controller: 'vendors', action: 'show', id: @product.vendor.id
+ end
+
+ def edit
+ find
+ end
+
+ def update
+ find
+
+ @product.name = params[:product][:name]
+ @product.vendor_id = params[:product][:vendor_id]
+
+ @product.save
+
+ redirect_to controller: 'vendors', action: 'show', id: @product.vendor.id
+ end
+
+ def destroy
+ find
+ @product.destroy
+
+ redirect_to controller: 'vendors', action: 'show', id: @product.vendor.id
+ end
+
+ private
+ def find
+ @product = Product.find(params[:id].to_i)
+ end
+end
diff --git a/app/controllers/sales_controller.rb b/app/controllers/sales_controller.rb
new file mode 100644
index 00000000..b1978463
--- /dev/null
+++ b/app/controllers/sales_controller.rb
@@ -0,0 +1,59 @@
+class SalesController < ApplicationController
+ def index
+ @sales = Sale.all
+ end
+
+ def show
+ find
+ end
+
+ def new
+ @sale = Sale.new
+
+ url = request.referrer
+ numbers = url.scan(/\d+/)
+ @id = numbers.last.to_i
+ end
+
+ def create
+ @sale = Sale.new
+
+ @sale.amount = params[:sale][:amount]
+ @sale.purchase_time = params[:sale][:purchase_time]
+ @sale.vendor_id = params[:sale][:vendor_id]
+ @sale.product_id = params[:sale][:product_id]
+
+ @sale.save
+
+ redirect_to controller: 'vendors', action: 'show_sales', id: @sale.vendor.id
+ end
+
+ def edit
+ find
+ end
+
+ def update
+ find
+
+ @sale.amount = params[:sale][:amount]
+ @sale.purchase_time = params[:sale][:purchase_time]
+ @sale.vendor_id = params[:sale][:vendor_id]
+ @sale.product_id = params[:sale][:product_id]
+ @sale.save
+
+ redirect_to controller: 'vendors', action: 'show_sales', id: @sale.vendor.id
+ end
+
+ def destroy
+ find
+
+ @sale.destroy
+
+ redirect_to controller: 'vendors', action: 'show_sales', id: @sale.vendor.id
+ end
+
+ private
+ def find
+ @sale = Sale.find(params[:id].to_i)
+ end
+end
diff --git a/app/controllers/vendors_controller.rb b/app/controllers/vendors_controller.rb
new file mode 100644
index 00000000..43a6e72e
--- /dev/null
+++ b/app/controllers/vendors_controller.rb
@@ -0,0 +1,103 @@
+class VendorsController < ApplicationController
+ before_filter :set_search
+
+ def index
+ if params[:commit] == "search"
+ if !params[:q].blank?
+ @results = Vendor.search(params[:q])
+ else
+ @results = Vendor.search({:id_eq => 0})
+ end
+
+ @vendors = @results.result
+
+ else
+ @vendors = Vendor.all
+ end
+ end
+
+ def all
+ @vendors = Vendor.all
+ end
+
+ def show
+ find
+
+ @product = Product.new
+ end
+
+ def guest_show
+ find
+ end
+
+ def show_sales
+ find
+
+ @sale = Sale.new
+
+ total_sales
+ end
+
+ def total_sales
+ find
+
+ @all_sales = @vendor.sales
+
+ @cents = 0
+
+ @all_sales.each do |sale|
+ if !sale.amount.nil?
+ @cents += sale.amount
+ end
+ end
+
+ @total = "$#{'%.2f' % (@cents.to_i/100.0)}"
+
+ end
+
+ def new
+ @vendor = Vendor.new
+ end
+
+ def create
+ @vendor = Vendor.new
+
+ @vendor.name = params[:vendor][:name]
+ @vendor.description = params[:vendor][:description]
+ @vendor.num_of_employees = params[:vendor][:num_of_employees]
+ @vendor.market_id = params[:vendor][:market_id]
+ @vendor.save
+
+ redirect_to action: 'show', id: @vendor.id
+ end
+
+ def edit
+ find
+ end
+
+ def update
+ find
+
+ @vendor.name = params[:vendor][:name]
+ @vendor.description = params[:vendor][:description]
+ @vendor.num_of_employees = params[:vendor][:num_of_employees]
+ @vendor.market_id = params[:vendor][:market_id]
+
+ @vendor.save
+
+ redirect_to action: 'show', id: @vendor.id
+ end
+
+ def destroy
+ find
+
+ @vendor.destroy
+
+ redirect_to controller: 'markets', action: 'show', id: @vendor.market.id
+ end
+
+ private
+ def find
+ @vendor = Vendor.find(params[:id].to_i)
+ end
+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/pages_helper.rb b/app/helpers/pages_helper.rb
new file mode 100644
index 00000000..2c057fd0
--- /dev/null
+++ b/app/helpers/pages_helper.rb
@@ -0,0 +1,2 @@
+module PagesHelper
+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..851b47dc
--- /dev/null
+++ b/app/models/market.rb
@@ -0,0 +1,4 @@
+class Market < ActiveRecord::Base
+ has_many :vendors
+
+end
diff --git a/app/models/product.rb b/app/models/product.rb
new file mode 100644
index 00000000..86f8d94b
--- /dev/null
+++ b/app/models/product.rb
@@ -0,0 +1,4 @@
+class Product < ActiveRecord::Base
+ belongs_to :vendor
+ has_many :sales
+end
diff --git a/app/models/sale.rb b/app/models/sale.rb
new file mode 100644
index 00000000..7142a28c
--- /dev/null
+++ b/app/models/sale.rb
@@ -0,0 +1,4 @@
+class Sale < ActiveRecord::Base
+ belongs_to :vendor
+ belongs_to :product
+end
diff --git a/app/models/vendor.rb b/app/models/vendor.rb
new file mode 100644
index 00000000..3d7bd3f7
--- /dev/null
+++ b/app/models/vendor.rb
@@ -0,0 +1,5 @@
+class Vendor < ActiveRecord::Base
+ belongs_to :market
+ has_many :sales
+ has_many :products
+end
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
new file mode 100644
index 00000000..391adcec
--- /dev/null
+++ b/app/views/layouts/application.html.erb
@@ -0,0 +1,30 @@
+
+
+
Find me in app/views/markets/create.html.erb
diff --git a/app/views/markets/destroy.html.erb b/app/views/markets/destroy.html.erb new file mode 100644 index 00000000..1b2f7811 --- /dev/null +++ b/app/views/markets/destroy.html.erb @@ -0,0 +1,2 @@ +Find me in app/views/markets/destroy.html.erb
diff --git a/app/views/markets/edit.html.erb b/app/views/markets/edit.html.erb new file mode 100644 index 00000000..23997ae1 --- /dev/null +++ b/app/views/markets/edit.html.erb @@ -0,0 +1 @@ +<%= render partial: 'form' %> diff --git a/app/views/markets/guest_show.html.erb b/app/views/markets/guest_show.html.erb new file mode 100644 index 00000000..b939849d --- /dev/null +++ b/app/views/markets/guest_show.html.erb @@ -0,0 +1,43 @@ +Vendors | +Description | +Staff | ++ | + |
---|---|---|---|---|
+ <%= link_to vendor.name, {controller: 'vendors', action: 'guest_show', id: vendor.id}, method: :get %> + | ++ <%= vendor.description %> + | ++ <%= vendor.num_of_employees %> + | +
Vendors | +Description | +Staff | ++ | + |
---|---|---|---|---|
+ <%= link_to vendor.name, {controller: 'vendors', action: 'show', id: vendor.id}, method: :get %> + | ++ <%= vendor.description %> + | ++ <%= vendor.num_of_employees %> + | ++ <%= button_to "edit", {controller: 'vendors', action: 'edit', id: vendor.id}, method: :get %> + | ++ <%= button_to "delete", {controller: 'vendors', action: 'destroy', id: vendor.id}, method: :delete, data: {confirm: "Are you sure you want to delete this?"}%> + | +
Find me in app/views/markets/update.html.erb
diff --git a/app/views/pages/_see_all.html.erb b/app/views/pages/_see_all.html.erb new file mode 100644 index 00000000..b8b3217c --- /dev/null +++ b/app/views/pages/_see_all.html.erb @@ -0,0 +1,11 @@ + diff --git a/app/views/pages/admin.html.erb b/app/views/pages/admin.html.erb new file mode 100644 index 00000000..d8ae45a3 --- /dev/null +++ b/app/views/pages/admin.html.erb @@ -0,0 +1,23 @@ +Find me in app/views/products/create.html.erb
diff --git a/app/views/products/destroy.html.erb b/app/views/products/destroy.html.erb new file mode 100644 index 00000000..d5c678b4 --- /dev/null +++ b/app/views/products/destroy.html.erb @@ -0,0 +1,2 @@ +Find me in app/views/products/destroy.html.erb
diff --git a/app/views/products/edit.html.erb b/app/views/products/edit.html.erb new file mode 100644 index 00000000..77402663 --- /dev/null +++ b/app/views/products/edit.html.erb @@ -0,0 +1,3 @@ ++ <%= @product.id %> + <%= @product.name %> + <%= @product.vendor_id %> +
diff --git a/app/views/products/update.html.erb b/app/views/products/update.html.erb new file mode 100644 index 00000000..039889ac --- /dev/null +++ b/app/views/products/update.html.erb @@ -0,0 +1,2 @@ +Find me in app/views/products/update.html.erb
diff --git a/app/views/sales/_form.html.erb b/app/views/sales/_form.html.erb new file mode 100644 index 00000000..e022ff49 --- /dev/null +++ b/app/views/sales/_form.html.erb @@ -0,0 +1,25 @@ +Find me in app/views/sales/create.html.erb
diff --git a/app/views/sales/destroy.html.erb b/app/views/sales/destroy.html.erb new file mode 100644 index 00000000..1329e1e0 --- /dev/null +++ b/app/views/sales/destroy.html.erb @@ -0,0 +1,2 @@ +Find me in app/views/sales/destroy.html.erb
diff --git a/app/views/sales/edit.html.erb b/app/views/sales/edit.html.erb new file mode 100644 index 00000000..2a74f679 --- /dev/null +++ b/app/views/sales/edit.html.erb @@ -0,0 +1,4 @@ +Find me in app/views/sales/show.html.erb
diff --git a/app/views/sales/update.html.erb b/app/views/sales/update.html.erb new file mode 100644 index 00000000..8c3e653e --- /dev/null +++ b/app/views/sales/update.html.erb @@ -0,0 +1,2 @@ +Find me in app/views/sales/update.html.erb
diff --git a/app/views/vendors/_form.html.erb b/app/views/vendors/_form.html.erb new file mode 100644 index 00000000..9bab1c80 --- /dev/null +++ b/app/views/vendors/_form.html.erb @@ -0,0 +1,24 @@ +Find me in app/views/vendors/create.html.erb
diff --git a/app/views/vendors/destroy.html.erb b/app/views/vendors/destroy.html.erb new file mode 100644 index 00000000..5338358f --- /dev/null +++ b/app/views/vendors/destroy.html.erb @@ -0,0 +1,2 @@ +Find me in app/views/vendors/destroy.html.erb
diff --git a/app/views/vendors/edit.html.erb b/app/views/vendors/edit.html.erb new file mode 100644 index 00000000..23997ae1 --- /dev/null +++ b/app/views/vendors/edit.html.erb @@ -0,0 +1 @@ +<%= render partial: 'form' %> diff --git a/app/views/vendors/guest_show.html.erb b/app/views/vendors/guest_show.html.erb new file mode 100644 index 00000000..ab14f656 --- /dev/null +++ b/app/views/vendors/guest_show.html.erb @@ -0,0 +1,32 @@ +Description: <%= @vendor.description %>
+Products | ++ | + |
---|---|---|
+ <%= product.name %> + | +
Description: <%= vendor.description %>
+Description: <%= @vendor.description %>
+ +Products | ++ | + |
---|---|---|
+ <%= product.name %> + | ++ <%= button_to "Edit", {controller: 'products', action: 'edit', id: product.id}, method: :get %> + | ++ <%= button_to "Delete", {controller: 'products', action: 'destroy', id: product.id}, method: :delete, data: {confirm: "Are you sure you want to delete this?"} %> + | +
Find me in app/views/vendors/update.html.erb
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..9bc076b9 --- /dev/null +++ b/bin/spring @@ -0,0 +1,16 @@ +#!/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' + + lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) + if spring = lockfile.specs.detect { |spec| spec.name == "spring" } + Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path + gem 'spring', spring.version + 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..10a93ddf --- /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 = 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 + + # `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..286ca119 --- /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' +Rails.application.config.assets.precompile += %w( reset.css ) +# 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..6721f918 --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,93 @@ +Rails.application.routes.draw do + + root to: 'pages#home' + + get '/markets/:id/show', to: 'markets#guest_show' + + get '/vendors/:id/show', to: 'vendors#guest_show' + + get '/markets/all', to: 'markets#all', as: 'markets_all' + + get '/vendor_search', to: 'pages#vendor_search', as: 'vendor_search' + + get '/product_search', to: 'pages#product_search', as: 'product_search' + + get '/market_search', to: 'pages#market_search', as: 'market_search' + + get '/vendor_login', to: 'pages#vendor_login' + + get '/market_login', to: 'pages#market_login' + + get '/admin_market_login', to: 'pages#admin_market_login' + + get '/admin_vendor_login', to: 'pages#admin_vendor_login' + + post '/admin', to: "markets#create" + + get 'vendors/:id/sales', to: 'vendors#show_sales', as: 'show_sales' + + resources :markets, :vendors, :products, :sales + + get '/home', to: 'pages#home' + + get '/admin', to: 'pages#admin' + + get '/vendor', to: 'pages#vendor' + + get '/market', to: 'pages#market' + + # 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..a228b9b4 --- /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: f1343eb8a930c321ec3b906995adae008ab91276c56a01c4113d89d9edbcdc405bf9c15f6989a594b97cda0f6bb889ac478ed60cfc369e9f77be6c74f4c7256a + +test: + secret_key_base: 43be333a152ebecedeeae236fdeda0a2f3856263d539b8878fbc767174fa039b67df7b3ee9f19b652816f4a667426a97a3fa087dd99bc8f9ce40dabcd44eb1c2 + +# 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/20161004224029_create_markets.rb b/db/migrate/20161004224029_create_markets.rb new file mode 100644 index 00000000..735d3e11 --- /dev/null +++ b/db/migrate/20161004224029_create_markets.rb @@ -0,0 +1,14 @@ +class CreateMarkets < ActiveRecord::Migration + def change + create_table :markets do |t| + t.string :name + t.string :address + t.string :city + t.string :county + t.string :state + t.integer :zip + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20161004225233_create_vendors.rb b/db/migrate/20161004225233_create_vendors.rb new file mode 100644 index 00000000..1ea9b774 --- /dev/null +++ b/db/migrate/20161004225233_create_vendors.rb @@ -0,0 +1,12 @@ +class CreateVendors < ActiveRecord::Migration + def change + create_table :vendors do |t| + t.string :name + t.text :description + t.integer :num_of_employees + t.integer :market_id + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20161004225331_create_products.rb b/db/migrate/20161004225331_create_products.rb new file mode 100644 index 00000000..b683e018 --- /dev/null +++ b/db/migrate/20161004225331_create_products.rb @@ -0,0 +1,10 @@ +class CreateProducts < ActiveRecord::Migration + def change + create_table :products do |t| + t.string :name + t.integer :vendor_id + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20161004225433_create_sales.rb b/db/migrate/20161004225433_create_sales.rb new file mode 100644 index 00000000..6d4e2ea9 --- /dev/null +++ b/db/migrate/20161004225433_create_sales.rb @@ -0,0 +1,12 @@ +class CreateSales < ActiveRecord::Migration + def change + create_table :sales do |t| + 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/20161004231127_change_zipto_string.rb b/db/migrate/20161004231127_change_zipto_string.rb new file mode 100644 index 00000000..bfd30593 --- /dev/null +++ b/db/migrate/20161004231127_change_zipto_string.rb @@ -0,0 +1,5 @@ +class ChangeZiptoString < ActiveRecord::Migration + def change + change_column :markets, :zip, :string + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 00000000..54fd8659 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,52 @@ +# 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: 20161004231127) do + + create_table "markets", force: :cascade do |t| + t.string "name" + t.string "address" + t.string "city" + t.string "county" + t.string "state" + t.string "zip" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "products", force: :cascade do |t| + t.string "name" + t.integer "vendor_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "sales", force: :cascade do |t| + t.integer "amount" + t.datetime "purchase_time" + t.integer "vendor_id" + t.integer "product_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "vendors", force: :cascade do |t| + t.string "name" + t.text "description" + t.integer "num_of_employees" + t.integer "market_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + +end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 00000000..6ab6f592 --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,31 @@ +# 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) + +require 'csv' + +CSV.foreach('seed_csvs/markets.csv', :headers => false) do |market| + zip = market[6] + if zip.nil? + elsif zip.length == 4 + zip = "0#{zip}" + end + + Market.create(name: market[1], address: market[2], city: market[3], county: market[4], state: market[5], zip: zip) +end + +CSV.foreach('seed_csvs/vendors.csv', :headers => false) do |vendor| + Vendor.create(name: vendor[1], num_of_employees: vendor[2].to_i, market_id: vendor[3].to_i) +end + +CSV.foreach('seed_csvs/sales.csv', :headers => false) do |sale| + Sale.create(amount: sale[1].to_i, purchase_time: DateTime.parse(sale[2]), vendor_id: sale[3].to_i, product_id: sale[4].to_i) +end + +CSV.foreach('seed_csvs/products.csv', :headers => false) do |product| + Product.create(name: product[1], vendor_id: product[2].to_i) +end 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 @@ + + + +You may have mistyped the address or the page may have moved.
+If you are the application owner check the logs for more information.
+Maybe you tried to change something you didn't have access to.
+If you are the application owner check the logs for more information.
+If you are the application owner check the logs for more information.
+