diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000000..1855c69cc2
Binary files /dev/null and b/.DS_Store differ
diff --git a/.browserslistrc b/.browserslistrc
new file mode 100644
index 0000000000..e94f8140cc
--- /dev/null
+++ b/.browserslistrc
@@ -0,0 +1 @@
+defaults
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..7d28bd212a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,39 @@
+# 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 all logfiles and tempfiles.
+/log/*
+/tmp/*
+!/log/.keep
+!/tmp/.keep
+
+# Ignore pidfiles, but keep the directory.
+/tmp/pids/*
+!/tmp/pids/
+!/tmp/pids/.keep
+
+# Ignore uploaded files in development.
+/storage/*
+!/storage/.keep
+
+/public/assets
+.byebug_history
+
+# Ignore master key for decrypting credentials and more.
+/config/master.key
+
+/public/packs
+/public/packs-test
+/node_modules
+/yarn-error.log
+yarn-debug.log*
+.yarn-integrity
+.env
+/coverage/*
+/coverage
diff --git a/.ruby-version b/.ruby-version
new file mode 100644
index 0000000000..57cf282ebb
--- /dev/null
+++ b/.ruby-version
@@ -0,0 +1 @@
+2.6.5
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000000..9098290d09
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,84 @@
+source "https://rubygems.org"
+git_source(:github) { |repo| "https://github.com/#{repo}.git" }
+
+ruby "2.6.5"
+
+# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
+gem "rails", "~> 6.0.3", ">= 6.0.3.1"
+# Use postgresql as the database for Active Record
+gem "pg", ">= 0.18", "< 2.0"
+# Use Puma as the app server
+gem "puma", "~> 4.1"
+# Use SCSS for stylesheets
+gem "sass-rails", ">= 6"
+# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
+gem "webpacker", "~> 4.0"
+# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
+gem "turbolinks", "~> 5"
+# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
+gem "jbuilder", "~> 2.7"
+# Use Redis adapter to run Action Cable in production
+# gem 'redis', '~> 4.0'
+# Use Active Model has_secure_password
+# gem 'bcrypt', '~> 3.1.7'
+
+# Use Active Storage variant
+# gem 'image_processing', '~> 1.2'
+
+# Reduces boot times through caching; required in config/boot.rb
+gem "bootsnap", ">= 1.4.2", require: false
+
+group :development, :test do
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
+ gem "byebug", platforms: [:mri, :mingw, :x64_mingw]
+ gem "dotenv-rails"
+end
+
+group :development do
+ # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
+ gem "web-console", ">= 3.3.0"
+ gem "listen", "~> 3.2"
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
+ gem "spring"
+ gem "spring-watcher-listen", "~> 2.0.0"
+end
+
+group :test do
+ # Adds support for Capybara system testing and selenium driver
+ gem "capybara", ">= 2.15"
+ gem "selenium-webdriver"
+ # Easy installation and use of web drivers to run system tests with browsers
+ gem "webdrivers"
+end
+
+# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
+gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
+
+gem "jquery-rails"
+gem "jquery-turbolinks"
+gem "bootstrap"
+group :development, :test do
+ gem "pry-rails"
+end
+
+group :development do
+ gem "guard"
+ gem "guard-minitest"
+ gem "debase", ">= 0.2.4.1"
+ gem "ruby-debug-ide", ">= 0.7.0"
+end
+
+group :development do
+ gem "better_errors"
+ gem "binding_of_caller"
+end
+
+group :test do
+ gem "minitest-rails"
+ gem "minitest-reporters"
+end
+
+gem "omniauth"
+gem "omniauth-github"
+
+gem "simplecov", require: false, group: :test
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 0000000000..1db23201fe
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,368 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actioncable (6.0.3.1)
+ actionpack (= 6.0.3.1)
+ nio4r (~> 2.0)
+ websocket-driver (>= 0.6.1)
+ actionmailbox (6.0.3.1)
+ actionpack (= 6.0.3.1)
+ activejob (= 6.0.3.1)
+ activerecord (= 6.0.3.1)
+ activestorage (= 6.0.3.1)
+ activesupport (= 6.0.3.1)
+ mail (>= 2.7.1)
+ actionmailer (6.0.3.1)
+ actionpack (= 6.0.3.1)
+ actionview (= 6.0.3.1)
+ activejob (= 6.0.3.1)
+ mail (~> 2.5, >= 2.5.4)
+ rails-dom-testing (~> 2.0)
+ actionpack (6.0.3.1)
+ actionview (= 6.0.3.1)
+ activesupport (= 6.0.3.1)
+ rack (~> 2.0, >= 2.0.8)
+ rack-test (>= 0.6.3)
+ rails-dom-testing (~> 2.0)
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
+ actiontext (6.0.3.1)
+ actionpack (= 6.0.3.1)
+ activerecord (= 6.0.3.1)
+ activestorage (= 6.0.3.1)
+ activesupport (= 6.0.3.1)
+ nokogiri (>= 1.8.5)
+ actionview (6.0.3.1)
+ activesupport (= 6.0.3.1)
+ builder (~> 3.1)
+ erubi (~> 1.4)
+ rails-dom-testing (~> 2.0)
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
+ activejob (6.0.3.1)
+ activesupport (= 6.0.3.1)
+ globalid (>= 0.3.6)
+ activemodel (6.0.3.1)
+ activesupport (= 6.0.3.1)
+ activerecord (6.0.3.1)
+ activemodel (= 6.0.3.1)
+ activesupport (= 6.0.3.1)
+ activestorage (6.0.3.1)
+ actionpack (= 6.0.3.1)
+ activejob (= 6.0.3.1)
+ activerecord (= 6.0.3.1)
+ marcel (~> 0.3.1)
+ activesupport (6.0.3.1)
+ concurrent-ruby (~> 1.0, >= 1.0.2)
+ i18n (>= 0.7, < 2)
+ minitest (~> 5.1)
+ tzinfo (~> 1.1)
+ zeitwerk (~> 2.2, >= 2.2.2)
+ addressable (2.7.0)
+ public_suffix (>= 2.0.2, < 5.0)
+ ansi (1.5.0)
+ autoprefixer-rails (9.7.6)
+ execjs
+ better_errors (2.7.1)
+ coderay (>= 1.0.0)
+ erubi (>= 1.0.0)
+ rack (>= 0.9.0)
+ bindex (0.8.1)
+ binding_of_caller (0.8.0)
+ debug_inspector (>= 0.0.1)
+ bootsnap (1.4.6)
+ msgpack (~> 1.0)
+ bootsnap (1.4.6-java)
+ msgpack (~> 1.0)
+ bootstrap (4.5.0)
+ autoprefixer-rails (>= 9.1.0)
+ popper_js (>= 1.14.3, < 2)
+ sassc-rails (>= 2.0.0)
+ builder (3.2.4)
+ byebug (11.1.3)
+ capybara (3.32.2)
+ addressable
+ mini_mime (>= 0.1.3)
+ nokogiri (~> 1.8)
+ rack (>= 1.6.0)
+ rack-test (>= 0.6.3)
+ regexp_parser (~> 1.5)
+ xpath (~> 3.2)
+ childprocess (3.0.0)
+ coderay (1.1.3)
+ concurrent-ruby (1.1.6)
+ crass (1.0.6)
+ debase (0.2.4.1)
+ debase-ruby_core_source (>= 0.10.2)
+ debase-ruby_core_source (0.10.9)
+ debug_inspector (0.0.3)
+ docile (1.3.2)
+ dotenv (2.7.5)
+ dotenv-rails (2.7.5)
+ dotenv (= 2.7.5)
+ railties (>= 3.2, < 6.1)
+ erubi (1.9.0)
+ execjs (2.7.0)
+ faraday (1.0.1)
+ multipart-post (>= 1.2, < 3)
+ ffi (1.13.1)
+ ffi (1.13.1-java)
+ ffi (1.13.1-x64-mingw32)
+ ffi (1.13.1-x86-mingw32)
+ formatador (0.2.5)
+ globalid (0.4.2)
+ activesupport (>= 4.2.0)
+ guard (2.16.2)
+ formatador (>= 0.2.4)
+ listen (>= 2.7, < 4.0)
+ lumberjack (>= 1.0.12, < 2.0)
+ nenv (~> 0.1)
+ notiffany (~> 0.0)
+ pry (>= 0.9.12)
+ shellany (~> 0.0)
+ thor (>= 0.18.1)
+ guard-compat (1.2.1)
+ guard-minitest (2.4.6)
+ guard-compat (~> 1.2)
+ minitest (>= 3.0)
+ hashie (4.1.0)
+ i18n (1.8.3)
+ concurrent-ruby (~> 1.0)
+ jbuilder (2.10.0)
+ activesupport (>= 5.0.0)
+ jquery-rails (4.4.0)
+ rails-dom-testing (>= 1, < 3)
+ railties (>= 4.2.0)
+ thor (>= 0.14, < 2.0)
+ jquery-turbolinks (2.1.0)
+ railties (>= 3.1.0)
+ turbolinks
+ jwt (2.2.1)
+ listen (3.2.1)
+ rb-fsevent (~> 0.10, >= 0.10.3)
+ rb-inotify (~> 0.9, >= 0.9.10)
+ loofah (2.5.0)
+ crass (~> 1.0.2)
+ nokogiri (>= 1.5.9)
+ lumberjack (1.2.5)
+ mail (2.7.1)
+ mini_mime (>= 0.1.1)
+ marcel (0.3.3)
+ mimemagic (~> 0.3.2)
+ method_source (1.0.0)
+ mimemagic (0.3.5)
+ mini_mime (1.0.2)
+ mini_portile2 (2.4.0)
+ minitest (5.14.1)
+ minitest-rails (6.0.1)
+ minitest (~> 5.10)
+ railties (~> 6.0.0)
+ minitest-reporters (1.4.2)
+ ansi
+ builder
+ minitest (>= 5.0)
+ ruby-progressbar
+ msgpack (1.3.3)
+ msgpack (1.3.3-java)
+ msgpack (1.3.3-x64-mingw32)
+ msgpack (1.3.3-x86-mingw32)
+ multi_json (1.14.1)
+ multi_xml (0.6.0)
+ multipart-post (2.1.1)
+ nenv (0.3.0)
+ nio4r (2.5.2)
+ nio4r (2.5.2-java)
+ nokogiri (1.10.9)
+ mini_portile2 (~> 2.4.0)
+ nokogiri (1.10.9-java)
+ nokogiri (1.10.9-x64-mingw32)
+ mini_portile2 (~> 2.4.0)
+ nokogiri (1.10.9-x86-mingw32)
+ mini_portile2 (~> 2.4.0)
+ notiffany (0.1.3)
+ nenv (~> 0.1)
+ shellany (~> 0.0)
+ oauth2 (1.4.4)
+ faraday (>= 0.8, < 2.0)
+ jwt (>= 1.0, < 3.0)
+ multi_json (~> 1.3)
+ multi_xml (~> 0.5)
+ rack (>= 1.2, < 3)
+ omniauth (1.9.1)
+ hashie (>= 3.4.6)
+ rack (>= 1.6.2, < 3)
+ omniauth-github (1.4.0)
+ omniauth (~> 1.5)
+ omniauth-oauth2 (>= 1.4.0, < 2.0)
+ omniauth-oauth2 (1.6.0)
+ oauth2 (~> 1.1)
+ omniauth (~> 1.9)
+ pg (1.2.3)
+ pg (1.2.3-x64-mingw32)
+ pg (1.2.3-x86-mingw32)
+ popper_js (1.16.0)
+ pry (0.13.1)
+ coderay (~> 1.1)
+ method_source (~> 1.0)
+ pry (0.13.1-java)
+ coderay (~> 1.1)
+ method_source (~> 1.0)
+ spoon (~> 0.0)
+ pry-rails (0.3.9)
+ pry (>= 0.10.4)
+ public_suffix (4.0.5)
+ puma (4.3.5)
+ nio4r (~> 2.0)
+ puma (4.3.5-java)
+ nio4r (~> 2.0)
+ rack (2.2.2)
+ rack-proxy (0.6.5)
+ rack
+ rack-test (1.1.0)
+ rack (>= 1.0, < 3)
+ rails (6.0.3.1)
+ actioncable (= 6.0.3.1)
+ actionmailbox (= 6.0.3.1)
+ actionmailer (= 6.0.3.1)
+ actionpack (= 6.0.3.1)
+ actiontext (= 6.0.3.1)
+ actionview (= 6.0.3.1)
+ activejob (= 6.0.3.1)
+ activemodel (= 6.0.3.1)
+ activerecord (= 6.0.3.1)
+ activestorage (= 6.0.3.1)
+ activesupport (= 6.0.3.1)
+ bundler (>= 1.3.0)
+ railties (= 6.0.3.1)
+ sprockets-rails (>= 2.0.0)
+ rails-dom-testing (2.0.3)
+ activesupport (>= 4.2.0)
+ nokogiri (>= 1.6)
+ rails-html-sanitizer (1.3.0)
+ loofah (~> 2.3)
+ railties (6.0.3.1)
+ actionpack (= 6.0.3.1)
+ activesupport (= 6.0.3.1)
+ method_source
+ rake (>= 0.8.7)
+ thor (>= 0.20.3, < 2.0)
+ rake (13.0.1)
+ rb-fsevent (0.10.4)
+ rb-inotify (0.10.1)
+ ffi (~> 1.0)
+ regexp_parser (1.7.1)
+ ruby-debug-ide (0.7.2)
+ rake (>= 0.8.1)
+ ruby-progressbar (1.10.1)
+ rubyzip (2.3.0)
+ sass-rails (6.0.0)
+ sassc-rails (~> 2.1, >= 2.1.1)
+ sassc (2.4.0)
+ ffi (~> 1.9)
+ sassc (2.4.0-x64-mingw32)
+ ffi (~> 1.9)
+ sassc-rails (2.1.2)
+ railties (>= 4.0.0)
+ sassc (>= 2.0)
+ sprockets (> 3.0)
+ sprockets-rails
+ tilt
+ selenium-webdriver (3.142.7)
+ childprocess (>= 0.5, < 4.0)
+ rubyzip (>= 1.2.2)
+ shellany (0.0.1)
+ simplecov (0.18.5)
+ docile (~> 1.1)
+ simplecov-html (~> 0.11)
+ simplecov-html (0.12.2)
+ spoon (0.0.6)
+ ffi
+ spring (2.1.0)
+ spring-watcher-listen (2.0.1)
+ listen (>= 2.7, < 4.0)
+ spring (>= 1.2, < 3.0)
+ sprockets (4.0.2)
+ concurrent-ruby (~> 1.0)
+ rack (> 1, < 3)
+ sprockets-rails (3.2.1)
+ actionpack (>= 4.0)
+ activesupport (>= 4.0)
+ sprockets (>= 3.0.0)
+ thor (1.0.1)
+ thread_safe (0.3.6)
+ thread_safe (0.3.6-java)
+ tilt (2.0.10)
+ turbolinks (5.2.1)
+ turbolinks-source (~> 5.2)
+ turbolinks-source (5.2.0)
+ tzinfo (1.2.7)
+ thread_safe (~> 0.1)
+ tzinfo-data (1.2020.1)
+ tzinfo (>= 1.0.0)
+ web-console (4.0.2)
+ actionview (>= 6.0.0)
+ activemodel (>= 6.0.0)
+ bindex (>= 0.4.0)
+ railties (>= 6.0.0)
+ webdrivers (4.4.1)
+ nokogiri (~> 1.6)
+ rubyzip (>= 1.3.0)
+ selenium-webdriver (>= 3.0, < 4.0)
+ webpacker (4.2.2)
+ activesupport (>= 4.2)
+ rack-proxy (>= 0.6.1)
+ railties (>= 4.2)
+ websocket-driver (0.7.2)
+ websocket-extensions (>= 0.1.0)
+ websocket-driver (0.7.2-java)
+ websocket-extensions (>= 0.1.0)
+ websocket-extensions (0.1.5)
+ xpath (3.2.0)
+ nokogiri (~> 1.8)
+ zeitwerk (2.3.0)
+
+PLATFORMS
+ java
+ ruby
+ x64-mingw32
+ x86-mingw32
+ x86-mswin32
+
+DEPENDENCIES
+ better_errors
+ binding_of_caller
+ bootsnap (>= 1.4.2)
+ bootstrap
+ byebug
+ capybara (>= 2.15)
+ debase (>= 0.2.4.1)
+ dotenv-rails
+ guard
+ guard-minitest
+ jbuilder (~> 2.7)
+ jquery-rails
+ jquery-turbolinks
+ listen (~> 3.2)
+ minitest-rails
+ minitest-reporters
+ omniauth
+ omniauth-github
+ pg (>= 0.18, < 2.0)
+ pry-rails
+ puma (~> 4.1)
+ rails (~> 6.0.3, >= 6.0.3.1)
+ ruby-debug-ide (>= 0.7.0)
+ sass-rails (>= 6)
+ selenium-webdriver
+ simplecov
+ spring
+ spring-watcher-listen (~> 2.0.0)
+ turbolinks (~> 5)
+ tzinfo-data
+ web-console (>= 3.3.0)
+ webdrivers
+ webpacker (~> 4.0)
+
+RUBY VERSION
+ ruby 2.6.5p114
+
+BUNDLED WITH
+ 2.1.4
diff --git a/Guardfile b/Guardfile
new file mode 100644
index 0000000000..e34f706f4a
--- /dev/null
+++ b/Guardfile
@@ -0,0 +1,9 @@
+guard :minitest, autorun: false, spring: true do
+ watch(%r{^app/(.+).rb$}) { |m| "test/#{m[1]}_test.rb" }
+ watch(%r{^app/controllers/application_controller.rb$}) { 'test/controllers' }
+ watch(%r{^app/controllers/(.+)_controller.rb$}) { |m| "test/integration/#{m[1]}_test.rb" }
+ watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
+ watch(%r{^lib/(.+).rb$}) { |m| "test/lib/#{m[1]}_test.rb" }
+ watch(%r{^test/.+_test.rb$})
+ watch(%r{^test/test_helper.rb$}) { 'test' }
+end
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000000..9a5ea7383a
--- /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_relative "config/application"
+
+Rails.application.load_tasks
diff --git a/app/.DS_Store b/app/.DS_Store
new file mode 100644
index 0000000000..2564ef96e3
Binary files /dev/null and b/app/.DS_Store differ
diff --git a/app/assets/.DS_Store b/app/assets/.DS_Store
new file mode 100644
index 0000000000..a9b834cd5b
Binary files /dev/null and b/app/assets/.DS_Store differ
diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js
new file mode 100644
index 0000000000..591819335f
--- /dev/null
+++ b/app/assets/config/manifest.js
@@ -0,0 +1,2 @@
+//= link_tree ../images
+//= link_directory ../stylesheets .css
diff --git a/app/assets/images/.keep b/app/assets/images/.keep
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
new file mode 100644
index 0000000000..01efeb5c6e
--- /dev/null
+++ b/app/assets/stylesheets/application.scss
@@ -0,0 +1,195 @@
+/*
+ * 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, 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 other CSS/SCSS
+ * files in this directory. Styles in this file should be added after the last require_* statement.
+ * It is generally better to create a new file per style scope.
+ *
+ */
+
+/* Custom bootstrap variables must be set or imported *before* bootstrap. */
+@import "bootstrap";
+
+@import "**/*";
+
+
+.navbar-brand {
+ font-family: 'La Belle Aurore', cursive;
+ padding-left: 20px;
+}
+
+.navbar-brand:hover {
+ text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #FF69B4, 0 0 20px #FF69B4, 0 0 25px #FF69B4, 0 0 30px #FF69B4, 0 0 35px #FF69B4;
+}
+
+.navbar {
+ display: grid;
+ grid-template-columns: 1fr 1fr 1fr 3fr;
+}
+
+.nav-search {
+ grid-column-start: span 2;
+}
+
+.navbar-nav {
+ grid-column-start: 4;
+ justify-items: end;
+ align-items: center;
+}
+
+.nav-link {
+ padding: 0px 5px;
+ text-align: center;
+}
+
+.btn {
+ margin: 5px;
+}
+
+.btn-info {
+ background-color: #6D6875;
+ border: #6D6875;
+}
+
+.btn-info:hover {
+ background-color: #B5838D;
+ border: #B5838D;
+ box-shadow: 0px 0px 15px 1px #FFCDB2;
+}
+
+.btn-info:active {
+ background-color: #B5838D;
+ border: #B5838D;
+}
+
+.btn-info:focus {
+ background-color: #B5838D;
+ border: #B5838D;
+}
+
+.title {
+ text-align: center;
+ background-color: #E5989B;
+ padding: 30px 0px 10px 0px;
+ margin-bottom: 30px;
+ font-family: 'La Belle Aurore', cursive;
+}
+
+.subtitle {
+ text-align: center;
+ font-family: 'La Belle Aurore', cursive;
+ font-size: 5vw;
+}
+
+.subtitle2 {
+ text-align: center;
+ font-family: 'La Belle Aurore', cursive;
+ font-size: 3vw;
+}
+
+.subtitle3 {
+ text-align: left;
+ font-family: 'La Belle Aurore', cursive;
+ font-size: 2.5vw;
+}
+
+.reviews {
+ padding: 50px 0px 30px;
+}
+
+.review {
+ border: 2px solid #B5838D;
+}
+
+a {
+ color: #E5989B;
+}
+
+a:hover {
+ color: #B5838D;
+}
+
+.inline {
+ display: inline-block;
+}
+
+.button-holder {
+ justify-content: center;
+ padding-top: 30px;
+}
+
+.sm-txt {
+ font-size: small;
+}
+
+.card-title {
+ text-align: center;
+}
+
+.card-text {
+ text-align: center;
+}
+
+.page-container {
+ background-color: #F8F9FA;
+ position: relative;
+}
+
+// modal
+.modal-body {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ grid-template-rows: 1fr 1fr;
+}
+
+.modal-contain {
+ margin: auto;
+ text-align: center;
+ padding: 10px;
+}
+
+.modal-link {
+ color: #E5989B;
+}
+
+.modal-link:hover {
+ cursor: pointer;
+ color: #B5838D;
+}
+
+.hala {
+ grid-column-start: 1;
+ grid-row-start: 1;
+}
+
+.hannah {
+ grid-column-start: 2;
+ grid-row-start: 1;
+}
+
+.jocelyn {
+ grid-column-start: 1;
+ grid-row-start: 2;
+}
+
+.leah {
+ grid-column-start: 2;
+ grid-row-start: 2;
+}
+
+.avatar {
+ vertical-align: middle;
+ width: 200px;
+ height: 200px;
+ border-radius: 50%;
+}
+
+.show-container {
+ padding: 0px 20px;
+}
+
diff --git a/app/assets/stylesheets/categories.scss b/app/assets/stylesheets/categories.scss
new file mode 100644
index 0000000000..068dd1a3b9
--- /dev/null
+++ b/app/assets/stylesheets/categories.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the Categories controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: https://sass-lang.com/
diff --git a/app/assets/stylesheets/homepages.scss b/app/assets/stylesheets/homepages.scss
new file mode 100644
index 0000000000..6bb5bcb387
--- /dev/null
+++ b/app/assets/stylesheets/homepages.scss
@@ -0,0 +1,32 @@
+// Place all the styles related to the Homepages controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: https://sass-lang.com/
+
+.homepage-container {
+ position: relative;
+ text-align: center;
+}
+
+.homepage-img {
+ max-width: 100%;
+ filter: blur(3px);
+}
+
+.centered {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ color: #01161E;
+}
+
+.logo {
+ padding: 10px;
+ font-size: 15vw;
+ text-shadow: 3px 3px 3px #EFF6E0;
+ font-family: 'La Belle Aurore', cursive;
+}
+
+.feature-products {
+ padding: 50px;
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/merchants.scss b/app/assets/stylesheets/merchants.scss
new file mode 100644
index 0000000000..36bb4bbaea
--- /dev/null
+++ b/app/assets/stylesheets/merchants.scss
@@ -0,0 +1,45 @@
+// Place all the styles related to the Merchants controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: https://sass-lang.com/
+
+.btn-container {
+ display: flex;
+ justify-content: center;
+}
+
+.current {
+ margin: 50px auto;
+}
+
+.dashboard-container {
+ background-color: white;
+}
+
+.btm-bump-down {
+ padding-bottom: 40px;
+}
+
+.center {
+ margin: 0 auto;
+}
+
+.profile {
+ width: 200px;
+ height: 200px;
+ border-radius: 50%;
+ box-shadow: 3px 3px 5px 6px #ccc;
+}
+
+.merchant-page {
+ display: grid;
+ grid-template-columns: 1fr 3fr;
+}
+
+.merchant-card {
+ margin-right: 20px;
+}
+
+.image-container {
+ margin: auto;
+ padding-top: 10px;
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/orders.scss b/app/assets/stylesheets/orders.scss
new file mode 100644
index 0000000000..fa66d24519
--- /dev/null
+++ b/app/assets/stylesheets/orders.scss
@@ -0,0 +1,20 @@
+// Place all the styles related to the Orders controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: https://sass-lang.com/
+
+.display-4 {
+ font-family: 'La Belle Aurore'
+}
+
+.card-order {
+ margin: 20px;
+}
+
+.customer-info {
+ padding: 50px;
+}
+
+.details {
+ padding: 20px;
+ margin-bottom: 30px;
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/products.scss b/app/assets/stylesheets/products.scss
new file mode 100644
index 0000000000..744e56ad1f
--- /dev/null
+++ b/app/assets/stylesheets/products.scss
@@ -0,0 +1,79 @@
+// Place all the styles related to the products controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: https://sass-lang.com/
+
+// all products - product index
+
+// from https://stackoverflow.com/questions/36487389/bootstrap-4-card-deck-table-cell-columns-responsive-based-on-viewport
+.card-deck {
+ margin: 0 -15px;
+ justify-content: space-around;
+ }
+
+ .card-deck .card {
+ margin: 0 0 1rem;
+ }
+
+ @media (min-width: 576px) and (max-width: 767.98px) {
+ .card-deck .card {
+ -ms-flex: 0 0 48.7%;
+ flex: 0 0 48.7%;
+ }
+ }
+
+ @media (min-width: 768px) and (max-width: 991.98px) {
+ .card-deck .card {
+ -ms-flex: 0 0 32%;
+ flex: 0 0 32%;
+ }
+ }
+
+ @media (min-width: 992px)
+ {
+ .card-deck .card {
+ -ms-flex: 0 0 24%;
+ flex: 0 0 24%;
+ }
+ }
+
+
+// individual product - product show
+
+.horiz {
+ margin: 30px auto
+}
+
+.card-columns {
+ column-count: 5;
+}
+
+.single-product-container {
+ padding-bottom: 20px;
+}
+
+.all-prods-container {
+ padding: 0px 20px;
+}
+
+.reviews-container {
+ padding: 0px 20px;
+}
+
+.product-info-container {
+ padding-left: 80px;
+ padding-bottom: 60px;
+}
+
+// .img {
+// float: left;
+// width: 262px;
+// height: 262px;
+// max-height: 100%;
+// max-width: 100%;
+// object-fit: fill;
+// }
+
+.img {
+ box-shadow: 0 8px 6px -6px black;
+}
+
diff --git a/app/assets/stylesheets/reviews.scss b/app/assets/stylesheets/reviews.scss
new file mode 100644
index 0000000000..6457abefb6
--- /dev/null
+++ b/app/assets/stylesheets/reviews.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the Reviews controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: https://sass-lang.com/
diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb
new file mode 100644
index 0000000000..d672697283
--- /dev/null
+++ b/app/channels/application_cable/channel.rb
@@ -0,0 +1,4 @@
+module ApplicationCable
+ class Channel < ActionCable::Channel::Base
+ end
+end
diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb
new file mode 100644
index 0000000000..0ff5442f47
--- /dev/null
+++ b/app/channels/application_cable/connection.rb
@@ -0,0 +1,4 @@
+module ApplicationCable
+ class Connection < ActionCable::Connection::Base
+ end
+end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
new file mode 100644
index 0000000000..15826487b5
--- /dev/null
+++ b/app/controllers/application_controller.rb
@@ -0,0 +1,20 @@
+class ApplicationController < ActionController::Base
+ before_action :navigation_data
+
+ def navigation_data
+ @categories = Category.all
+ @merchants = Merchant.all
+ end
+
+ def current_merchant
+ # return user matching id from session variable
+ return Merchant.find_by(id: session[:merchant_id]) if session[:merchant_id]
+ end
+
+ def require_login
+ if current_merchant.nil?
+ flash[:warning] = "Please #{view_context.link_to "login", github_login_path} to perform this action"
+ redirect_to root_path
+ end
+ end
+end
diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb
new file mode 100644
index 0000000000..ba5af86995
--- /dev/null
+++ b/app/controllers/categories_controller.rb
@@ -0,0 +1,39 @@
+class CategoriesController < ApplicationController
+ before_action :require_login, only: [:new, :create]
+
+ def new
+ @category = Category.new
+ end
+
+ def show
+ @category = Category.find_by(id: params[:id])
+
+ if @category.nil?
+ flash[:warning] = "Category does not exist, please select another"
+ redirect_to products_path
+ return
+ end
+
+ @products = Product.by_category(@category.id)
+ session[:return_to] = category_path(@category.id)
+ end
+
+ def create
+ @category = Category.new(category_params)
+
+ if @category.save
+ redirect_to dashboard_path
+ flash[:success] = "Successfully created category: #{@category.category}"
+ return
+ else
+ render :new, status: :bad_request
+ return
+ end
+ end
+
+ private
+
+ def category_params
+ return params.require(:category).permit(:category)
+ end
+end
diff --git a/app/controllers/concerns/.keep b/app/controllers/concerns/.keep
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/app/controllers/homepages_controller.rb b/app/controllers/homepages_controller.rb
new file mode 100644
index 0000000000..65b9316c48
--- /dev/null
+++ b/app/controllers/homepages_controller.rb
@@ -0,0 +1,7 @@
+class HomepagesController < ApplicationController
+ def root
+ @featured_products = Product.featured_products
+ @featured_merchants = Merchant.featured_merchants
+ @newest_merchants = Merchant.newest_merchants
+ end
+end
diff --git a/app/controllers/merchants_controller.rb b/app/controllers/merchants_controller.rb
new file mode 100644
index 0000000000..428d875979
--- /dev/null
+++ b/app/controllers/merchants_controller.rb
@@ -0,0 +1,71 @@
+class MerchantsController < ApplicationController
+ before_action :find_merchant, only: [:show, :dashboard, :logout]
+ before_action :require_login, only: [:dashboard]
+
+ def show
+ @merchant = Merchant.find_by(id: params[:id])
+
+ if @merchant.nil?
+ flash[:warning] = "Merchant does not exist"
+ redirect_to products_path
+ return
+ end
+
+ @products = Product.by_merchant(@merchant.id)
+ session[:return_to] = merchant_path(@merchant.id)
+ end
+
+ def dashboard
+ @merchant_orders = Merchant.get_merchant_orders(@merchant.id)
+ @merchant_order_items = Merchant.get_merchant_order_items(@merchant.id)
+ session[:return_to] = dashboard_path
+ end
+
+ def create
+ auth_hash = request.env["omniauth.auth"]
+ merchant = Merchant.find_by(uid: auth_hash[:uid], provider: "github")
+
+ if merchant
+ flash[:success] = "Logged in as returning user #{merchant.name}"
+ else
+ merchant = Merchant.build_from_github(auth_hash)
+
+ if merchant.save
+ flash[:success] = "Logged in as new user #{merchant.name}"
+ else
+ flash[:warning] = "Could not create new user account: #{merchant.errors.messages}"
+ flash[:warning] = merchant.errors
+ return redirect_to root_path
+ end
+ end
+
+ session[:merchant_id] = merchant.id
+ return redirect_to root_path
+ end
+
+ # TODO - Hannah, what is this method doing? Do we really need it?
+ def confirmation
+ @merchant = @current_merchant
+ @order = Order.find_by(id: params[:id])
+
+ check_merchant
+ end
+
+ def logout
+ if session[:merchant_id].nil?
+ flash[:warning] = "Must be logged in to logout"
+ else
+ flash[:success] = "Successfully logged out of #{@merchant.name}"
+ end
+
+ session[:merchant_id] = nil
+ redirect_to root_path
+ return
+ end
+
+ private
+
+ def find_merchant
+ @merchant = Merchant.find_by(id: session[:merchant_id])
+ end
+end
diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb
new file mode 100644
index 0000000000..44bb834e1e
--- /dev/null
+++ b/app/controllers/orders_controller.rb
@@ -0,0 +1,205 @@
+class OrdersController < ApplicationController
+ before_action :fix_params, only: [:create]
+ before_action :find_order, only: [:show, :purchase, :cancel, :complete, :add_to_cart, :confirm, :ship]
+ before_action :require_login, only: [:show, :ship]
+
+ def show
+ if @order.nil?
+ flash[:warning] = "This order does not exist"
+ redirect_to dashboard_path
+ return
+ end
+
+ if Order.contains_merchant?(@order.id, session[:merchant_id])
+ @order_items = OrderItem.items_by_order_merchant(@order.id, session[:merchant_id])
+ @order_revenue = OrderItem.order_revenue(@order.id, session[:merchant_id])
+ session[:return_to] = order_path(@order.id)
+ else
+ redirect_to dashboard_path
+ flash[:warning] = "You do not have any products on this order!"
+ return
+ end
+ end
+
+ def confirm
+ @order = Order.find_by(id: session[:order_id])
+
+ if @order.nil?
+ redirect_to products_path
+ flash[:warning] = "Cannot access somebody else's order!"
+ return
+ end
+
+ @order_revenue = 0
+ @order.order_items.each do |order_item|
+ @order_revenue += order_item.product.price * order_item.quantity
+ end
+
+ # prevents customer from seeing confirmation page if they've already paid
+ if @order.status == "pending"
+ session[:return_to] = confirm_path
+ else
+ redirect_to session.delete(:return_to)
+ flash[:warning] = "No payment, no receipt!"
+ return
+ end
+ end
+
+ def new
+ if session[:shopping_cart].nil? || session[:shopping_cart].empty?
+ flash[:warning] = "Nothing in cart, let's do some shopping first!"
+ redirect_to products_path
+ return
+ end
+
+ @order = Order.new
+ session[:return_to] = new_order_path
+ end
+
+ def create
+ if session[:shopping_cart].nil? || session[:shopping_cart].empty?
+ flash[:warning] = "Nothing in cart, let's do some shopping first!"
+ redirect_to products_path
+ return
+ end
+
+ @order = Order.new(order_params)
+
+ session[:shopping_cart].each do |product_id, quantity|
+ product = Product.find_by(id: product_id)
+
+ if product.stock < quantity
+ flash[:warning] = "Sorry, looks like someone beat you to the punch. ##{product.id} #{product.name} does not have the quantity you're looking for."
+ redirect_to products_path
+ return
+ end
+
+ @order.order_items << OrderItem.new(
+ product_id: product_id,
+ quantity: quantity,
+ )
+ end
+
+ if @order.save
+ session[:shopping_cart] = nil
+ session[:order_id] = @order.id
+ session[:return_to] = products_path
+
+ redirect_to confirm_path
+ flash[:success] = "Thanks for creating an order! Please confirm your regrets to render payment."
+ return
+ else
+ render :new, status: :bad_request
+ return
+ end
+ end
+
+ def purchase
+ @order = Order.find_by(id: session[:order_id])
+
+ if @order.status == "pending" || @order.status == "paid"
+ @order.status = "paid"
+ else
+ flash[:warning] = "Order already completed/cancelled, cannot change status"
+ redirect_to order_path(@order.id)
+ return
+ end
+
+ if @order.save
+ # reducing stock here because we don't want on order to go half way through but still have stock reduce
+ @order.order_items.each do |order_item|
+ order_item.product.decrease_stock(order_item.quantity)
+ end
+
+ flash[:success] = "Thank you for your purchase! Hope you regret it :)"
+ session[:order_id] = @order.id
+ session[:return_to] = products_path
+ redirect_to receipt_path
+ return
+ else
+ render :new, status: :bad_request
+ return
+ end
+ end
+
+ def cancel
+ @order.status = "cancel"
+
+ if @order.save
+ flash[:success] = "We're sorry to see you cancel. Please call ###.###.### if there is anything else we can make you regret."
+ session[:order_id] = nil
+ redirect_to session.delete(:return_to)
+ return
+ else
+ render :new, status: :bad_request
+ return
+ end
+ end
+
+ def receipt
+ if session[:order_id].nil?
+ redirect_to products_path
+ flash[:warning] = "Cannot access somebody else's order!"
+ return
+ end
+
+ @order = Order.find_by(id: session[:order_id])
+
+ @order_revenue = 0
+ @order.order_items.each do |order_item|
+ @order_revenue += order_item.product.price * order_item.quantity
+ end
+
+ # prevent customer from seeing receipt if they haven't paid yet
+ if @order.status == "paid"
+ session[:order_id] = nil
+ session[:return_to] = products_path
+ else
+ redirect_to session.delete(:return_to)
+ flash[:warning] = "No payment, no receipt!"
+ return
+ end
+ end
+
+ def ship
+ @order_items = OrderItem.items_by_order_merchant(@order.id, session[:merchant_id])
+
+ @order_items.each do |order_item|
+ item = order_item
+ item.is_shipped = true
+ item.save
+ end
+
+ redirect_to session.delete(:return_to)
+ end
+
+ private
+
+ def order_params
+ return params.require(:order).permit(:buyer_name, :mail_address, :zip_code, :email_address, :cc_num, :cc_exp, :cc_cvv)
+ end
+
+ def fix_params
+ # https://stackoverflow.com/questions/47932187/combining-two-form-input-into-one-db-entry
+ month = params[:order].delete(:month)
+ year = params[:order].delete(:year)
+
+ if month == "" || year == ""
+ params[:order][:cc_exp] = "#{month}#{year}"
+ else
+ params[:order][:cc_exp] = "%02d" % month + "%02d" % year
+ end
+
+ cc_num = (params[:order].delete(:cc_one) +
+ params[:order].delete(:cc_two) +
+ params[:order].delete(:cc_three))
+
+ params[:order][:cc_num] = cc_num.gsub(/\d/, "*") + params[:order][:cc_four]
+
+ params[:order][:cc_cvv] = params[:order][:cc_cvv].gsub(/\d/, "*")
+ end
+
+ def find_order
+ @order = Order.find_by(id: params[:id])
+ end
+end
diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb
new file mode 100644
index 0000000000..ca1d96fd16
--- /dev/null
+++ b/app/controllers/products_controller.rb
@@ -0,0 +1,162 @@
+class ProductsController < ApplicationController
+ before_action :find_product, only: [:show, :edit, :update, :retire, :add_to_cart, :remove_from_cart, :delete_from_cart, :search]
+ before_action :require_login, only: [:new, :create, :edit, :update]
+
+ def index
+ @products = Product.where("stock > ?", 0)
+ session[:return_to] = products_path
+ end
+
+ def search
+ @search_products = Product.search(params[:search])
+ @search_categories = Product.search_categories(params[:search])
+ @search_merchants = Product.search_merchants(params[:search])
+ end
+
+ def show
+ if @product.nil?
+ redirect_to products_path
+ return
+ end
+
+ @reviews = Review.where(product_id: @product.id)
+ @featured_products = Product.featured_products
+
+ session[:return_to] = product_path(@product.id)
+ end
+
+ def new
+ @product = Product.new
+ end
+
+ def create
+ @product = Product.new(product_params)
+
+ if @product.save
+ flash[:success] = "Successfully added new product: #{view_context.link_to "##{@product.id} #{@product.name}", product_path(@product.id)}"
+ redirect_to product_path(@product.id)
+ return
+ else
+ render :new, status: :bad_request
+ return
+ end
+ end
+
+ def edit
+ if @product.nil?
+ head :not_found
+ return
+ end
+
+ if session[:merchant_id] != @product.merchant.id
+ flash[:warning] = "Cannot edit another merchant's products"
+ redirect_to dashboard_path
+ return
+ end
+ end
+
+ def update
+ if @product.nil?
+ head :not_found
+ return
+ elsif @product.update(product_params)
+ flash[:success] = "Successfully edited new product: #{view_context.link_to "##{@product.id} #{@product.name}", product_path(@product.id)}"
+ redirect_to product_path(@product.id)
+ return
+ else
+ render :edit, status: :bad_request
+ return
+ end
+ end
+
+ def retire
+ if @product.update(stock: 0)
+ flash[:success] = "Successfully retired product"
+ redirect_to dashboard_path
+ else
+ flash[:failure] = "Couldn't retire product!"
+ redirect_to dashboard_path
+ end
+ end
+
+ def add_to_cart
+ if @product.nil?
+ head :not_found
+ return
+ end
+
+ if session[:shopping_cart].nil?
+ session[:shopping_cart] = Hash.new()
+ end
+
+ if @product.stock <= 0
+ flash[:warning] = "Sorry, no more stock for #{view_context.link_to "#{@product.name}", product_path(@product.id)}!"
+ redirect_to products_path
+ return
+ end
+
+ if session[:shopping_cart][@product.id.to_s]
+ if session[:shopping_cart][@product.id.to_s] < @product.stock
+ session[:shopping_cart][@product.id.to_s] += 1
+ flash[:success] = "You have added a #{view_context.link_to "#{@product.name}", product_path(@product.id)} to the cart!"
+ else
+ flash[:warning] = "Sorry, no more stock for #{view_context.link_to "#{@product.name}", product_path(@product.id)}!"
+ end
+ else
+ session[:shopping_cart][@product.id.to_s] = 1
+ flash[:success] = "You have added a #{view_context.link_to "#{@product.name}", product_path(@product.id)} to the cart!"
+ end
+
+ redirect_to session.delete(:return_to)
+ return
+ end
+
+ def remove_from_cart
+ if @product.nil?
+ head :not_found
+ return
+ end
+
+ if session[:shopping_cart].nil?
+ session[:shopping_cart] = Hash.new()
+ end
+
+ if session[:shopping_cart][@product.id.to_s] && session[:shopping_cart][@product.id.to_s] > 0
+ session[:shopping_cart][@product.id.to_s] -= 1
+ flash[:success] = "You have removed a #{view_context.link_to "#{@product.name}", product_path(@product.id)} from the cart!"
+ if session[:shopping_cart][@product.id.to_s] == 0
+ session[:shopping_cart].delete(@product.id.to_s)
+ flash[:warning] = "#{view_context.link_to "#{@product.name}", product_path(@product.id)} has been fully removed from the cart."
+ end
+ else
+ flash[:warning] = "#{view_context.link_to "#{@product.name}", product_path(@product.id)} is not in the cart."
+ end
+
+ redirect_to session.delete(:return_to)
+ return
+ end
+
+ def delete_from_cart
+ if @product.nil?
+ head :not_found
+ return
+ end
+
+ session[:shopping_cart].delete(@product.id.to_s)
+ flash[:warning] = "#{view_context.link_to "#{@product.name}", product_path(@product.id)} has been fully removed from the cart."
+ redirect_to session.delete(:return_to)
+ return
+ end
+
+ private
+
+ def product_params
+ complete_params = params.require(:product).permit(:name, :description, :price, :stock, :photo_url, :search, category_ids: [])
+ complete_params[:merchant_id] = session[:merchant_id]
+ return complete_params
+ end
+
+ def find_product
+ @product = Product.find_by(id: params[:id])
+ end
+end
diff --git a/app/controllers/reviews_controller.rb b/app/controllers/reviews_controller.rb
new file mode 100644
index 0000000000..19cf2ba4c7
--- /dev/null
+++ b/app/controllers/reviews_controller.rb
@@ -0,0 +1,39 @@
+class ReviewsController < ApplicationController
+ def new
+ @product = Product.find_by(id: params[:product_id])
+ @review = Review.new
+ end
+
+ def create
+ @review = Review.new(review_params)
+ @product = Product.find_by(id: review_params[:product_id])
+
+ if @product.nil?
+ flash[:error] = "We couldn't find that product in our database"
+ redirect_to products_path
+ return
+ end
+
+ if session[:merchant_id] == @product.merchant.id
+ flash[:warning] = "Boooo!!! We at regrEtsy pride ourselves in our unbiased reviews. You ought to be ashamed of trying to review your own product! >:("
+ redirect_to product_path(@product.id)
+ return
+ end
+
+ if @review.save
+ redirect_to product_path(@review.product.id)
+ flash[:success] = "Thanks for leaving a review for #{@review.product.name}"
+ return
+ else
+ redirect_to new_product_review_path(review_params[:product_id])
+ flash[:warning] = "Must enter a rating to create a review"
+ return
+ end
+ end
+
+ private
+
+ def review_params
+ return params.require(:review).permit(:rating, :review_text, :product_id)
+ end
+end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
new file mode 100644
index 0000000000..05b1911e42
--- /dev/null
+++ b/app/helpers/application_helper.rb
@@ -0,0 +1,43 @@
+module ApplicationHelper
+
+ def render_rating(rating)
+
+ rating = rating.to_i
+
+ filled_star = ' '
+ empty_star = ' '
+
+ # make a list of all the filled stars
+ star_list = []
+ until rating == 0
+ star_list << filled_star
+ rating -= 1
+ end
+
+ # fill out the rest of the list with empty stars
+ until star_list.length == 5
+ star_list << empty_star
+ end
+
+ # convert star list to string
+ stars = star_list.join("")
+
+ return (
+ stars.html_safe
+ )
+ end
+
+
+
+ def cart_num_items
+ count = 0
+
+ if !session[:shopping_cart].nil?
+ session[:shopping_cart].each do |key, value|
+ count += value
+ end
+ end
+
+ return count
+ end
+end
diff --git a/app/helpers/categories_helper.rb b/app/helpers/categories_helper.rb
new file mode 100644
index 0000000000..e06f31554c
--- /dev/null
+++ b/app/helpers/categories_helper.rb
@@ -0,0 +1,2 @@
+module CategoriesHelper
+end
diff --git a/app/helpers/homepages_helper.rb b/app/helpers/homepages_helper.rb
new file mode 100644
index 0000000000..4bd8098f37
--- /dev/null
+++ b/app/helpers/homepages_helper.rb
@@ -0,0 +1,2 @@
+module HomepagesHelper
+end
diff --git a/app/helpers/merchants_helper.rb b/app/helpers/merchants_helper.rb
new file mode 100644
index 0000000000..5337747b0f
--- /dev/null
+++ b/app/helpers/merchants_helper.rb
@@ -0,0 +1,2 @@
+module MerchantsHelper
+end
diff --git a/app/helpers/orders_helper.rb b/app/helpers/orders_helper.rb
new file mode 100644
index 0000000000..443227fd48
--- /dev/null
+++ b/app/helpers/orders_helper.rb
@@ -0,0 +1,2 @@
+module OrdersHelper
+end
diff --git a/app/helpers/products_helper.rb b/app/helpers/products_helper.rb
new file mode 100644
index 0000000000..ab5c42b325
--- /dev/null
+++ b/app/helpers/products_helper.rb
@@ -0,0 +1,2 @@
+module ProductsHelper
+end
diff --git a/app/helpers/reviews_helper.rb b/app/helpers/reviews_helper.rb
new file mode 100644
index 0000000000..682b7b1abc
--- /dev/null
+++ b/app/helpers/reviews_helper.rb
@@ -0,0 +1,2 @@
+module ReviewsHelper
+end
diff --git a/app/javascript/channels/consumer.js b/app/javascript/channels/consumer.js
new file mode 100644
index 0000000000..0eceb59b18
--- /dev/null
+++ b/app/javascript/channels/consumer.js
@@ -0,0 +1,6 @@
+// Action Cable provides the framework to deal with WebSockets in Rails.
+// You can generate new channels where WebSocket features live using the `rails generate channel` command.
+
+import { createConsumer } from "@rails/actioncable"
+
+export default createConsumer()
diff --git a/app/javascript/channels/index.js b/app/javascript/channels/index.js
new file mode 100644
index 0000000000..0cfcf74919
--- /dev/null
+++ b/app/javascript/channels/index.js
@@ -0,0 +1,5 @@
+// Load all the channels within this directory and all subdirectories.
+// Channel files must be named *_channel.js.
+
+const channels = require.context('.', true, /_channel\.js$/)
+channels.keys().forEach(channels)
diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js
new file mode 100644
index 0000000000..529f85b082
--- /dev/null
+++ b/app/javascript/packs/application.js
@@ -0,0 +1,19 @@
+// This file is automatically compiled by Webpack, along with any other files
+// present in this directory. You're encouraged to place your actual application logic in
+// a relevant structure within app/javascript and only use these pack files to reference
+// that code so it'll be compiled.
+
+require("@rails/ujs").start()
+require("turbolinks").start()
+require("@rails/activestorage").start()
+require("channels")
+
+import "bootstrap"
+
+
+// Uncomment to copy all static images under ../images to the output folder and reference
+// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
+// or the `imagePath` JavaScript helper below.
+//
+// const images = require.context('../images', true)
+// const imagePath = (name) => images(name, true)
diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb
new file mode 100644
index 0000000000..d394c3d106
--- /dev/null
+++ b/app/jobs/application_job.rb
@@ -0,0 +1,7 @@
+class ApplicationJob < ActiveJob::Base
+ # Automatically retry jobs that encountered a deadlock
+ # retry_on ActiveRecord::Deadlocked
+
+ # Most jobs are safe to ignore if the underlying records are no longer available
+ # discard_on ActiveJob::DeserializationError
+end
diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb
new file mode 100644
index 0000000000..3c34c8148f
--- /dev/null
+++ b/app/mailers/application_mailer.rb
@@ -0,0 +1,4 @@
+class ApplicationMailer < ActionMailer::Base
+ default from: "from@example.com"
+ layout "mailer"
+end
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
new file mode 100644
index 0000000000..10a4cba84d
--- /dev/null
+++ b/app/models/application_record.rb
@@ -0,0 +1,3 @@
+class ApplicationRecord < ActiveRecord::Base
+ self.abstract_class = true
+end
diff --git a/app/models/category.rb b/app/models/category.rb
new file mode 100644
index 0000000000..66fc02bd97
--- /dev/null
+++ b/app/models/category.rb
@@ -0,0 +1,7 @@
+class Category < ApplicationRecord
+ has_and_belongs_to_many :products
+
+ validates :category, presence: true, uniqueness: true
+
+
+end
diff --git a/app/models/concerns/.keep b/app/models/concerns/.keep
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/app/models/merchant.rb b/app/models/merchant.rb
new file mode 100644
index 0000000000..bb191d4e76
--- /dev/null
+++ b/app/models/merchant.rb
@@ -0,0 +1,73 @@
+class Merchant < ApplicationRecord
+ has_many :products
+
+ validates :provider, presence: true
+ validates :uid, presence: true, uniqueness: true
+ validates :name, presence: true
+ validates :email, presence: true, uniqueness: true
+ validates_format_of :email, :with => /\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/
+ validates :avatar, presence: true
+
+ def self.build_from_github(auth_hash)
+ merchant = Merchant.new
+ merchant.uid = auth_hash[:uid]
+ merchant.provider = "github"
+ merchant.name = auth_hash["info"]["name"] || auth_hash["info"]["nickname"]
+ merchant.email = auth_hash["info"]["email"]
+ merchant.avatar = auth_hash["info"]["image"]
+ return merchant
+ end
+
+ def self.get_merchant_order_items(id)
+ return OrderItem.joins(:product).where(:products => { :merchant_id => id })
+ end
+
+ def avgs_rating
+ #merchant = Merchant.where(merchant_id: self.id)
+
+ ratings = self.products.map{|product| product.avg_rating}.reject{|rating| rating.nil?}
+ if ratings.length > 0
+ return (ratings.sum.to_f / ratings.length).round(2)
+ else
+ return 0
+ end
+ end
+
+ # https://stackoverflow.com/questions/19527177/rails-triple-join
+ def self.get_merchant_orders(id)
+ return Order.order("id").joins(:order_items => :product).where(:products => { :merchant_id => id }).uniq
+ end
+
+ def self.featured_merchants
+ # Sorts by order_item count (most order_items at the top)
+ return Merchant.joins(:products => :order_items).group(:id).order("COUNT(order_items.id) DESC")[0..[Merchant.all.length, 2].min]
+ end
+
+ def self.newest_merchants
+ # Sorts by newest added merchants
+ return Merchant.order("created_at DESC")[0..[Merchant.all.length, 2].min]
+ end
+
+ def orders_of_status(status)
+ Order.joins(order_items: :product).where(orders: { status: status }, products: { merchant_id: id })
+ end
+
+ def revenue_of_status(status)
+ orders = orders_of_status(status)
+ orders.reduce(0) do |sum, order|
+ sum + order.total_price_for_merchant(id)
+ end
+ end
+
+ def order_count(status)
+ orders_of_status(status).count
+ end
+
+ def total_orders
+ order_count(:paid) + order_count(:shipped)
+ end
+
+ def total_revenue
+ revenue_of_status(:paid) + revenue_of_status(:shipped)
+ end
+end
diff --git a/app/models/order.rb b/app/models/order.rb
new file mode 100644
index 0000000000..9cc6150343
--- /dev/null
+++ b/app/models/order.rb
@@ -0,0 +1,34 @@
+class Order < ApplicationRecord
+ has_many :order_items
+
+ validates :buyer_name, presence: true
+ validates :email_address, presence: true
+ validates_format_of :email_address, :with => /\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/
+ validates :mail_address, presence: true
+ validates :zip_code, presence: true, numericality: true, length: { is: 5 }
+
+ validates :cc_num, presence: true, length: { is: 16 }
+ validates_format_of :cc_num, :with => /\*{12}\d{4}/
+ validates :cc_exp, presence: true, length: { is: 4 }
+ validates_format_of :cc_exp, :with => /\d{4}/
+ validates :cc_cvv, presence: true, length: { is: 3 }
+ validates_format_of :cc_cvv, :with => /\*{3}/
+ validates :order_items, presence: true
+
+ def self.contains_merchant?(order_id, merch_id)
+ # query checks to see if the order contains the merchant
+ return !Order.where(:id => order_id).joins(:order_items => :product).where(:products => { :merchant_id => merch_id }).empty?
+ end
+
+ def total_price_for_merchant(merchant_id)
+ order_items.joins(:product).where(products: { merchant_id: merchant_id }).reduce(0) do |sum, item|
+ sum + item.product.price * item.quantity
+ end
+ end
+
+ def total_price_for_merchant(merchant_id)
+ order_items.joins(:product).where(products: { merchant_id: merchant_id }).reduce(0) do |sum, item|
+ sum + item.product.price * item.quantity
+ end
+ end
+end
diff --git a/app/models/order_item.rb b/app/models/order_item.rb
new file mode 100644
index 0000000000..053974257d
--- /dev/null
+++ b/app/models/order_item.rb
@@ -0,0 +1,23 @@
+class OrderItem < ApplicationRecord
+ belongs_to :product
+ belongs_to :order
+
+ validates :order, presence: true
+ validates :product, presence: true
+ validates :quantity, presence: true, numericality: { greater_than: 0, only_integer: true }
+
+ def self.items_by_order_merchant(order_id, merch_id)
+ return OrderItem.order("id").where(:order_id => order_id).joins(:product).where(:products => { :merchant_id => merch_id })
+ end
+
+ def self.order_revenue(order_id, merch_id)
+ order_items = items_by_order_merchant(order_id, merch_id)
+ revenue = 0
+
+ order_items.each do |order_item|
+ revenue += order_item.product.price * order_item.quantity
+ end
+
+ return revenue
+ end
+end
diff --git a/app/models/product.rb b/app/models/product.rb
new file mode 100644
index 0000000000..0246cf372a
--- /dev/null
+++ b/app/models/product.rb
@@ -0,0 +1,90 @@
+class Product < ApplicationRecord
+ has_many :order_items
+ belongs_to :merchant
+ has_many :reviews
+ has_and_belongs_to_many :categories
+
+ validates :name, presence: true, uniqueness: true
+ validates :photo_url, presence: true, format: { with: /https:\/\/.*/, message: "Please enter a photo url beginning with 'https://'" }
+ validates :price, presence: true, numericality: { greater_than: 0 }, format: { with: /^[0-9]*\.?[0-9]*/, multiline: true, message: "Please enter a price using numbers" }
+ validates :description, presence: true
+ validates :stock, presence: true, numericality: { only_integer: true }
+ validates :merchant_id, presence: true
+
+ def self.by_merchant(id)
+ products = Product.where(merchant_id: id)
+ return products.reject { |product| product.stock < 1 }
+ end
+
+ def self.by_category(id)
+ category = Category.find_by(id: id)
+ return category.products.reject { |product| product.stock < 1 }
+ end
+
+ def self.featured_products
+ products = []
+
+ Product.all.each do |product|
+ if product.reviews.length > 0
+ products << product
+ end
+ end
+ featured = products.reject { |product| product.stock < 1 }.sort_by { |product| -product.avg_rating }
+ return featured[0..[4, featured.length].min]
+ end
+
+ def self.search(search)
+ if search
+ @search_products = Product.where('lower(name) LIKE ?', "%#{search.downcase}%")
+ if @search_products
+ return @search_products
+ end
+ end
+ end
+
+ def self.search_categories(search)
+ if search
+ @search_categories = Category.where('lower(category) LIKE ?', "%#{search.downcase}%")
+ if @search_categories
+ return @search_categories
+ end
+ end
+ end
+
+ def self.search_merchants(search)
+ if search
+ @search_merchants = Merchant.where('lower(name) LIKE ?', "%#{search.downcase}%")
+ if @search_merchants
+ return @search_merchants
+ end
+ end
+ end
+
+ def avg_rating
+ reviews = Review.where(product_id: self.id)
+ ratings = reviews.map do |review|
+ review.rating
+ end
+ if ratings.count > 0
+ return (ratings.sum.to_f / ratings.count).round(2)
+ end
+ end
+
+ def in_stock?
+ return self.stock > 0
+ end
+
+ def self.most_recent
+ return Product.all.sample(5)
+ end
+
+ def decrease_stock(quantity)
+ if self.stock >= quantity
+ self.stock -= quantity
+ self.save
+ return true
+ else
+ return false
+ end
+ end
+end
diff --git a/app/models/review.rb b/app/models/review.rb
new file mode 100644
index 0000000000..0c8753826d
--- /dev/null
+++ b/app/models/review.rb
@@ -0,0 +1,5 @@
+class Review < ApplicationRecord
+ belongs_to :product
+
+ validates :rating, presence: true, numericality: { only_integer: true, greater_than: 0, less_than: 6 }
+end
diff --git a/app/views/categories/index.html.erb b/app/views/categories/index.html.erb
new file mode 100644
index 0000000000..98842274b6
--- /dev/null
+++ b/app/views/categories/index.html.erb
@@ -0,0 +1,9 @@
+<% # DISPLAYS ALL PRODUCTS, REGARDLESS OF CATEGORY %>
+
regrEtsy Products by Category
+<% @products_by_category.each do |category_id, products| %>
+ <% category = Category.find_by(id: category_id) %>
+ Category: <%= link_to category.category, category_path(category.id) %>
+
+ <%= render partial: "shared/card", locals: { product_set: products } %>
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/categories/new.html.erb b/app/views/categories/new.html.erb
new file mode 100644
index 0000000000..2e931a3e3c
--- /dev/null
+++ b/app/views/categories/new.html.erb
@@ -0,0 +1,26 @@
+<% if @category.errors.any? %>
+
+<% end %>
+
+Create new Category
+
+
+
Please enter the following information:
+
+ <%= form_with model: @category, class: "user-form" do |f| %>
+
+
+ <%= f.label :category %>
+ <%= f.text_field :category, class: "form-control-lg", placeholder: "Product Name" %>
+
+
+ <%= f.submit "Create New Category", class: "btn btn-lg btn-info" %>
+ <% end %>
+
+
diff --git a/app/views/categories/show.html.erb b/app/views/categories/show.html.erb
new file mode 100644
index 0000000000..36c382c202
--- /dev/null
+++ b/app/views/categories/show.html.erb
@@ -0,0 +1,7 @@
+<% # DISPLAYS ONLY ONE CATEGORY PRODUCTS %>
+Products by Category: <%= @category.category %>
+
+
+ <%= render partial: "shared/card", locals: { product_set: @products } %>
+
+
\ No newline at end of file
diff --git a/app/views/homepages/root.html.erb b/app/views/homepages/root.html.erb
new file mode 100644
index 0000000000..21fb2e9977
--- /dev/null
+++ b/app/views/homepages/root.html.erb
@@ -0,0 +1,36 @@
+
+
+ <%= image_tag("https://i.imgur.com/gHHtd3m.jpg", class: "homepage-img", alt: "a dog with his head through a pink lougechair") %>
+
+
+
+
+
+
+
Featured Regrets:
+
Most Recent Regrets!
+
+ <%= render partial: "shared/card", locals: { product_set: @featured_products } if !@featured_products.empty? %>
+
+
+
+
Top Reviewed Regrets!
+
+ <%= render partial: "shared/card", locals: { product_set: Product.most_recent } if !@featured_products.empty? %>
+
+
+
+
+
Featured Merchants!
+ <%= render partial: "shared/merchants", locals: { merchant_set: @featured_merchants } if !@featured_merchants.empty? %>
+
+
+
Support our Newest Merchants!
+ <%= render partial: "shared/merchants", locals: { merchant_set: @newest_merchants } if !@newest_merchants.empty? %>
+
+
+
\ No newline at end of file
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
new file mode 100644
index 0000000000..e3ec7f335a
--- /dev/null
+++ b/app/views/layouts/application.html.erb
@@ -0,0 +1,176 @@
+
+
+
+
+ Betsy
+ <%= csrf_meta_tags %>
+ <%= csp_meta_tag %>
+
+ <%= stylesheet_link_tag "application", media: "all", 'data-turbolinks-track': "reload" %>
+ <%= javascript_pack_tag "application", 'data-turbolinks-track': "reload" %>
+
+
+
+
+
+
+
+ <% flash.each do |name, message| %>
+
+ <%= message.html_safe %>
+
+ <% end %>
+
+
+ <%= link_to root_path do %>
+ regrEtsy
+ <% end %>
+
+
+ <%= form_tag(search_path, :method => "get", id: "search-form") do %>
+ <%= text_field_tag :search, params[:search], placeholder: "Find a Regret", class: 'form-control' %>
+ <%= submit_tag "Search", class: 'btn btn-info' %>
+ <% end %>
+
+
+
+
+
+ <%= link_to products_path, class: "nav-link" do %> ALL PRODUCTS <% end %>
+
+
+
+
+
+
+
+
+
+
+
+ <% if session[:merchant_id].nil? %>
+ <%= link_to github_login_path, class: "nav-link" do %> MERCHANT LOGIN <% end %>
+ <% else %>
+ <%= link_to dashboard_path, class: "nav-link" do %> MY DASHBOARD <% end %>
+ <%= link_to logout_path, method: :post, class: "nav-link" do %> MERCHANT LOGOUT <% end %>
+ <% end %>
+ <%= link_to new_order_path, class: "nav-link" do %> CART
+ <% if cart_num_items > 0 %><%= cart_num_items %><% end %> <% end %>
+
+
+
+
+ <%= yield %>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb
new file mode 100644
index 0000000000..cbd34d2e9d
--- /dev/null
+++ b/app/views/layouts/mailer.html.erb
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+ <%= yield %>
+
+
diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb
new file mode 100644
index 0000000000..37f0bddbd7
--- /dev/null
+++ b/app/views/layouts/mailer.text.erb
@@ -0,0 +1 @@
+<%= yield %>
diff --git a/app/views/merchants/dashboard.html.erb b/app/views/merchants/dashboard.html.erb
new file mode 100644
index 0000000000..f99aa376b9
--- /dev/null
+++ b/app/views/merchants/dashboard.html.erb
@@ -0,0 +1,95 @@
+Welcome to your Merchant Dashboard, <%= @merchant.name %>!
+
+
+
The Nitty Gritty
+
Here are some details about your current earnings and orders.
+
+
+
+
+
+
+
Total Orders
+ Total Overall Orders: <%= @merchant.total_orders %>
+
+
+
+ Pending: <%= @merchant.order_count('pending') %>
+ Paid: <%= @merchant.order_count('paid') %>
+ Complete: <%= @merchant.order_count('complete') %>
+ Cancelled: <%= @merchant.order_count('cancelled') %>
+
+
+
+
+
+
Total Revenue
+ Total Overall Revenue: <%= sprintf("$%2.2f", @merchant.total_revenue)%>
+
+
+
+ Pending: <%= sprintf("$%2.2f", @merchant.revenue_of_status('pending'))%>
+ Paid: <%= sprintf("$%2.2f", @merchant.revenue_of_status('paid'))%>
+ Complete: <%= sprintf("$%2.2f", @merchant.revenue_of_status('complete'))%>
+ Cancelled: <%= sprintf("$%2.2f", @merchant.revenue_of_status('cancelled'))%>
+
+
+
<%# end deck %>
+
+
+
+ <%= link_to "Go To My Store", merchant_path(@merchant.id), class: "btn btn-info btn-lg" %>
+ <%= link_to "Add New Product", new_product_path, class: "btn btn-info btn-lg" %>
+ <%= link_to "Add New Category", new_category_path, class: "btn btn-info btn-lg" %>
+
+
<%# end jumbotron 1%>
+
+<% if !@merchant_orders.empty? %>
+
+
Current Orders
+ <%= render partial: "shared/order", locals: { order_set: @merchant_orders } %>
+
+<% end %>
+
+<% if @merchant.products.count > 0 %>
+
+
Current Products For Sale
+
+
+
+ Name
+ Description
+ Price
+ Stock
+ Image
+ Edit
+ Retire
+
+
+
+
+ <% @merchant.products.each do |product| %>
+
+ <%= link_to product_path(product.id) do%><%= product.name %><%end%>
+ <%= product.description %>
+ <%= sprintf("$%2.2f", product.price) %>
+ <%= product.stock %>
+ <%= link_to image_tag(product.photo_url, :size => "260x180"), product_path(product.id) %>
+
+ <%= link_to "Edit", edit_product_path(product.id), method: :get, class: "btn btn-info" %>
+
+ <%= link_to "Retire", retire_path(product.id), method: :patch,class: "btn btn-info" %>
+
+
+ <% end %>
+
+
+<% end %>
+
+
+ <%= link_to "Go To My Store", merchant_path(@merchant.id), class: "btn btn-info btn-lg" %>
+ <%= link_to "Add New Product", new_product_path, class: "btn btn-info btn-lg" %>
+ <%= link_to "Add New Category", new_category_path, class: "btn btn-info btn-lg" %>
+
+
+
diff --git a/app/views/merchants/index.html.erb b/app/views/merchants/index.html.erb
new file mode 100644
index 0000000000..18b020a184
--- /dev/null
+++ b/app/views/merchants/index.html.erb
@@ -0,0 +1,10 @@
+<% # DISPLAYS ALL PRODUCTS, REGARDLESS OF MERCHANT %>
+
+ SHOP BY MERCHANT
+<% @products_by_merchant.each do |merchant_id, products| %>
+ <% merchant = Merchant.find_by(id: merchant_id) %>
+ Sold By <%= link_to "#{merchant.name} (ID: #{merchant.uid})", merchant_path(merchant.id) %>
+
+ <%= render partial: "shared/card", locals: { product_set: products } %>
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/merchants/show.html.erb b/app/views/merchants/show.html.erb
new file mode 100644
index 0000000000..fda0820349
--- /dev/null
+++ b/app/views/merchants/show.html.erb
@@ -0,0 +1,34 @@
+<% # DISPLAYS ONLY ONE MERCHANT PRODUCTS %>
+<%= @merchant.name %>'s Store
+
+
+
+
+
+ <%= image_tag(@merchant.avatar, class: "card-img-top profile") %>
+
+
+
Merchant Info
+
+
+ Name: <%= @merchant.name %>
+ Products Sold: <%= @merchant.products.count %>
+ Average Rating:
+
+ <% if @merchant.avgs_rating %>
+ <%= render_rating(@merchant.avgs_rating) %>
+ <%else%>
+ <%= link_to "Be First to Review", new_product_review_path(@product.id), method: :get, class: "btn btn-info btn-lg" %>
+ <%end%>
+
+
+
+
+ Joined <%= @merchant.created_at.strftime("%B %d, %Y") %>
+
+
+
+
+ <%= render partial: "shared/card", locals: { product_set: @products } %>
+
+
\ No newline at end of file
diff --git a/app/views/orders/_form.html.erb b/app/views/orders/_form.html.erb
new file mode 100644
index 0000000000..ab980eab43
--- /dev/null
+++ b/app/views/orders/_form.html.erb
@@ -0,0 +1,99 @@
+<% if @order.errors.any? %>
+
+<% end %>
+
+ Review Your Order
+
+
+
Items in Your Cart
+ <% total = 0 %>
+ <% session[:shopping_cart].each do |product_id, quantity| %>
+ <% product = Product.find_by(id: product_id) %>
+ <% subtotal = quantity * product.price %>
+ <% total += subtotal %>
+
+
+
+
+ Product Image
+ Name
+ Quantity
+ Price
+ Change Quantity
+
+
+
+
+ <%= link_to image_tag(product.photo_url, class: 'img-thumbnail', size: '200x200'), product_path(product.id) %>
+ <%= link_to product.name, product_path(product.id) %>
+ <%= quantity %>
+ <%= sprintf("$%2.2f", product.price) %>
+ <%= link_to " + Add Quantity", add_to_cart_path(product.id), method: :patch, class: "btn btn-info inline btn-sm" %>
+ <%= link_to " - Decrease Quantity", remove_from_cart_path(product.id), method: :patch, class: "btn btn-info inline btn-sm" %>
+ <%= link_to " Remove from Cart", delete_from_cart_path(product.id), method: :patch, class: "btn btn-info inline btn-sm" %>
+
+
+
+<% end %>
+
+
+
+
Your Order Total: <%= sprintf("$%2.2f", total) %>
+
+
+
+
+
+
+
Please enter your billing & shipping information:
+
(But remember this is a student project, so please don't give us your real info... )
+
+ <%= form_with model: @order, class: "user-form" do |f| %>
+
+
+ <%= f.label :name %>
+ <%= f.text_field :buyer_name, class: "form-control form-control-lg", placeholder: "Name on Credit Card" %>
+
+
+ <%= f.label :mail_address %>
+ <%= f.text_field :mail_address, class: "form-control form-control-lg", placeholder: "Mailing Address" %>
+
+
+ <%= f.label :zip_code %>
+ <%= f.text_field :zip_code, :maxlength => 5, class: "form-control form-control-lg", placeholder: "Zip" %>
+
+
+ <%= f.label :email_address %>
+ <%= f.text_field :email_address, class: "form-control form-control-lg", placeholder: "Email Address" %>
+
+
+ <%= f.label :Credit_Card_Number %>
+ <%= f.text_field :cc_one, :maxlength => 4, class: "form-control-lg" %> -
+ <%= f.text_field :cc_two, :maxlength => 4, class: "form-control-lg" %> -
+ <%= f.text_field :cc_three, :maxlength => 4, class: "form-control-lg" %> -
+ <%= f.text_field :cc_four, :maxlength => 4, class: "form-control-lg" %>
+
+
+
+ <%= f.label :Credit_Card_CVV %>
+ <%= f.text_field :cc_cvv, :maxlength => 3, class: "form-control form-control-lg", placeholder: "Credit Card CVV (security code)" %>
+
+
+
+ <%= f.label :Credit_Card_Expiration %>
+ <%= f.label :month %>
+ <%= f.select :month, [""] + (1..12).to_a, class: "form-control" %>
+
+ <%= f.label :year %>
+ <%= f.select :year, [""] + (20..25).to_a, class: "form-control" %>
+
+
+ <%= f.submit action_name == "New" ? "Review Order" : "Update Order", class: "btn btn-info btn-lg" %>
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/orders/confirm.html.erb b/app/views/orders/confirm.html.erb
new file mode 100644
index 0000000000..4ca3a873ef
--- /dev/null
+++ b/app/views/orders/confirm.html.erb
@@ -0,0 +1,13 @@
+
+You're Still Considering This??
+
+
Your Order Details (Order #<%= @order.id %>)
+
Take a look before you complete your purchase:
+
+
+<%= render partial: "shared/order_details", locals: { item_set: @order.order_items, ship_status: @order.order_items[0].is_shipped } %>
+
+
+ <%= link_to "Purchase Order", purchase_path, method: :patch, class: "btn btn-info btn-lg" %>
+ <%= link_to "Cancel Order", cancel_path(@order.id), method: :patch, class: "btn btn-info btn-lg" %>
+
\ No newline at end of file
diff --git a/app/views/orders/new.html.erb b/app/views/orders/new.html.erb
new file mode 100644
index 0000000000..171a73c37d
--- /dev/null
+++ b/app/views/orders/new.html.erb
@@ -0,0 +1 @@
+<%= render partial: "form", locals: { action_name: "New" } %>
\ No newline at end of file
diff --git a/app/views/orders/receipt.html.erb b/app/views/orders/receipt.html.erb
new file mode 100644
index 0000000000..dcfff71d3b
--- /dev/null
+++ b/app/views/orders/receipt.html.erb
@@ -0,0 +1,13 @@
+
RECEIPT for Order #<%= @order.id %>
+
Hope you regret your purchase!
+
Your order is confirmed.
+
+
Your Order Details (Order #<%= @order.id %>)
+
Enjoying your regrets:
+
+
+<%= render partial: "shared/order_details", locals: { item_set: @order.order_items, ship_status: @order.order_items[0].is_shipped } %>
+
+
+ <%= link_to "Return to Browsing", products_path, method: :get, class: "btn btn-info btn-lg" %>
+
\ No newline at end of file
diff --git a/app/views/orders/show.html.erb b/app/views/orders/show.html.erb
new file mode 100644
index 0000000000..012da67557
--- /dev/null
+++ b/app/views/orders/show.html.erb
@@ -0,0 +1,13 @@
+
+
Nice Job Suckering in Some Cash ;)
+
+
Order Details (Order #<%= @order.id %>)
+
+
+<%= link_to "Return to Dashboard", dashboard_path, method: :get, class: "btn btn-info" %>
+<% order_items = OrderItem.items_by_order_merchant(@order.id, session[:merchant_id]) %>
+<% if !order_items[0].is_shipped && @order.status == "paid" %>
+ <%= link_to "Ship Products", ship_path(@order.id), method: :patch, class: "btn btn-info" %>
+<% end %>
+
+<%= render partial: "shared/order_details", locals: { item_set: @order_items, ship_status: order_items[0].is_shipped } %>
diff --git a/app/views/products/_form.html.erb b/app/views/products/_form.html.erb
new file mode 100644
index 0000000000..96eb4619d4
--- /dev/null
+++ b/app/views/products/_form.html.erb
@@ -0,0 +1,48 @@
+
+<% if @product.errors.any? %>
+
+<% end %>
+
+
<%= "#{action_name}" %> Product
+
+
+
Please enter the following information:
+
+ <%= form_with model: @product, class: "user-form" do |f| %>
+
+
+
+ <%= f.label :name %>
+ <%= f.text_field :name, class: "form-control form-control-lg", placeholder: "Product Name" %>
+
+
+ <%= f.label :description %>
+ <%= f.text_field :description, class: "form-control form-control ", placeholder: "Description" %>
+
+
+ <%= f.label :price %>
+ <%= f.text_field :price, class: "form-control form-control-lg", placeholder: "Price" %>
+
+
+ <%= f.label :stock %>
+ <%= f.text_field :stock, class: "form-control form-control-lg", placeholder: "Quantity to sell" %>
+
+
+ <%= f.label :photo_url %>
+ <%= f.text_field :photo_url, class: "form-control form-control-lg", placeholder: "Photo URL" %>
+
+
+ <%= f.label :categories %>
+ <%= collection_check_boxes(:product, :category_ids,
+ Category.all, :id, :category) %>
+
+
+ <%= f.submit action_name == "New" ? "Add new product" : "Update product", class: "btn btn-info btn-lg" %>
+ <% end %>
+
diff --git a/app/views/products/edit.html.erb b/app/views/products/edit.html.erb
new file mode 100644
index 0000000000..5b350fe557
--- /dev/null
+++ b/app/views/products/edit.html.erb
@@ -0,0 +1 @@
+<%= render partial: "form", locals: { action_name: "Edit" } %>
diff --git a/app/views/products/index.html.erb b/app/views/products/index.html.erb
new file mode 100644
index 0000000000..8119f30664
--- /dev/null
+++ b/app/views/products/index.html.erb
@@ -0,0 +1,8 @@
+<% # DISPLAYS ALL PRODUCTS, REGARDLESS OF MERCHANT %>
+
+All regrEtsy Products
+
+
+ <%= render partial: "shared/card", locals: { product_set: @products } %>
+
+
\ No newline at end of file
diff --git a/app/views/products/new.html.erb b/app/views/products/new.html.erb
new file mode 100644
index 0000000000..171a73c37d
--- /dev/null
+++ b/app/views/products/new.html.erb
@@ -0,0 +1 @@
+<%= render partial: "form", locals: { action_name: "New" } %>
\ No newline at end of file
diff --git a/app/views/products/search.html.erb b/app/views/products/search.html.erb
new file mode 100644
index 0000000000..aec2171cf6
--- /dev/null
+++ b/app/views/products/search.html.erb
@@ -0,0 +1,49 @@
+<% # DISPLAYS ALL PRODUCTS, REGARDLESS OF MERCHANT %>
+
+Products Results
+
+
+ <%= render partial: "shared/searchproducts", locals: { product_set: @search_products } %>
+
+ <% if @search_products.empty? %>
+
+
We regret to inform you:
+
There are no products matching your search term.
+
Might you be interested in <%= link_to 'this product', product_path(1) %> instead?
+
+
You won't regret it!
+
+ <%end%>
+
+
+
+Category Results
+
+ <%= render partial: "shared/searchcategories", locals: { category_set: @search_categories } %>
+
+ <% if @search_categories.empty? %>
+
+
We regret to inform you:
+
There are no categories matching your search term.
+
Might you be interested in <%= link_to 'this category', category_path(1) %> instead?
+
+
You won't regret it!
+
+ <%end%>
+
+
+
+Merchant Results
+
+ <%= render partial: "shared/searchmerchants", locals: { merchant_set: @search_merchants } %>
+ <% if @search_merchants.empty? %>
+
+
We regret to inform you:
+
There are no merchants matching your search term.
+
Do you have regrets to pawn off on others?
+
<%= link_to 'Become a merchant for regrEtsy!', github_login_path %>
+
+
You won't regret it!
+
+ <%end%>
+
\ No newline at end of file
diff --git a/app/views/products/show.html.erb b/app/views/products/show.html.erb
new file mode 100644
index 0000000000..192d98041d
--- /dev/null
+++ b/app/views/products/show.html.erb
@@ -0,0 +1,56 @@
+You might regret this...
+
+
+
+
+ <%= image_tag(@product.photo_url, class: "card-img-top h-100") %>
+
+
+
+
+
<%= @product.name %>
+
+
Description: <%= @product.description %>
+
Price: <%= sprintf("$%2.2f", @product.price) %>
+
In Stock: <%= @product.stock %>
+
Sold by: <%= link_to "#{@product.merchant.name} (ID: #{@product.merchant.uid})", merchant_path(@product.merchant.id) %>
+
Category:
+ <% @product.category_ids.each do |category_id| %>
+ <% category = Category.find_by(id: category_id) %>
+ <%= link_to category.category, category_path(category.id), class: "btn btn-sm btn-outline-secondary" %>
+ <% end %>
+
+
+
+
+ <%= link_to "Add to Cart", add_to_cart_path(@product.id), method: :patch, class: "btn btn-info btn-lg" %>
+ <% if session[:merchant_id] != @product.merchant.id %>
+ <%= link_to "Review Product", new_product_review_path(@product.id), method: :get, class: "btn btn-info btn-lg" %>
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+
Product Reviews
+
+ <%= render partial: "shared/reviews", locals: { review_set: @product.reviews } %>
+
+
+
+
+
+
+
Other Products You May Regret Buying!
+
+
+ <%= render partial: "shared/card", locals: { product_set: @featured_products } %>
+
+
+
+
diff --git a/app/views/reviews/_form.html.erb b/app/views/reviews/_form.html.erb
new file mode 100644
index 0000000000..00b57b67dc
--- /dev/null
+++ b/app/views/reviews/_form.html.erb
@@ -0,0 +1,31 @@
+<% if @review.errors.any? %>
+
+<% end %>
+
+Create new Review for <%= @product.name %>
+
+
+
Please enter the following information:
+
+ <%= form_with(model: [@product, @review], class: "user-form") do |f| %>
+ <%= f.hidden_field :product_id, value: @product.id %>
+
+
+ <%= f.label :rating %>
+ <%= f.select :rating, options_for_select(["choose a number", 1, 2, 3, 4, 5]) %>
+
+
+
+ <%= f.label :review_text %>
+ <%= f.text_field :review_text, class: "form-control-lg", placeholder: "(Optional)" %>
+
+
+ <%= f.submit "Submit", class: "btn btn-info btn-lg" %>
+ <% end %>
+
diff --git a/app/views/reviews/new.html.erb b/app/views/reviews/new.html.erb
new file mode 100644
index 0000000000..171a73c37d
--- /dev/null
+++ b/app/views/reviews/new.html.erb
@@ -0,0 +1 @@
+<%= render partial: "form", locals: { action_name: "New" } %>
\ No newline at end of file
diff --git a/app/views/shared/_card.html.erb b/app/views/shared/_card.html.erb
new file mode 100644
index 0000000000..d27ec4d8c4
--- /dev/null
+++ b/app/views/shared/_card.html.erb
@@ -0,0 +1,25 @@
+<% product_set.each do |product| %>
+
+
+ <%= link_to image_tag(product.photo_url, class: "card-img-top img"), product_path(product.id) %>
+
+
+
<%= link_to product.name, product_path(product.id) %>
+
Sold by: <%= link_to product.merchant.name.capitalize, merchant_path(product.merchant.id) %>
+
Price: <%= sprintf("$%2.2f", product.price) %>
+
+
+ <% if product.avg_rating %>
+ <%= render_rating(product.avg_rating) %>
+ <%else%>
+ <%= link_to "Be First to Review", new_product_review_path(product.id), method: :get %>
+ <%end%>
+
+
+
+ <%= link_to "Buy", add_to_cart_path(product.id), method: :patch, class: "btn btn-info sm-txt" %>
+ <%= link_to "Review", new_product_review_path(product.id), method: :get, class: "btn btn-info sm-txt" %>
+
+
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/shared/_merchants.html.erb b/app/views/shared/_merchants.html.erb
new file mode 100644
index 0000000000..f2e61ee860
--- /dev/null
+++ b/app/views/shared/_merchants.html.erb
@@ -0,0 +1,23 @@
+
+ <% merchant_set.each do |merchant| %>
+
+
+ <%= image_tag(merchant.avatar, class: "card-img-top profile") %>
+
+
+
Merchant: <%= link_to "#{merchant.name}", merchant_path(merchant.id) %>
+
+
+ Name: <%= merchant.name %>
+ Products Sold: <%= merchant.products.count %>
+ Average Review:
+ <%= render_rating(merchant.avgs_rating) %>
+
+
+
+
+ Joined <%= merchant.created_at.strftime("%B %d, %Y") %>
+
+
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/shared/_order.html.erb b/app/views/shared/_order.html.erb
new file mode 100644
index 0000000000..bbcb4ce219
--- /dev/null
+++ b/app/views/shared/_order.html.erb
@@ -0,0 +1,55 @@
+
+ <% order_set.each do |order| %>
+
+
+ <% order_items = OrderItem.items_by_order_merchant(order.id, session[:merchant_id]) %>
+
+
+
+ Order #:
+ Order Date:
+ Order Status:
+ Shipping Status:
+
+
+
+
+ <%= link_to order.id, order_path(order.id) %>
+ <%= order.created_at.strftime("%B %d, %Y") %>
+ <%= order.status.capitalize %>
+ <%= order_items[0].is_shipped ? "Shipped" : "Not Shipped" %>
+
+
+
+
+
Item(s) in this Order
+
+
+
+ Product
+ Quantity
+ Subtotal
+
+
+
+ <% order_items.each do |order_item| %>
+
+ <%= link_to order_item.product.name, product_path(order_item.product.id) %>
+ <%= "#{order_item.quantity}" %>
+ <%= sprintf("$%2.2f", order_item.product.price * order_item.quantity) %>
+
+ <% end %>
+
+
+
+
+
+
+ <% if !order_items[0].is_shipped && order.status == "paid" %>
+ <%= button_to "Ship Products", ship_path(order.id), method: :patch, class: "btn btn-info btn-lg" %>
+ <% end %>
+
+
+
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/shared/_order_details.erb b/app/views/shared/_order_details.erb
new file mode 100644
index 0000000000..5cfe7caf7e
--- /dev/null
+++ b/app/views/shared/_order_details.erb
@@ -0,0 +1,52 @@
+
+
+
+
Customer Details:
+
+
+ Customer Name: <%= @order.buyer_name %>
+ Email Address: <%= @order.email_address %>
+ Mail Address: <%= @order.mail_address %>
+ Last Four Digits of Credit Card: <%= @order.cc_num %>
+ Credit Card Expiration: <%= "#{@order.cc_exp[0..1]}/#{@order.cc_exp[2..3]}" %>
+
+
+
+
+
+
+
Order Details:
+
+
+
+ Order Date: <%= "#{@order.created_at.strftime("%B %d, %Y")}" %>
+ Order Status: <%= @order.status.capitalize %>
+ Order Revenue: <%= sprintf("$%2.2f", @order_revenue) %>
+ Shipping Status: <%= ship_status ? "Shipped" : "Not Shipped" %>
+
+
+
+
+
Product Details
+
+
+
+ Product
+ Quantity
+ Price
+ Subtotal
+
+
+
+ <% item_set.each do |order_item| %>
+
+ <%= link_to order_item.product.name, product_path(order_item.product.id) %>
+ <%= "Quantity: #{order_item.quantity}" %>
+ <%= "Price: #{sprintf("$%2.2f", order_item.product.price)}" %>
+ <%= sprintf("$%2.2f", order_item.product.price * order_item.quantity) %>
+
+ <% end %>
+
+
+
+
\ No newline at end of file
diff --git a/app/views/shared/_reviews.html.erb b/app/views/shared/_reviews.html.erb
new file mode 100644
index 0000000000..abd581b7d1
--- /dev/null
+++ b/app/views/shared/_reviews.html.erb
@@ -0,0 +1,21 @@
+
+ <% review_set.each do |review| %>
+
+
+
Unbiased Product Review:
+
<%= review.review_text %>
+
Rating:
+ <% if review.rating %>
+ <%= render_rating(review.rating) %>
+ <%else%>
+ <%= link_to "Be First to Review", new_product_review_path(@product.id), method: :get, class: "btn btn-info btn-lg" %>
+ <%end%>
+
+
+
+
+
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/shared/_searchcategories.html.erb b/app/views/shared/_searchcategories.html.erb
new file mode 100644
index 0000000000..88ed71baf6
--- /dev/null
+++ b/app/views/shared/_searchcategories.html.erb
@@ -0,0 +1,7 @@
+
+ <% category_set.each do |category| %>
+ <% if category.category %>
+ <%= link_to category.category, category_path(category.id), method: :get %>
+ <% end %>
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/shared/_searchmerchants.html.erb b/app/views/shared/_searchmerchants.html.erb
new file mode 100644
index 0000000000..4a2bb98059
--- /dev/null
+++ b/app/views/shared/_searchmerchants.html.erb
@@ -0,0 +1,7 @@
+
+ <% merchant_set.each do |merchant| %>
+ <% if merchant.name %>
+ <%= link_to merchant.name, merchant_path(merchant.id) %>
+ <% end %>
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/shared/_searchproducts.html.erb b/app/views/shared/_searchproducts.html.erb
new file mode 100644
index 0000000000..6aa5d78620
--- /dev/null
+++ b/app/views/shared/_searchproducts.html.erb
@@ -0,0 +1,26 @@
+<% product_set.each do |product| %>
+
+
+ <%= link_to image_tag(product.photo_url, class: "card-img-top img"), product_path(product.id) %>
+
+
+
<%= link_to product.name, product_path(product.id) %>
+
Sold by: <%= link_to product.merchant.name.capitalize, merchant_path(product.merchant.id) %>
+
Price: <%= sprintf("$%2.2f", product.price) %>
+
+
+ <% if product.avg_rating %>
+ <%= render_rating(product.avg_rating) %>
+ <%else%>
+ <%= link_to "Be First to Review", new_product_review_path(product.id), method: :get %>
+ <%end%>
+
+
+
+ <%= link_to "Buy", add_to_cart_path(product.id), method: :patch, class: "btn btn-info sm-txt" %>
+ <%= link_to "Review", new_product_review_path(product.id), method: :get, class: "btn btn-info sm-txt" %>
+ <%= link_to "Edit", edit_product_path(product.id), method: :get, class: "btn btn-info sm-txt" %>
+
+
+
+<% end %>
\ No newline at end of file
diff --git a/babel.config.js b/babel.config.js
new file mode 100644
index 0000000000..12f98da5af
--- /dev/null
+++ b/babel.config.js
@@ -0,0 +1,72 @@
+module.exports = function(api) {
+ var validEnv = ['development', 'test', 'production']
+ var currentEnv = api.env()
+ var isDevelopmentEnv = api.env('development')
+ var isProductionEnv = api.env('production')
+ var isTestEnv = api.env('test')
+
+ if (!validEnv.includes(currentEnv)) {
+ throw new Error(
+ 'Please specify a valid `NODE_ENV` or ' +
+ '`BABEL_ENV` environment variables. Valid values are "development", ' +
+ '"test", and "production". Instead, received: ' +
+ JSON.stringify(currentEnv) +
+ '.'
+ )
+ }
+
+ return {
+ presets: [
+ isTestEnv && [
+ '@babel/preset-env',
+ {
+ targets: {
+ node: 'current'
+ }
+ }
+ ],
+ (isProductionEnv || isDevelopmentEnv) && [
+ '@babel/preset-env',
+ {
+ forceAllTransforms: true,
+ useBuiltIns: 'entry',
+ corejs: 3,
+ modules: false,
+ exclude: ['transform-typeof-symbol']
+ }
+ ]
+ ].filter(Boolean),
+ plugins: [
+ 'babel-plugin-macros',
+ '@babel/plugin-syntax-dynamic-import',
+ isTestEnv && 'babel-plugin-dynamic-import-node',
+ '@babel/plugin-transform-destructuring',
+ [
+ '@babel/plugin-proposal-class-properties',
+ {
+ loose: true
+ }
+ ],
+ [
+ '@babel/plugin-proposal-object-rest-spread',
+ {
+ useBuiltIns: true
+ }
+ ],
+ [
+ '@babel/plugin-transform-runtime',
+ {
+ helpers: false,
+ regenerator: true,
+ corejs: false
+ }
+ ],
+ [
+ '@babel/plugin-transform-regenerator',
+ {
+ async: false
+ }
+ ]
+ ].filter(Boolean)
+ }
+}
diff --git a/bin/bundle b/bin/bundle
new file mode 100755
index 0000000000..a71368e323
--- /dev/null
+++ b/bin/bundle
@@ -0,0 +1,114 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'bundle' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require "rubygems"
+
+m = Module.new do
+ module_function
+
+ def invoked_as_script?
+ File.expand_path($0) == File.expand_path(__FILE__)
+ end
+
+ def env_var_version
+ ENV["BUNDLER_VERSION"]
+ end
+
+ def cli_arg_version
+ return unless invoked_as_script? # don't want to hijack other binstubs
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
+ bundler_version = nil
+ update_index = nil
+ ARGV.each_with_index do |a, i|
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
+ bundler_version = a
+ end
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
+ bundler_version = $1
+ update_index = i
+ end
+ bundler_version
+ end
+
+ def gemfile
+ gemfile = ENV["BUNDLE_GEMFILE"]
+ return gemfile if gemfile && !gemfile.empty?
+
+ File.expand_path("../../Gemfile", __FILE__)
+ end
+
+ def lockfile
+ lockfile =
+ case File.basename(gemfile)
+ when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
+ else "#{gemfile}.lock"
+ end
+ File.expand_path(lockfile)
+ end
+
+ def lockfile_version
+ return unless File.file?(lockfile)
+ lockfile_contents = File.read(lockfile)
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
+ Regexp.last_match(1)
+ end
+
+ def bundler_version
+ @bundler_version ||=
+ env_var_version || cli_arg_version ||
+ lockfile_version
+ end
+
+ def bundler_requirement
+ return "#{Gem::Requirement.default}.a" unless bundler_version
+
+ bundler_gem_version = Gem::Version.new(bundler_version)
+
+ requirement = bundler_gem_version.approximate_recommendation
+
+ return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
+
+ requirement += ".a" if bundler_gem_version.prerelease?
+
+ requirement
+ end
+
+ def load_bundler!
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
+
+ activate_bundler
+ end
+
+ def activate_bundler
+ gem_error = activation_error_handling do
+ gem "bundler", bundler_requirement
+ end
+ return if gem_error.nil?
+ require_error = activation_error_handling do
+ require "bundler/version"
+ end
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
+ exit 42
+ end
+
+ def activation_error_handling
+ yield
+ nil
+ rescue StandardError, LoadError => e
+ e
+ end
+end
+
+m.load_bundler!
+
+if m.invoked_as_script?
+ load Gem.bin_path("bundler", "bundle")
+end
diff --git a/bin/rails b/bin/rails
new file mode 100755
index 0000000000..5badb2fde0
--- /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', __dir__)
+require_relative '../config/boot'
+require 'rails/commands'
diff --git a/bin/rake b/bin/rake
new file mode 100755
index 0000000000..d87d5f5781
--- /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 0000000000..5853b5ea87
--- /dev/null
+++ b/bin/setup
@@ -0,0 +1,36 @@
+#!/usr/bin/env ruby
+require 'fileutils'
+
+# path to your application root.
+APP_ROOT = File.expand_path('..', __dir__)
+
+def system!(*args)
+ system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+FileUtils.chdir APP_ROOT do
+ # This script is a way to setup or update your development environment automatically.
+ # This script is idempotent, so that you can run it at anytime and get an expectable outcome.
+ # Add necessary setup steps to this file.
+
+ puts '== Installing dependencies =='
+ system! 'gem install bundler --conservative'
+ system('bundle check') || system!('bundle install')
+
+ # Install JavaScript dependencies
+ # system('bin/yarn')
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?('config/database.yml')
+ # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
+ # end
+
+ puts "\n== Preparing database =="
+ system! 'bin/rails db:prepare'
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! 'bin/rails log:clear tmp:clear'
+
+ puts "\n== Restarting application server =="
+ system! 'bin/rails restart'
+end
diff --git a/bin/spring b/bin/spring
new file mode 100755
index 0000000000..d89ee495fa
--- /dev/null
+++ b/bin/spring
@@ -0,0 +1,17 @@
+#!/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)
+ spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
+ if 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/bin/webpack b/bin/webpack
new file mode 100755
index 0000000000..1031168d01
--- /dev/null
+++ b/bin/webpack
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+
+ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
+ENV["NODE_ENV"] ||= "development"
+
+require "pathname"
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require "bundler/setup"
+
+require "webpacker"
+require "webpacker/webpack_runner"
+
+APP_ROOT = File.expand_path("..", __dir__)
+Dir.chdir(APP_ROOT) do
+ Webpacker::WebpackRunner.run(ARGV)
+end
diff --git a/bin/webpack-dev-server b/bin/webpack-dev-server
new file mode 100755
index 0000000000..dd9662737a
--- /dev/null
+++ b/bin/webpack-dev-server
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+
+ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
+ENV["NODE_ENV"] ||= "development"
+
+require "pathname"
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
+ Pathname.new(__FILE__).realpath)
+
+require "bundler/setup"
+
+require "webpacker"
+require "webpacker/dev_server_runner"
+
+APP_ROOT = File.expand_path("..", __dir__)
+Dir.chdir(APP_ROOT) do
+ Webpacker::DevServerRunner.run(ARGV)
+end
diff --git a/bin/yarn b/bin/yarn
new file mode 100755
index 0000000000..460dd565b4
--- /dev/null
+++ b/bin/yarn
@@ -0,0 +1,11 @@
+#!/usr/bin/env ruby
+APP_ROOT = File.expand_path('..', __dir__)
+Dir.chdir(APP_ROOT) do
+ begin
+ exec "yarnpkg", *ARGV
+ rescue Errno::ENOENT
+ $stderr.puts "Yarn executable was not detected in the system."
+ $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
+ exit 1
+ end
+end
diff --git a/config.ru b/config.ru
new file mode 100644
index 0000000000..441e6ff0c3
--- /dev/null
+++ b/config.ru
@@ -0,0 +1,5 @@
+# This file is used by Rack-based servers to start the application.
+
+require_relative "config/environment"
+
+run Rails.application
diff --git a/config/application.rb b/config/application.rb
new file mode 100644
index 0000000000..26fdcd0f52
--- /dev/null
+++ b/config/application.rb
@@ -0,0 +1,23 @@
+require_relative "boot"
+
+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 Betsy
+ class Application < Rails::Application
+ config.generators do |g|
+ # Force new test files to be generated in the minitest-spec style
+ g.test_framework :minitest, spec: true
+ end
+ # Initialize configuration defaults for originally generated Rails version.
+ config.load_defaults 6.0
+
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration can go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded after loading
+ # the framework and any gems in your application.
+ end
+end
diff --git a/config/boot.rb b/config/boot.rb
new file mode 100644
index 0000000000..988a5ddc46
--- /dev/null
+++ b/config/boot.rb
@@ -0,0 +1,4 @@
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+require "bundler/setup" # Set up gems listed in the Gemfile.
+require "bootsnap/setup" # Speed up boot time by caching expensive operations.
diff --git a/config/cable.yml b/config/cable.yml
new file mode 100644
index 0000000000..f2a452f546
--- /dev/null
+++ b/config/cable.yml
@@ -0,0 +1,10 @@
+development:
+ adapter: async
+
+test:
+ adapter: test
+
+production:
+ adapter: redis
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
+ channel_prefix: betsy_production
diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc
new file mode 100644
index 0000000000..9cd4b887f9
--- /dev/null
+++ b/config/credentials.yml.enc
@@ -0,0 +1 @@
+oZsn0MohJ566Fvhrf2lbjdouN5dB0ngAdPAHMAtK/rjYI4V6gXJuHi1Si54/Fe4XErcY7nEkmpPhKtl7PLL26vwdzjzjSJ0+P3BS1MEHOneuNWxODtnN37+bHOka8LbDdqHWls/y6I3OPuUKphgoMbLAYIqVbuEDPCDSEOHcO3Ekcy3xFaA26i6FlStqwdZdPxYLvq836j+62edn5E0HlAym55/AO29pVj7HyV0h/6M4UqkDoon5P16c+jEZMYYMtApYrFndzeTnogE3kVkJFU+wXgjRsckAbBHoz42CT4Oze/cNSJUyANZDs9VLzdPNHLKDVMUoR8Lg0KVTVGi23fgqr43V8PzcF2KJ5Ih4JuvaGQXPin7g+eOQ1nNSaVJWeUBKVlmzNFCp1M9sYpXpo0l4HHOFmJ3/MmK9--XYYCBnEKKMXIJT/o--NiiqDuacxgpBGJSirmLtfQ==
\ No newline at end of file
diff --git a/config/database.yml b/config/database.yml
new file mode 100644
index 0000000000..8b9bc23f0c
--- /dev/null
+++ b/config/database.yml
@@ -0,0 +1,85 @@
+# PostgreSQL. Versions 9.3 and up are supported.
+#
+# Install the pg driver:
+# gem install pg
+# On macOS with Homebrew:
+# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
+# On macOS with MacPorts:
+# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
+# On Windows:
+# gem install pg
+# Choose the win32 build.
+# Install PostgreSQL and put its /bin directory on your path.
+#
+# Configure Using Gemfile
+# gem 'pg'
+#
+default: &default
+ adapter: postgresql
+ encoding: unicode
+ # For details on connection pooling, see Rails configuration guide
+ # https://guides.rubyonrails.org/configuring.html#database-pooling
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
+
+development:
+ <<: *default
+ database: betsy_development
+
+ # The specified database role being used to connect to postgres.
+ # To create additional roles in postgres see `$ createuser --help`.
+ # When left blank, postgres will use the default role. This is
+ # the same name as the operating system user that initialized the database.
+ #username: betsy
+
+ # The password associated with the postgres role (username).
+ #password:
+
+ # Connect on a TCP socket. Omitted by default since the client uses a
+ # domain socket that doesn't need configuration. Windows does not have
+ # domain sockets, so uncomment these lines.
+ #host: localhost
+
+ # The TCP port the server listens on. Defaults to 5432.
+ # If your server runs on a different port number, change accordingly.
+ #port: 5432
+
+ # Schema search path. The server defaults to $user,public
+ #schema_search_path: myapp,sharedapp,public
+
+ # Minimum log levels, in increasing order:
+ # debug5, debug4, debug3, debug2, debug1,
+ # log, notice, warning, error, fatal, and panic
+ # Defaults to warning.
+ #min_messages: notice
+
+# 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: betsy_test
+
+# As with config/credentials.yml, you never want to store sensitive information,
+# like your database password, in your source code. If your source code is
+# ever seen by anyone, they now have access to your database.
+#
+# Instead, provide the password as a unix environment variable when you boot
+# the app. Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
+# for a full rundown on how to provide these environment variables in a
+# production deployment.
+#
+# On Heroku and other platform providers, you may have a full connection URL
+# available as an environment variable. For example:
+#
+# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
+#
+# You can use this database configuration with:
+#
+# production:
+# url: <%= ENV['DATABASE_URL'] %>
+#
+production:
+ <<: *default
+ database: betsy_production
+ username: betsy
+ password: <%= ENV['BETSY_DATABASE_PASSWORD'] %>
diff --git a/config/environment.rb b/config/environment.rb
new file mode 100644
index 0000000000..cac5315775
--- /dev/null
+++ b/config/environment.rb
@@ -0,0 +1,5 @@
+# Load the Rails application.
+require_relative "application"
+
+# Initialize the Rails application.
+Rails.application.initialize!
diff --git a/config/environments/development.rb b/config/environments/development.rb
new file mode 100644
index 0000000000..5fea334760
--- /dev/null
+++ b/config/environments/development.rb
@@ -0,0 +1,62 @@
+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.
+ config.consider_all_requests_local = true
+
+ # Enable/disable caching. By default caching is disabled.
+ # Run rails dev:cache to toggle caching.
+ if Rails.root.join("tmp", "caching-dev.txt").exist?
+ config.action_controller.perform_caching = true
+ config.action_controller.enable_fragment_cache_logging = true
+
+ config.cache_store = :memory_store
+ config.public_file_server.headers = {
+ "Cache-Control" => "public, max-age=#{2.days.to_i}",
+ }
+ else
+ config.action_controller.perform_caching = false
+
+ config.cache_store = :null_store
+ end
+
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ config.active_storage.service = :local
+
+ # Don't care if the mailer can't send.
+ config.action_mailer.raise_delivery_errors = false
+
+ config.action_mailer.perform_caching = 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
+
+ # Highlight code that triggered database queries in logs.
+ config.active_record.verbose_query_logs = true
+
+ # 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
+
+ # Suppress logger output for asset requests.
+ config.assets.quiet = true
+
+ # Raises error for missing translations.
+ # config.action_view.raise_on_missing_translations = true
+
+ # Use an evented file watcher to asynchronously detect changes in source code,
+ # routes, locales, etc. This feature depends on the listen gem.
+ config.file_watcher = ActiveSupport::EventedFileUpdateChecker
+end
diff --git a/config/environments/production.rb b/config/environments/production.rb
new file mode 100644
index 0000000000..48d16c6de5
--- /dev/null
+++ b/config/environments/production.rb
@@ -0,0 +1,112 @@
+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
+
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
+ # config.require_master_key = true
+
+ # Disable serving static files from the `/public` folder by default since
+ # Apache or NGINX already handles this.
+ config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
+
+ # Compress CSS using a preprocessor.
+ # config.assets.css_compressor = :sass
+
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
+ config.assets.compile = false
+
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
+ # config.action_controller.asset_host = 'http://assets.example.com'
+
+ # 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
+
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ config.active_storage.service = :local
+
+ # Mount Action Cable outside main process or domain.
+ # config.action_cable.mount_path = nil
+ # config.action_cable.url = 'wss://example.com/cable'
+ # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
+
+ # 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 = [:request_id]
+
+ # Use a different cache store in production.
+ # config.cache_store = :mem_cache_store
+
+ # Use a real queuing backend for Active Job (and separate queues per environment).
+ # config.active_job.queue_adapter = :resque
+ # config.active_job.queue_name_prefix = "betsy_production"
+
+ config.action_mailer.perform_caching = false
+
+ # 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
+
+ # Use a different logger for distributed setups.
+ # require 'syslog/logger'
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
+
+ if ENV["RAILS_LOG_TO_STDOUT"].present?
+ logger = ActiveSupport::Logger.new(STDOUT)
+ logger.formatter = config.log_formatter
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
+ end
+
+ # Do not dump schema after migrations.
+ config.active_record.dump_schema_after_migration = false
+
+ # Inserts middleware to perform automatic connection switching.
+ # The `database_selector` hash is used to pass options to the DatabaseSelector
+ # middleware. The `delay` is used to determine how long to wait after a write
+ # to send a subsequent read to the primary.
+ #
+ # The `database_resolver` class is used by the middleware to determine which
+ # database is appropriate to use based on the time delay.
+ #
+ # The `database_resolver_context` class is used by the middleware to set
+ # timestamps for the last write to the primary. The resolver uses the context
+ # class timestamps to determine how long to wait before reading from the
+ # replica.
+ #
+ # By default Rails will store a last write timestamp in the session. The
+ # DatabaseSelector middleware is designed as such you can define your own
+ # strategy for connection switching and pass that into the middleware through
+ # these configuration options.
+ # config.active_record.database_selector = { delay: 2.seconds }
+ # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
+ # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
+end
diff --git a/config/environments/test.rb b/config/environments/test.rb
new file mode 100644
index 0000000000..afcfa01caa
--- /dev/null
+++ b/config/environments/test.rb
@@ -0,0 +1,49 @@
+# 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!
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ config.cache_classes = false
+ config.action_view.cache_template_loading = 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 public file server for tests with Cache-Control for performance.
+ config.public_file_server.enabled = true
+ config.public_file_server.headers = {
+ "Cache-Control" => "public, max-age=#{1.hour.to_i}",
+ }
+
+ # Show full error reports and disable caching.
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+ config.cache_store = :null_store
+
+ # 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
+
+ # Store uploaded files on the local file system in a temporary directory.
+ config.active_storage.service = :test
+
+ config.action_mailer.perform_caching = 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
+
+ # 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/action_view.rb b/config/initializers/action_view.rb
new file mode 100644
index 0000000000..142d382f87
--- /dev/null
+++ b/config/initializers/action_view.rb
@@ -0,0 +1 @@
+Rails.application.config.action_view.form_with_generates_remote_forms = false
diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb
new file mode 100644
index 0000000000..89d2efab2b
--- /dev/null
+++ b/config/initializers/application_controller_renderer.rb
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+# ActiveSupport::Reloader.to_prepare do
+# ApplicationController.renderer.defaults.merge!(
+# http_host: 'example.org',
+# https: false
+# )
+# end
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
new file mode 100644
index 0000000000..c1f948d018
--- /dev/null
+++ b/config/initializers/assets.rb
@@ -0,0 +1,14 @@
+# 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
+# Add Yarn node_modules folder to the asset load path.
+Rails.application.config.assets.paths << Rails.root.join("node_modules")
+
+# Precompile additional assets.
+# application.js, application.css, and all non-JS/CSS in the app/assets
+# folder are already added.
+# Rails.application.config.assets.precompile += %w( admin.js admin.css )
diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb
new file mode 100644
index 0000000000..59385cdf37
--- /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/content_security_policy.rb b/config/initializers/content_security_policy.rb
new file mode 100644
index 0000000000..35d0f26fcd
--- /dev/null
+++ b/config/initializers/content_security_policy.rb
@@ -0,0 +1,30 @@
+# Be sure to restart your server when you modify this file.
+
+# Define an application-wide content security policy
+# For further information see the following documentation
+# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
+
+# Rails.application.config.content_security_policy do |policy|
+# policy.default_src :self, :https
+# policy.font_src :self, :https, :data
+# policy.img_src :self, :https, :data
+# policy.object_src :none
+# policy.script_src :self, :https
+# policy.style_src :self, :https
+# # If you are using webpack-dev-server then specify webpack-dev-server host
+# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
+
+# # Specify URI for violation reports
+# # policy.report_uri "/csp-violation-report-endpoint"
+# end
+
+# If you are using UJS then enable automatic nonce generation
+# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
+
+# Set the nonce only to specific directives
+# Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
+
+# Report CSP violations to a specified URI
+# For further information see the following documentation:
+# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
+# Rails.application.config.content_security_policy_report_only = true
diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb
new file mode 100644
index 0000000000..5a6a32d371
--- /dev/null
+++ b/config/initializers/cookies_serializer.rb
@@ -0,0 +1,5 @@
+# Be sure to restart your server when you modify this file.
+
+# Specify a serializer for the signed and encrypted cookie jars.
+# Valid options are :json, :marshal, and :hybrid.
+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 0000000000..4a994e1e7b
--- /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 0000000000..ac033bf9dc
--- /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 0000000000..dc1899682b
--- /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/omniauth.rb b/config/initializers/omniauth.rb
new file mode 100644
index 0000000000..ef8c60c371
--- /dev/null
+++ b/config/initializers/omniauth.rb
@@ -0,0 +1,4 @@
+# config/initializers/omniauth.rb
+Rails.application.config.middleware.use OmniAuth::Builder do
+ provider :github, ENV["GITHUB_CLIENT_ID"], ENV["GITHUB_CLIENT_SECRET"], scope: "user:email"
+end
diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb
new file mode 100644
index 0000000000..bbfc3961bf
--- /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]
+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 0000000000..cf9b342d0a
--- /dev/null
+++ b/config/locales/en.yml
@@ -0,0 +1,33 @@
+# 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.
+#
+# The following keys must be escaped otherwise they will not be retrieved by
+# the default I18n backend:
+#
+# true, false, on, off, yes, no
+#
+# Instead, surround them with single quotes.
+#
+# en:
+# 'true': 'foo'
+#
+# To learn more, please read the Rails Internationalization guide
+# available at https://guides.rubyonrails.org/i18n.html.
+
+en:
+ hello: "Hello world"
diff --git a/config/puma.rb b/config/puma.rb
new file mode 100644
index 0000000000..2d3d969833
--- /dev/null
+++ b/config/puma.rb
@@ -0,0 +1,38 @@
+# Puma can serve each request in a thread from an internal thread pool.
+# The `threads` method setting takes two numbers: a minimum and maximum.
+# Any libraries that use thread pools should be configured to match
+# the maximum value specified for Puma. Default is set to 5 threads for minimum
+# and maximum; this matches the default thread size of Active Record.
+#
+max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
+min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
+threads min_threads_count, max_threads_count
+
+# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
+#
+port ENV.fetch("PORT") { 3000 }
+
+# Specifies the `environment` that Puma will run in.
+#
+environment ENV.fetch("RAILS_ENV") { "development" }
+
+# Specifies the `pidfile` that Puma will use.
+pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
+
+# Specifies the number of `workers` to boot in clustered mode.
+# Workers are forked web server processes. If using threads and workers together
+# the concurrency of the application would be max `threads` * `workers`.
+# Workers do not work on JRuby or Windows (both of which do not support
+# processes).
+#
+# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
+
+# Use the `preload_app!` method when specifying a `workers` number.
+# This directive tells Puma to first boot the application and load code
+# before forking the application. This takes advantage of Copy On Write
+# process behavior so workers use less memory.
+#
+# preload_app!
+
+# Allow puma to be restarted by `rails restart` command.
+plugin :tmp_restart
diff --git a/config/routes.rb b/config/routes.rb
new file mode 100644
index 0000000000..166ffba484
--- /dev/null
+++ b/config/routes.rb
@@ -0,0 +1,40 @@
+Rails.application.routes.draw do
+ root to: "homepages#root"
+
+ # Merchant dashboard
+ get "/merchants/dashboard", to: "merchants#dashboard", as: "dashboard"
+
+ # Purchase confirmation/receipt
+ get "/orders/receipt", to: "orders#receipt", as: "receipt"
+ get "/orders/confirm", to: "orders#confirm", as: "confirm"
+ patch "/orders/purchase", to: "orders#purchase", as: "purchase"
+
+ # Merchant order management
+ patch "/orders/:id/ship", to: "orders#ship", as: "ship"
+ patch "/orders/:id/cancel", to: "orders#cancel", as: "cancel"
+ patch "/orders/:id/complete", to: "orders#complete", as: "complete"
+
+ # Custom cart routes
+ patch "/products/:id/add_to_cart", to: "products#add_to_cart", as: "add_to_cart"
+ patch "/products/:id/remove_from_cart", to: "products#remove_from_cart", as: "remove_from_cart"
+ patch "/products/:id/delete_from_cart", to: "products#delete_from_cart", as: "delete_from_cart"
+
+ # Custom product routes
+ patch "/products/:id/retire", to: "products#retire", as: "retire"
+ get "products/search", to: "products#search", as: "search"
+
+ # Github authorization
+ get "/auth/github", as: "github_login"
+ get "/auth/:provider/callback", to: "merchants#create", as: "omniauth_callback"
+ post "/logout", to: "merchants#logout", as: "logout"
+
+ #RESTful Routes
+ resources :categories, only: [:show, :new, :create]
+ resources :orders, except: [:index]
+ resources :merchants, only: [:show, :create]
+
+ resources :products do
+ resources :categories
+ resources :reviews, only: [:new, :create]
+ end
+end
diff --git a/config/spring.rb b/config/spring.rb
new file mode 100644
index 0000000000..db5bf1307a
--- /dev/null
+++ b/config/spring.rb
@@ -0,0 +1,6 @@
+Spring.watch(
+ ".ruby-version",
+ ".rbenv-vars",
+ "tmp/restart.txt",
+ "tmp/caching-dev.txt"
+)
diff --git a/config/storage.yml b/config/storage.yml
new file mode 100644
index 0000000000..d32f76e8fb
--- /dev/null
+++ b/config/storage.yml
@@ -0,0 +1,34 @@
+test:
+ service: Disk
+ root: <%= Rails.root.join("tmp/storage") %>
+
+local:
+ service: Disk
+ root: <%= Rails.root.join("storage") %>
+
+# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
+# amazon:
+# service: S3
+# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
+# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
+# region: us-east-1
+# bucket: your_own_bucket
+
+# Remember not to checkin your GCS keyfile to a repository
+# google:
+# service: GCS
+# project: your_project
+# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
+# bucket: your_own_bucket
+
+# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
+# microsoft:
+# service: AzureStorage
+# storage_account_name: your_account_name
+# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
+# container: your_container_name
+
+# mirror:
+# service: Mirror
+# primary: local
+# mirrors: [ amazon, google, microsoft ]
diff --git a/config/webpack/development.js b/config/webpack/development.js
new file mode 100644
index 0000000000..c5edff94ad
--- /dev/null
+++ b/config/webpack/development.js
@@ -0,0 +1,5 @@
+process.env.NODE_ENV = process.env.NODE_ENV || 'development'
+
+const environment = require('./environment')
+
+module.exports = environment.toWebpackConfig()
diff --git a/config/webpack/environment.js b/config/webpack/environment.js
new file mode 100644
index 0000000000..1a4f73eecb
--- /dev/null
+++ b/config/webpack/environment.js
@@ -0,0 +1,13 @@
+const { environment } = require('@rails/webpacker')
+
+module.exports = environment
+
+const webpack = require('webpack')
+environment.plugins.append(
+ 'Provide',
+ new webpack.ProvidePlugin({
+ $: 'jquery',
+ jQuery: 'jquery',
+ Popper: ['popper.js', 'default']
+ })
+)
diff --git a/config/webpack/production.js b/config/webpack/production.js
new file mode 100644
index 0000000000..be0f53aacf
--- /dev/null
+++ b/config/webpack/production.js
@@ -0,0 +1,5 @@
+process.env.NODE_ENV = process.env.NODE_ENV || 'production'
+
+const environment = require('./environment')
+
+module.exports = environment.toWebpackConfig()
diff --git a/config/webpack/test.js b/config/webpack/test.js
new file mode 100644
index 0000000000..c5edff94ad
--- /dev/null
+++ b/config/webpack/test.js
@@ -0,0 +1,5 @@
+process.env.NODE_ENV = process.env.NODE_ENV || 'development'
+
+const environment = require('./environment')
+
+module.exports = environment.toWebpackConfig()
diff --git a/config/webpacker.yml b/config/webpacker.yml
new file mode 100644
index 0000000000..8581ac0472
--- /dev/null
+++ b/config/webpacker.yml
@@ -0,0 +1,96 @@
+# Note: You must restart bin/webpack-dev-server for changes to take effect
+
+default: &default
+ source_path: app/javascript
+ source_entry_path: packs
+ public_root_path: public
+ public_output_path: packs
+ cache_path: tmp/cache/webpacker
+ check_yarn_integrity: false
+ webpack_compile_output: true
+
+ # Additional paths webpack should lookup modules
+ # ['app/assets', 'engine/foo/app/assets']
+ resolved_paths: []
+
+ # Reload manifest.json on all requests so we reload latest compiled packs
+ cache_manifest: false
+
+ # Extract and emit a css file
+ extract_css: false
+
+ static_assets_extensions:
+ - .jpg
+ - .jpeg
+ - .png
+ - .gif
+ - .tiff
+ - .ico
+ - .svg
+ - .eot
+ - .otf
+ - .ttf
+ - .woff
+ - .woff2
+
+ extensions:
+ - .mjs
+ - .js
+ - .sass
+ - .scss
+ - .css
+ - .module.sass
+ - .module.scss
+ - .module.css
+ - .png
+ - .svg
+ - .gif
+ - .jpeg
+ - .jpg
+
+development:
+ <<: *default
+ compile: true
+
+ # Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules
+ check_yarn_integrity: true
+
+ # Reference: https://webpack.js.org/configuration/dev-server/
+ dev_server:
+ https: false
+ host: localhost
+ port: 3035
+ public: localhost:3035
+ hmr: false
+ # Inline should be set to true if using HMR
+ inline: true
+ overlay: true
+ compress: true
+ disable_host_check: true
+ use_local_ip: false
+ quiet: false
+ pretty: false
+ headers:
+ 'Access-Control-Allow-Origin': '*'
+ watch_options:
+ ignored: '**/node_modules/**'
+
+
+test:
+ <<: *default
+ compile: true
+
+ # Compile test packs to a separate directory
+ public_output_path: packs-test
+
+production:
+ <<: *default
+
+ # Production depends on precompilation of packs prior to booting for performance.
+ compile: false
+
+ # Extract and emit a css file
+ extract_css: true
+
+ # Cache manifest.json for performance
+ cache_manifest: true
diff --git a/coverage/.resultset.json.lock b/coverage/.resultset.json.lock
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_asc.png b/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_asc.png
new file mode 100644
index 0000000000..e1ba61a805
Binary files /dev/null and b/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_asc.png differ
diff --git a/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_asc_disabled.png b/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_asc_disabled.png
new file mode 100644
index 0000000000..fb11dfe24a
Binary files /dev/null and b/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_asc_disabled.png differ
diff --git a/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_both.png b/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_both.png
new file mode 100644
index 0000000000..af5bc7c5a1
Binary files /dev/null and b/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_both.png differ
diff --git a/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_desc.png b/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_desc.png
new file mode 100644
index 0000000000..0e156deb5f
Binary files /dev/null and b/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_desc.png differ
diff --git a/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_desc_disabled.png b/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_desc_disabled.png
new file mode 100644
index 0000000000..c9fdd8a150
Binary files /dev/null and b/coverage/assets/0.12.2/DataTables-1.10.20/images/sort_desc_disabled.png differ
diff --git a/coverage/assets/0.12.2/application.css b/coverage/assets/0.12.2/application.css
new file mode 100644
index 0000000000..916699ed2a
--- /dev/null
+++ b/coverage/assets/0.12.2/application.css
@@ -0,0 +1 @@
+html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,code,del,dfn,em,img,q,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,dialog,figure,footer,header,hgroup,nav,section{margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline}article,aside,dialog,figure,footer,header,hgroup,nav,section{display:block}body{line-height:1.5}table{border-collapse:separate;border-spacing:0}caption,th,td{text-align:left;font-weight:normal}table,td,th{vertical-align:middle}blockquote:before,blockquote:after,q:before,q:after{content:""}blockquote,q{quotes:"" ""}a img{border:0}html{font-size:100.01%}body{font-size:82%;color:#222;background:#fff;font-family:"Helvetica Neue",Arial,Helvetica,sans-serif}h1,h2,h3,h4,h5,h6{font-weight:normal;color:#111}h1{font-size:3em;line-height:1;margin-bottom:.5em}h2{font-size:2em;margin-bottom:.75em}h3{font-size:1.5em;line-height:1;margin-bottom:1em}h4{font-size:1.2em;line-height:1.25;margin-bottom:1.25em}h5{font-size:1em;font-weight:bold;margin-bottom:1.5em}h6{font-size:1em;font-weight:bold}h1 img,h2 img,h3 img,h4 img,h5 img,h6 img{margin:0}p{margin:0 0 1.5em}p img.left{float:left;margin:1.5em 1.5em 1.5em 0;padding:0}p img.right{float:right;margin:1.5em 0 1.5em 1.5em}a:focus,a:hover{color:#000}a{color:#009;text-decoration:underline}blockquote{margin:1.5em;color:#666;font-style:italic}strong{font-weight:bold}em,dfn{font-style:italic}dfn{font-weight:bold}sup,sub{line-height:0}abbr,acronym{border-bottom:1px dotted #666}address{margin:0 0 1.5em;font-style:italic}del{color:#666}pre{margin:1.5em 0;white-space:pre}pre,code,tt{font:1em 'andale mono','lucida console',monospace;line-height:1.5}li ul,li ol{margin:0}ul,ol{margin:0 1.5em 1.5em 0;padding-left:3.333em}ul{list-style-type:disc}ol{list-style-type:decimal}dl{margin:0 0 1.5em 0}dl dt{font-weight:bold}dd{margin-left:1.5em}table{margin-bottom:1.4em;width:100%}th{font-weight:bold}thead th{background:#c3d9ff}th,td,caption{padding:4px 10px 4px 5px}tr.even td{background:#efefef}tfoot{font-style:italic}caption{background:#eee}.small{font-size:.8em;margin-bottom:1.875em;line-height:1.875em}.large{font-size:1.2em;line-height:2.5em;margin-bottom:1.25em}.hide{display:none}.quiet{color:#666}.loud{color:#000}.highlight{background:#ff0}.added{background:#060;color:#fff}.removed{background:#900;color:#fff}.first{margin-left:0;padding-left:0}.last{margin-right:0;padding-right:0}.top{margin-top:0;padding-top:0}.bottom{margin-bottom:0;padding-bottom:0}label{font-weight:bold}fieldset{padding:1.4em;margin:0 0 1.5em 0;border:1px solid #ccc}legend{font-weight:bold;font-size:1.2em}input[type=text],input[type=password],input.text,input.title,textarea,select{background-color:#fff;border:1px solid #bbb}input[type=text]:focus,input[type=password]:focus,input.text:focus,input.title:focus,textarea:focus,select:focus{border-color:#666}input[type=text],input[type=password],input.text,input.title,textarea,select{margin:.5em 0}input.text,input.title{width:300px;padding:5px}input.title{font-size:1.5em}textarea{width:390px;height:250px;padding:5px}input[type=checkbox],input[type=radio],input.checkbox,input.radio{position:relative;top:.25em}form.inline{line-height:3}form.inline p{margin-bottom:0}.error,.notice,.success{padding:.8em;margin-bottom:1em;border:2px solid #ddd}.error{background:#fbe3e4;color:#8a1f11;border-color:#fbc2c4}.notice{background:#fff6bf;color:#514721;border-color:#ffd324}.success{background:#e6efc2;color:#264409;border-color:#c6d880}.error a{color:#8a1f11}.notice a{color:#514721}.success a{color:#264409}.box{padding:1.5em;margin-bottom:1.5em;background:#e5ecf9}hr{background:#ddd;color:#ddd;clear:both;float:none;width:100%;height:.1em;margin:0 0 1.45em;border:0}hr.space{background:#fff;color:#fff;visibility:hidden}.clearfix:after,.container:after{content:"\0020";display:block;height:0;clear:both;visibility:hidden;overflow:hidden}.clearfix,.container{display:block}.clear{clear:both}table.dataTable{width:100%;margin:0 auto;clear:both;border-collapse:separate;border-spacing:0}table.dataTable thead th,table.dataTable tfoot th{font-weight:bold}table.dataTable thead th,table.dataTable thead td{padding:10px 18px;border-bottom:1px solid #111}table.dataTable thead th:active,table.dataTable thead td:active{outline:0}table.dataTable tfoot th,table.dataTable tfoot td{padding:10px 18px 6px 18px;border-top:1px solid #111}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{cursor:pointer;*cursor:hand;background-repeat:no-repeat;background-position:center right}table.dataTable thead .sorting{background-image:url("DataTables-1.10.20/images/sort_both.png")}table.dataTable thead .sorting_asc{background-image:url("DataTables-1.10.20/images/sort_asc.png")}table.dataTable thead .sorting_desc{background-image:url("DataTables-1.10.20/images/sort_desc.png")}table.dataTable thead .sorting_asc_disabled{background-image:url("DataTables-1.10.20/images/sort_asc_disabled.png")}table.dataTable thead .sorting_desc_disabled{background-image:url("DataTables-1.10.20/images/sort_desc_disabled.png")}table.dataTable tbody tr{background-color:#fff}table.dataTable tbody tr.selected{background-color:#b0bed9}table.dataTable tbody th,table.dataTable tbody td{padding:8px 10px}table.dataTable.row-border tbody th,table.dataTable.row-border tbody td,table.dataTable.display tbody th,table.dataTable.display tbody td{border-top:1px solid #ddd}table.dataTable.row-border tbody tr:first-child th,table.dataTable.row-border tbody tr:first-child td,table.dataTable.display tbody tr:first-child th,table.dataTable.display tbody tr:first-child td{border-top:0}table.dataTable.cell-border tbody th,table.dataTable.cell-border tbody td{border-top:1px solid #ddd;border-right:1px solid #ddd}table.dataTable.cell-border tbody tr th:first-child,table.dataTable.cell-border tbody tr td:first-child{border-left:1px solid #ddd}table.dataTable.cell-border tbody tr:first-child th,table.dataTable.cell-border tbody tr:first-child td{border-top:0}table.dataTable.stripe tbody tr.odd,table.dataTable.display tbody tr.odd{background-color:#f9f9f9}table.dataTable.stripe tbody tr.odd.selected,table.dataTable.display tbody tr.odd.selected{background-color:#acbad4}table.dataTable.hover tbody tr:hover,table.dataTable.display tbody tr:hover{background-color:#f6f6f6}table.dataTable.hover tbody tr:hover.selected,table.dataTable.display tbody tr:hover.selected{background-color:#aab7d1}table.dataTable.order-column tbody tr>.sorting_1,table.dataTable.order-column tbody tr>.sorting_2,table.dataTable.order-column tbody tr>.sorting_3,table.dataTable.display tbody tr>.sorting_1,table.dataTable.display tbody tr>.sorting_2,table.dataTable.display tbody tr>.sorting_3{background-color:#fafafa}table.dataTable.order-column tbody tr.selected>.sorting_1,table.dataTable.order-column tbody tr.selected>.sorting_2,table.dataTable.order-column tbody tr.selected>.sorting_3,table.dataTable.display tbody tr.selected>.sorting_1,table.dataTable.display tbody tr.selected>.sorting_2,table.dataTable.display tbody tr.selected>.sorting_3{background-color:#acbad5}table.dataTable.display tbody tr.odd>.sorting_1,table.dataTable.order-column.stripe tbody tr.odd>.sorting_1{background-color:#f1f1f1}table.dataTable.display tbody tr.odd>.sorting_2,table.dataTable.order-column.stripe tbody tr.odd>.sorting_2{background-color:#f3f3f3}table.dataTable.display tbody tr.odd>.sorting_3,table.dataTable.order-column.stripe tbody tr.odd>.sorting_3{background-color:whitesmoke}table.dataTable.display tbody tr.odd.selected>.sorting_1,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_1{background-color:#a6b4cd}table.dataTable.display tbody tr.odd.selected>.sorting_2,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_2{background-color:#a8b5cf}table.dataTable.display tbody tr.odd.selected>.sorting_3,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_3{background-color:#a9b7d1}table.dataTable.display tbody tr.even>.sorting_1,table.dataTable.order-column.stripe tbody tr.even>.sorting_1{background-color:#fafafa}table.dataTable.display tbody tr.even>.sorting_2,table.dataTable.order-column.stripe tbody tr.even>.sorting_2{background-color:#fcfcfc}table.dataTable.display tbody tr.even>.sorting_3,table.dataTable.order-column.stripe tbody tr.even>.sorting_3{background-color:#fefefe}table.dataTable.display tbody tr.even.selected>.sorting_1,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_1{background-color:#acbad5}table.dataTable.display tbody tr.even.selected>.sorting_2,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_2{background-color:#aebcd6}table.dataTable.display tbody tr.even.selected>.sorting_3,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_3{background-color:#afbdd8}table.dataTable.display tbody tr:hover>.sorting_1,table.dataTable.order-column.hover tbody tr:hover>.sorting_1{background-color:#eaeaea}table.dataTable.display tbody tr:hover>.sorting_2,table.dataTable.order-column.hover tbody tr:hover>.sorting_2{background-color:#ececec}table.dataTable.display tbody tr:hover>.sorting_3,table.dataTable.order-column.hover tbody tr:hover>.sorting_3{background-color:#efefef}table.dataTable.display tbody tr:hover.selected>.sorting_1,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_1{background-color:#a2aec7}table.dataTable.display tbody tr:hover.selected>.sorting_2,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_2{background-color:#a3b0c9}table.dataTable.display tbody tr:hover.selected>.sorting_3,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_3{background-color:#a5b2cb}table.dataTable.no-footer{border-bottom:1px solid #111}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}table.dataTable.compact thead th,table.dataTable.compact thead td{padding:4px 17px 4px 4px}table.dataTable.compact tfoot th,table.dataTable.compact tfoot td{padding:4px}table.dataTable.compact tbody th,table.dataTable.compact tbody td{padding:4px}table.dataTable th.dt-left,table.dataTable td.dt-left{text-align:left}table.dataTable th.dt-center,table.dataTable td.dt-center,table.dataTable td.dataTables_empty{text-align:center}table.dataTable th.dt-right,table.dataTable td.dt-right{text-align:right}table.dataTable th.dt-justify,table.dataTable td.dt-justify{text-align:justify}table.dataTable th.dt-nowrap,table.dataTable td.dt-nowrap{white-space:nowrap}table.dataTable thead th.dt-head-left,table.dataTable thead td.dt-head-left,table.dataTable tfoot th.dt-head-left,table.dataTable tfoot td.dt-head-left{text-align:left}table.dataTable thead th.dt-head-center,table.dataTable thead td.dt-head-center,table.dataTable tfoot th.dt-head-center,table.dataTable tfoot td.dt-head-center{text-align:center}table.dataTable thead th.dt-head-right,table.dataTable thead td.dt-head-right,table.dataTable tfoot th.dt-head-right,table.dataTable tfoot td.dt-head-right{text-align:right}table.dataTable thead th.dt-head-justify,table.dataTable thead td.dt-head-justify,table.dataTable tfoot th.dt-head-justify,table.dataTable tfoot td.dt-head-justify{text-align:justify}table.dataTable thead th.dt-head-nowrap,table.dataTable thead td.dt-head-nowrap,table.dataTable tfoot th.dt-head-nowrap,table.dataTable tfoot td.dt-head-nowrap{white-space:nowrap}table.dataTable tbody th.dt-body-left,table.dataTable tbody td.dt-body-left{text-align:left}table.dataTable tbody th.dt-body-center,table.dataTable tbody td.dt-body-center{text-align:center}table.dataTable tbody th.dt-body-right,table.dataTable tbody td.dt-body-right{text-align:right}table.dataTable tbody th.dt-body-justify,table.dataTable tbody td.dt-body-justify{text-align:justify}table.dataTable tbody th.dt-body-nowrap,table.dataTable tbody td.dt-body-nowrap{white-space:nowrap}table.dataTable,table.dataTable th,table.dataTable td{box-sizing:content-box}.dataTables_wrapper{position:relative;clear:both;*zoom:1;zoom:1}.dataTables_wrapper .dataTables_length{float:left}.dataTables_wrapper .dataTables_filter{float:right;text-align:right}.dataTables_wrapper .dataTables_filter input{margin-left:.5em}.dataTables_wrapper .dataTables_info{clear:both;float:left;padding-top:.755em}.dataTables_wrapper .dataTables_paginate{float:right;text-align:right;padding-top:.25em}.dataTables_wrapper .dataTables_paginate .paginate_button{box-sizing:border-box;display:inline-block;min-width:1.5em;padding:.5em 1em;margin-left:2px;text-align:center;text-decoration:none !important;cursor:pointer;*cursor:hand;color:#333 !important;border:1px solid transparent;border-radius:2px}.dataTables_wrapper .dataTables_paginate .paginate_button.current,.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover{color:#333 !important;border:1px solid #979797;background-color:white;background:-webkit-gradient(linear,left top,left bottom,color-stop(0,white),color-stop(100%,#dcdcdc));background:-webkit-linear-gradient(top,white 0,#dcdcdc 100%);background:-moz-linear-gradient(top,white 0,#dcdcdc 100%);background:-ms-linear-gradient(top,white 0,#dcdcdc 100%);background:-o-linear-gradient(top,white 0,#dcdcdc 100%);background:linear-gradient(to bottom,white 0,#dcdcdc 100%)}.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active{cursor:default;color:#666 !important;border:1px solid transparent;background:transparent;box-shadow:none}.dataTables_wrapper .dataTables_paginate .paginate_button:hover{color:white !important;border:1px solid #111;background-color:#585858;background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#585858),color-stop(100%,#111));background:-webkit-linear-gradient(top,#585858 0,#111 100%);background:-moz-linear-gradient(top,#585858 0,#111 100%);background:-ms-linear-gradient(top,#585858 0,#111 100%);background:-o-linear-gradient(top,#585858 0,#111 100%);background:linear-gradient(to bottom,#585858 0,#111 100%)}.dataTables_wrapper .dataTables_paginate .paginate_button:active{outline:0;background-color:#2b2b2b;background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#2b2b2b),color-stop(100%,#0c0c0c));background:-webkit-linear-gradient(top,#2b2b2b 0,#0c0c0c 100%);background:-moz-linear-gradient(top,#2b2b2b 0,#0c0c0c 100%);background:-ms-linear-gradient(top,#2b2b2b 0,#0c0c0c 100%);background:-o-linear-gradient(top,#2b2b2b 0,#0c0c0c 100%);background:linear-gradient(to bottom,#2b2b2b 0,#0c0c0c 100%);box-shadow:inset 0 0 3px #111}.dataTables_wrapper .dataTables_paginate .ellipsis{padding:0 1em}.dataTables_wrapper .dataTables_processing{position:absolute;top:50%;left:50%;width:100%;height:40px;margin-left:-50%;margin-top:-25px;padding-top:20px;text-align:center;font-size:1.2em;background-color:white;background:-webkit-gradient(linear,left top,right top,color-stop(0,rgba(255,255,255,0)),color-stop(25%,rgba(255,255,255,0.9)),color-stop(75%,rgba(255,255,255,0.9)),color-stop(100%,rgba(255,255,255,0)));background:-webkit-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,0.9) 25%,rgba(255,255,255,0.9) 75%,rgba(255,255,255,0) 100%);background:-moz-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,0.9) 25%,rgba(255,255,255,0.9) 75%,rgba(255,255,255,0) 100%);background:-ms-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,0.9) 25%,rgba(255,255,255,0.9) 75%,rgba(255,255,255,0) 100%);background:-o-linear-gradient(left,rgba(255,255,255,0) 0,rgba(255,255,255,0.9) 25%,rgba(255,255,255,0.9) 75%,rgba(255,255,255,0) 100%);background:linear-gradient(to right,rgba(255,255,255,0) 0,rgba(255,255,255,0.9) 25%,rgba(255,255,255,0.9) 75%,rgba(255,255,255,0) 100%)}.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter,.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_processing,.dataTables_wrapper .dataTables_paginate{color:#333}.dataTables_wrapper .dataTables_scroll{clear:both}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody{*margin-top:-1px;-webkit-overflow-scrolling:touch}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>th,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>td,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>th,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>td{vertical-align:middle}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>th>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>td>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>th>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>td>div.dataTables_sizing{height:0;overflow:hidden;margin:0 !important;padding:0 !important}.dataTables_wrapper.no-footer .dataTables_scrollBody{border-bottom:1px solid #111}.dataTables_wrapper.no-footer div.dataTables_scrollHead table.dataTable,.dataTables_wrapper.no-footer div.dataTables_scrollBody>table{border-bottom:0}.dataTables_wrapper:after{visibility:hidden;display:block;content:"";clear:both;height:0}@media screen and (max-width:767px){.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_paginate{float:none;text-align:center}.dataTables_wrapper .dataTables_paginate{margin-top:.5em}}@media screen and (max-width:640px){.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter{float:none;text-align:center}.dataTables_wrapper .dataTables_filter{margin-top:.5em}}pre .comment,pre .template_comment,pre .diff .header,pre .javadoc{color:#998;font-style:italic}pre .keyword,pre .css .rule .keyword,pre .winutils,pre .javascript .title,pre .lisp .title{color:#000;font-weight:bold}pre .number,pre .hexcolor{color:#458}pre .string,pre .tag .value,pre .phpdoc,pre .tex .formula{color:#d14}pre .subst{color:#712}pre .constant,pre .title,pre .id{color:#900;font-weight:bold}pre .javascript .title,pre .lisp .title,pre .subst{font-weight:normal}pre .class .title,pre .haskell .label,pre .tex .command{color:#458;font-weight:bold}pre .tag,pre .tag .title,pre .rules .property,pre .django .tag .keyword{color:navy;font-weight:normal}pre .attribute,pre .variable,pre .instancevar,pre .lisp .body{color:teal}pre .regexp{color:#009926}pre .class{color:#458;font-weight:bold}pre .symbol,pre .ruby .symbol .string,pre .ruby .symbol .keyword,pre .ruby .symbol .keymethods,pre .lisp .keyword,pre .tex .special,pre .input_number{color:#990073}pre .builtin,pre .built_in,pre .lisp .title{color:#0086b3}pre .preprocessor,pre .pi,pre .doctype,pre .shebang,pre .cdata{color:#999;font-weight:bold}pre .deletion{background:#fdd}pre .addition{background:#dfd}pre .diff .change{background:#0086b3}pre .chunk{color:#aaa}pre .tex .formula{opacity:.5}.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{position:absolute;left:-99999999px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.ui-helper-clearfix{display:inline-block}/*\*/* html .ui-helper-clearfix{height:1%}.ui-helper-clearfix{display:block}/**/.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-state-disabled{cursor:default !important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:absolute;top:0;left:0;width:100%;height:100%}.ui-widget{font-family:Verdana,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Verdana,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #aaa;background:#fff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x;color:#222}.ui-widget-content a{color:#222}.ui-widget-header{border:1px solid #aaa;background:#ccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x;color:#222;font-weight:bold}.ui-widget-header a{color:#222}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #d3d3d3;background:#e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x;font-weight:normal;color:#555}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#555;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #999;background:#dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x;font-weight:normal;color:#212121}.ui-state-hover a,.ui-state-hover a:hover{color:#212121;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #aaa;background:#fff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x;font-weight:normal;color:#212121}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#212121;text-decoration:none}.ui-widget :active{outline:0}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #fcefa1;background:#fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x;color:#363636}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #cd0a0a;background:#fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x;color:#cd0a0a}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#cd0a0a}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#cd0a0a}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-icon{width:16px;height:16px;background-image:url(images/ui-icons_222222_256x240.png)}.ui-widget-content .ui-icon{background-image:url(images/ui-icons_222222_256x240.png)}.ui-widget-header .ui-icon{background-image:url(images/ui-icons_222222_256x240.png)}.ui-state-default .ui-icon{background-image:url(images/ui-icons_888888_256x240.png)}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url(images/ui-icons_454545_256x240.png)}.ui-state-active .ui-icon{background-image:url(images/ui-icons_454545_256x240.png)}.ui-state-highlight .ui-icon{background-image:url(images/ui-icons_2e83ff_256x240.png)}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url(images/ui-icons_cd0a0a_256x240.png)}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-off{background-position:-96px -144px}.ui-icon-radio-on{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-tl{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px}.ui-corner-tr{-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;border-top-right-radius:4px}.ui-corner-bl{-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px}.ui-corner-br{-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px}.ui-corner-top{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;border-top-right-radius:4px}.ui-corner-bottom{-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px}.ui-corner-right{-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px}.ui-corner-left{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px}.ui-corner-all{-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px}.ui-widget-overlay{background:#aaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;opacity:.30;filter:Alpha(Opacity=30)}.ui-widget-shadow{margin:-8px 0 0 -8px;padding:8px;background:#aaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;opacity:.30;filter:Alpha(Opacity=30);-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}#colorbox,#cboxOverlay,#cboxWrapper{position:absolute;top:0;left:0;z-index:9999;overflow:hidden}#cboxOverlay{position:fixed;width:100%;height:100%}#cboxMiddleLeft,#cboxBottomLeft{clear:left}#cboxContent{position:relative}#cboxLoadedContent{overflow:auto}#cboxTitle{margin:0}#cboxLoadingOverlay,#cboxLoadingGraphic{position:absolute;top:0;left:0;width:100%;height:100%}#cboxPrevious,#cboxNext,#cboxClose,#cboxSlideshow{cursor:pointer}.cboxPhoto{float:left;margin:auto;border:0;display:block;max-width:none}.cboxIframe{width:100%;height:100%;display:block;border:0}#colorbox,#cboxContent,#cboxLoadedContent{box-sizing:content-box}#cboxOverlay{background:#000}#cboxTopLeft{width:14px;height:14px;background:url(colorbox/controls.png) no-repeat 0 0}#cboxTopCenter{height:14px;background:url(colorbox/border.png) repeat-x top left}#cboxTopRight{width:14px;height:14px;background:url(colorbox/controls.png) no-repeat -36px 0}#cboxBottomLeft{width:14px;height:43px;background:url(colorbox/controls.png) no-repeat 0 -32px}#cboxBottomCenter{height:43px;background:url(colorbox/border.png) repeat-x bottom left}#cboxBottomRight{width:14px;height:43px;background:url(colorbox/controls.png) no-repeat -36px -32px}#cboxMiddleLeft{width:14px;background:url(colorbox/controls.png) repeat-y -175px 0}#cboxMiddleRight{width:14px;background:url(colorbox/controls.png) repeat-y -211px 0}#cboxContent{background:#fff;overflow:visible}.cboxIframe{background:#fff}#cboxError{padding:50px;border:1px solid #ccc}#cboxLoadedContent{margin-bottom:5px}#cboxLoadingOverlay{background:url(colorbox/loading_background.png) no-repeat center center}#cboxLoadingGraphic{background:url(colorbox/loading.gif) no-repeat center center}#cboxTitle{position:absolute;bottom:-25px;left:0;text-align:center;width:100%;font-weight:bold;color:#7c7c7c}#cboxCurrent{position:absolute;bottom:-25px;left:58px;font-weight:bold;color:#7c7c7c}#cboxPrevious,#cboxNext,#cboxClose,#cboxSlideshow{position:absolute;bottom:-29px;background:url(colorbox/controls.png) no-repeat 0 0;width:23px;height:23px;text-indent:-9999px}#cboxPrevious{left:0;background-position:-51px -25px}#cboxPrevious:hover{background-position:-51px 0}#cboxNext{left:27px;background-position:-75px -25px}#cboxNext:hover{background-position:-75px 0}#cboxClose{right:0;background-position:-100px -25px}#cboxClose:hover{background-position:-100px 0}.cboxSlideshow_on #cboxSlideshow{background-position:-125px 0;right:27px}.cboxSlideshow_on #cboxSlideshow:hover{background-position:-150px 0}.cboxSlideshow_off #cboxSlideshow{background-position:-150px -25px;right:27px}.cboxSlideshow_off #cboxSlideshow:hover{background-position:-125px 0}#loading{position:fixed;left:40%;top:50%}a{color:#333;text-decoration:none}a:hover{color:#000;text-decoration:underline}body{font-family:"Lucida Grande",Helvetica,"Helvetica Neue",Arial,sans-serif;padding:12px;background-color:#333}h1,h2,h3,h4{color:#1c2324;margin:0;padding:0;margin-bottom:12px}table{width:100%}#content{clear:left;background-color:white;border:2px solid #ddd;border-top:8px solid #ddd;padding:18px;-webkit-border-bottom-left-radius:5px;-webkit-border-bottom-right-radius:5px;-webkit-border-top-right-radius:5px;-moz-border-radius-bottomleft:5px;-moz-border-radius-bottomright:5px;-moz-border-radius-topright:5px;border-bottom-left-radius:5px;border-bottom-right-radius:5px;border-top-right-radius:5px}.dataTables_filter,.dataTables_info{padding:2px 6px}abbr.timeago{text-decoration:none;border:0;font-weight:bold}.timestamp{float:right;color:#ddd}.group_tabs{list-style:none;float:left;margin:0;padding:0}.group_tabs li{display:inline;float:left}.group_tabs li a{font-family:Helvetica,Arial,sans-serif;display:block;float:left;text-decoration:none;padding:4px 8px;background-color:#aaa;background:-webkit-gradient(linear,0 0,0 bottom,from(#ddd),to(#aaa));background:-moz-linear-gradient(#ddd,#aaa);background:linear-gradient(#ddd,#aaa);text-shadow:#e5e5e5 1px 1px 0;border-bottom:0;color:#333;font-weight:bold;margin-right:8px;border-top:1px solid #efefef;-webkit-border-top-left-radius:2px;-webkit-border-top-right-radius:2px;-moz-border-radius-topleft:2px;-moz-border-radius-topright:2px;border-top-left-radius:2px;border-top-right-radius:2px}.group_tabs li a:hover{background-color:#ccc;background:-webkit-gradient(linear,0 0,0 bottom,from(#eee),to(#aaa));background:-moz-linear-gradient(#eee,#aaa);background:linear-gradient(#eee,#aaa)}.group_tabs li a:active{padding-top:5px;padding-bottom:3px}.group_tabs li.active a{color:black;text-shadow:#fff 1px 1px 0;background-color:#ddd;background:-webkit-gradient(linear,0 0,0 bottom,from(white),to(#ddd));background:-moz-linear-gradient(white,#ddd);background:linear-gradient(white,#ddd)}.file_list{margin-bottom:18px}.file_list--responsive{overflow-x:auto;overflow-y:hidden}a.src_link{background:url("./magnify.png") no-repeat left 50%;padding-left:18px}tr,td{margin:0;padding:0}th{white-space:nowrap}th.ui-state-default{cursor:pointer}th span.ui-icon{float:left}td{padding:4px 8px}td.strong{font-weight:bold}.cell--number{text-align:right}.source_table h3,.source_table h4{padding:0;margin:0;margin-bottom:4px}.source_table .header{padding:10px}.source_table pre{margin:0;padding:0;white-space:normal;color:#000;font-family:"Monaco","Inconsolata","Consolas",monospace}.source_table code{color:#000;font-family:"Monaco","Inconsolata","Consolas",monospace}.source_table pre{background-color:#333}.source_table pre ol{margin:0;padding:0;margin-left:45px;font-size:12px;color:white}.source_table pre li{margin:0;padding:2px 6px;border-left:5px solid white}.source_table pre li code{white-space:pre;white-space:pre-wrap}.source_table pre .hits{float:right;margin-left:10px;padding:2px 4px;background-color:#444;background:-webkit-gradient(linear,0 0,0 bottom,from(#222),to(#666));background:-moz-linear-gradient(#222,#666);background:linear-gradient(#222,#666);color:white;font-family:Helvetica,"Helvetica Neue",Arial,sans-serif;font-size:10px;font-weight:bold;text-align:center;border-radius:6px}#footer{color:#ddd;font-size:12px;font-weight:bold;margin-top:12px;text-align:right}#footer a{color:#eee;text-decoration:underline}#footer a:hover{color:#fff;text-decoration:none}.green{color:#090}.red{color:#900}.yellow{color:#da0}.blue{color:blue}thead th{background:white}.source_table .covered{border-color:#090}.source_table .missed{border-color:#900}.source_table .never{border-color:black}.source_table .skipped{border-color:#fc0}.source_table .missed-branch{border-color:#bf0000}.source_table .covered:nth-child(odd){background-color:#cdf2cd}.source_table .covered:nth-child(even){background-color:#dbf2db}.source_table .missed:nth-child(odd){background-color:#f7c0c0}.source_table .missed:nth-child(even){background-color:#f7cfcf}.source_table .never:nth-child(odd){background-color:#efefef}.source_table .never:nth-child(even){background-color:#f4f4f4}.source_table .skipped:nth-child(odd){background-color:#fbf0c0}.source_table .skipped:nth-child(even){background-color:#fbffcf}.source_table .missed-branch:nth-child(odd){background-color:#cc8e8e}.source_table .missed-branch:nth-child(even){background-color:#cc6e6e}
\ No newline at end of file
diff --git a/coverage/assets/0.12.2/application.js b/coverage/assets/0.12.2/application.js
new file mode 100644
index 0000000000..e1c2ab2346
--- /dev/null
+++ b/coverage/assets/0.12.2/application.js
@@ -0,0 +1,7 @@
+!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(T,e){"use strict";function g(e,t,n){var r,a,i=(n=n||le).createElement("script");if(i.text=e,t)for(r in Se)(a=t[r]||t.getAttribute&&t.getAttribute(r))&&i.setAttribute(r,a);n.head.appendChild(i).parentNode.removeChild(i)}function m(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?pe[ge.call(e)]||"object":typeof e}function s(e){var t=!!e&&"length"in e&&e.length,n=m(e);return!we(e)&&!xe(e)&&("array"===n||0===t||"number"==typeof t&&0D.cacheLength&&delete n[r.shift()],n[e+" "]=t}var r=[];return n}function l(e){return e[q]=!0,e}function a(e){var t=E.createElement("fieldset");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function t(e,t){for(var n=e.split("|"),r=n.length;r--;)D.attrHandle[n[r]]=t}function u(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function r(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function i(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function o(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&_e(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function s(o){return l(function(i){return i=+i,l(function(e,t){for(var n,r=o([],e.length,i),a=r.length;a--;)e[n=r[a]]&&(e[n]=!(t[n]=e[n]))})})}function p(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function c(){}function g(e){for(var t=0,n=e.length,r="";t+~]|"+re+")"+re+"*"),fe=new RegExp(re+"|>"),de=new RegExp(oe),he=new RegExp("^"+ae+"$"),pe={ID:new RegExp("^#("+ae+")"),CLASS:new RegExp("^\\.("+ae+")"),TAG:new RegExp("^("+ae+"|[*])"),ATTR:new RegExp("^"+ie),PSEUDO:new RegExp("^"+oe),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+re+"*(even|odd|(([+-]|)(\\d*)n|)"+re+"*(?:([+-]|)"+re+"*(\\d+)|))"+re+"*\\)|)","i"),bool:new RegExp("^(?:"+ne+")$","i"),needsContext:new RegExp("^"+re+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+re+"*((?:-\\d)?\\d*)"+re+"*\\)|)(?=[^-]|$)","i")},ge=/HTML$/i,me=/^(?:input|select|textarea|button)$/i,ve=/^h\d$/i,ye=/^[^{]+\{\s*\[native \w/,be=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,we=/[+~]/,xe=new RegExp("\\\\([\\da-f]{1,6}"+re+"?|("+re+")|.)","ig"),Se=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},De=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,Te=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},Ce=function(){L()},_e=f(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{Q.apply(Y=ee.call(W.childNodes),W.childNodes),Y[W.childNodes.length].nodeType}catch(Ae){Q={apply:Y.length?function(e,t){K.apply(e,ee.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}for(v in S=w.support={},C=w.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!ge.test(t||n&&n.nodeName||"HTML")},L=w.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:W;return r!==E&&9===r.nodeType&&r.documentElement&&(R=(E=r).documentElement,F=!C(E),W!==E&&(n=E.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",Ce,!1):n.attachEvent&&n.attachEvent("onunload",Ce)),S.attributes=a(function(e){return e.className="i",!e.getAttribute("className")}),S.getElementsByTagName=a(function(e){return e.appendChild(E.createComment("")),!e.getElementsByTagName("*").length}),S.getElementsByClassName=ye.test(E.getElementsByClassName),S.getById=a(function(e){return R.appendChild(e).id=q,!E.getElementsByName||!E.getElementsByName(q).length}),S.getById?(D.filter.ID=function(e){var t=e.replace(xe,Se);return function(e){return e.getAttribute("id")===t}},D.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&F){var n=t.getElementById(e);return n?[n]:[]}}):(D.filter.ID=function(e){var n=e.replace(xe,Se);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},D.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&F){var n,r,a,i=t.getElementById(e);if(i){if((n=i.getAttributeNode("id"))&&n.value===e)return[i];for(a=t.getElementsByName(e),r=0;i=a[r++];)if((n=i.getAttributeNode("id"))&&n.value===e)return[i]}return[]}}),D.find.TAG=S.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):S.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],a=0,i=t.getElementsByTagName(e);if("*"!==e)return i;for(;n=i[a++];)1===n.nodeType&&r.push(n);return r},D.find.CLASS=S.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&F)return t.getElementsByClassName(e)},H=[],P=[],(S.qsa=ye.test(E.querySelectorAll))&&(a(function(e){R.appendChild(e).innerHTML=" ",e.querySelectorAll("[msallowcapture^='']").length&&P.push("[*^$]="+re+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||P.push("\\["+re+"*(?:value|"+ne+")"),e.querySelectorAll("[id~="+q+"-]").length||P.push("~="),e.querySelectorAll(":checked").length||P.push(":checked"),e.querySelectorAll("a#"+q+"+*").length||P.push(".#.+[+~]")}),a(function(e){e.innerHTML=" ";var t=E.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&P.push("name"+re+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&P.push(":enabled",":disabled"),R.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&P.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),P.push(",.*:")})),(S.matchesSelector=ye.test(M=R.matches||R.webkitMatchesSelector||R.mozMatchesSelector||R.oMatchesSelector||R.msMatchesSelector))&&a(function(e){S.disconnectedMatch=M.call(e,"*"),M.call(e,"[s!='']:x"),H.push("!=",oe)}),P=P.length&&new RegExp(P.join("|")),H=H.length&&new RegExp(H.join("|")),t=ye.test(R.compareDocumentPosition),O=t||ye.test(R.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},G=t?function(e,t){if(e===t)return j=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!S.sortDetached&&t.compareDocumentPosition(e)===n?e===E||e.ownerDocument===W&&O(W,e)?-1:t===E||t.ownerDocument===W&&O(W,t)?1:I?te(I,e)-te(I,t):0:4&n?-1:1)}:function(e,t){if(e===t)return j=!0,0;var n,r=0,a=e.parentNode,i=t.parentNode,o=[e],s=[t];if(!a||!i)return e===E?-1:t===E?1:a?-1:i?1:I?te(I,e)-te(I,t):0;if(a===i)return u(e,t);for(n=e;n=n.parentNode;)o.unshift(n);for(n=t;n=n.parentNode;)s.unshift(n);for(;o[r]===s[r];)r++;return r?u(o[r],s[r]):o[r]===W?-1:s[r]===W?1:0}),E},w.matches=function(e,t){return w(e,null,null,t)},w.matchesSelector=function(e,t){if((e.ownerDocument||e)!==E&&L(e),S.matchesSelector&&F&&!V[t+" "]&&(!H||!H.test(t))&&(!P||!P.test(t)))try{var n=M.call(e,t);if(n||S.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(Ae){V(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(xe,Se),e[3]=(e[3]||e[4]||e[5]||"").replace(xe,Se),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||w.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&w.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return pe.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&de.test(n)&&(t=_(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(xe,Se).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=U[e+" "];return t||(t=new RegExp("(^|"+re+")"+e+"("+re+"|$)"))&&U(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,a){return function(e){var t=w.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===a:"!="===r?t!==a:"^="===r?a&&0===t.indexOf(a):"*="===r?a&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;Te.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?Te.find.matchesSelector(r,e)?[r]:[]:Te.find.matches(e,Te.grep(t,function(e){return 1===e.nodeType}))},Te.fn.extend({find:function(e){var t,n,r=this.length,a=this;if("string"!=typeof e)return this.pushStack(Te(e).filter(function(){for(t=0;t)[^>]*|#([\w-]+))$/;(Te.fn.init=function(e,t,n){var r,a;if(!e)return this;if(n=n||je,"string"!=typeof e)return e.nodeType?(this[0]=e,this.length=1,this):we(e)?n.ready!==undefined?n.ready(e):e(Te):Te.makeArray(e,this);if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:Le.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof Te?t[0]:t,Te.merge(this,Te.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:le,!0)),Ie.test(r[1])&&Te.isPlainObject(t))for(r in t)we(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(a=le.getElementById(r[2]))&&(this[0]=a,this.length=1),this}).prototype=Te.fn,je=Te(le);var Ee=/^(?:parents|prev(?:Until|All))/,Re={children:!0,contents:!0,next:!0,prev:!0};Te.fn.extend({has:function(e){var t=Te(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,rt=/^$|^module$|\/(?:java|ecma)script/i,at={option:[1,""," "],thead:[1,""],col:[2,""],tr:[2,""],td:[3,""],_default:[0,"",""]};at.optgroup=at.option,at.tbody=at.tfoot=at.colgroup=at.caption=at.thead,at.th=at.td;var it,ot,st=/<|?\w+;/;it=le.createDocumentFragment().appendChild(le.createElement("div")),(ot=le.createElement("input")).setAttribute("type","radio"),ot.setAttribute("checked","checked"),ot.setAttribute("name","t"),it.appendChild(ot),be.checkClone=it.cloneNode(!0).cloneNode(!0).lastChild.checked,it.innerHTML="",be.noCloneChecked=!!it.cloneNode(!0).lastChild.defaultValue;var lt=/^key/,ut=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ct=/^([^.]*)(?:\.(.+)|)/;Te.event={global:{},add:function(t,e,n,r,a){var i,o,s,l,u,c,f,d,h,p,g,m=Be.get(t);if(m)for(n.handler&&(n=(i=n).handler,a=i.selector),a&&Te.find.matchesSelector(Je,a),n.guid||(n.guid=Te.guid++),(l=m.events)||(l=m.events={}),(o=m.handle)||(o=m.handle=function(e){return void 0!==Te&&Te.event.triggered!==e.type?Te.event.dispatch.apply(t,arguments):undefined}),u=(e=(e||"").match(Fe)||[""]).length;u--;)h=g=(s=ct.exec(e[u])||[])[1],p=(s[2]||"").split(".").sort(),h&&(f=Te.event.special[h]||{},h=(a?f.delegateType:f.bindType)||h,f=Te.event.special[h]||{},c=Te.extend({type:h,origType:g,data:r,handler:n,guid:n.guid,selector:a,needsContext:a&&Te.expr.match.needsContext.test(a),namespace:p.join(".")},i),(d=l[h])||((d=l[h]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,p,o)||t.addEventListener&&t.addEventListener(h,o)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),a?d.splice(d.delegateCount++,0,c):d.push(c),Te.event.global[h]=!0)},remove:function(e,t,n,r,a){var i,o,s,l,u,c,f,d,h,p,g,m=Be.hasData(e)&&Be.get(e);if(m&&(l=m.events)){for(u=(t=(t||"").match(Fe)||[""]).length;u--;)if(h=g=(s=ct.exec(t[u])||[])[1],p=(s[2]||"").split(".").sort(),h){for(f=Te.event.special[h]||{},d=l[h=(r?f.delegateType:f.bindType)||h]||[],s=s[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=i=d.length;i--;)c=d[i],!a&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(d.splice(i,1),c.selector&&d.delegateCount--,f.remove&&f.remove.call(e,c));o&&!d.length&&(f.teardown&&!1!==f.teardown.call(e,p,m.handle)||Te.removeEvent(e,h,m.handle),delete l[h])}else for(h in l)Te.event.remove(e,h+t[u],n,r,!0);Te.isEmptyObject(l)&&Be.remove(e,"handle events")}},dispatch:function(e){var t,n,r,a,i,o,s=Te.event.fix(e),l=new Array(arguments.length),u=(Be.get(this,"events")||{})[s.type]||[],c=Te.event.special[s.type]||{};for(l[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,dt=/