From ee475b36ab9c13584b3a167b934027465ebf9c78 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Thu, 12 Oct 2017 15:50:22 -0700 Subject: [PATCH 01/40] pushing controllers --- .gitignore | 23 +++ Gemfile | 50 +++++ Gemfile.lock | 187 ++++++++++++++++++ Rakefile | 6 + app/assets/config/manifest.js | 3 + app/assets/images/.keep | 0 app/assets/javascripts/album.coffee | 3 + app/assets/javascripts/application.js | 15 ++ app/assets/javascripts/book.coffee | 3 + app/assets/javascripts/cable.js | 13 ++ app/assets/javascripts/channels/.keep | 0 app/assets/javascripts/movie.coffee | 3 + app/assets/javascripts/user.coffee | 3 + app/assets/stylesheets/album.scss | 3 + app/assets/stylesheets/application.css | 15 ++ app/assets/stylesheets/book.scss | 3 + app/assets/stylesheets/movie.scss | 3 + app/assets/stylesheets/user.scss | 3 + app/channels/application_cable/channel.rb | 4 + app/channels/application_cable/connection.rb | 4 + app/controllers/album_controller.rb | 4 + app/controllers/application_controller.rb | 3 + app/controllers/book_controller.rb | 4 + app/controllers/concerns/.keep | 0 app/controllers/movie_controller.rb | 4 + app/controllers/user_controller.rb | 4 + app/helpers/album_helper.rb | 2 + app/helpers/application_helper.rb | 2 + app/helpers/book_helper.rb | 2 + app/helpers/movie_helper.rb | 2 + app/helpers/user_helper.rb | 2 + app/jobs/application_job.rb | 2 + app/mailers/application_mailer.rb | 4 + app/models/album.rb | 2 + app/models/application_record.rb | 3 + app/models/book.rb | 2 + app/models/concerns/.keep | 0 app/models/movie.rb | 2 + app/models/user.rb | 2 + app/views/album/index.html.erb | 2 + app/views/book/index.html.erb | 2 + app/views/layouts/application.html.erb | 14 ++ app/views/layouts/mailer.html.erb | 13 ++ app/views/layouts/mailer.text.erb | 1 + app/views/movie/index.html.erb | 2 + app/views/user/index.html.erb | 2 + bin/bundle | 3 + bin/rails | 4 + bin/rake | 4 + bin/setup | 38 ++++ bin/update | 29 +++ bin/yarn | 11 ++ config.ru | 5 + config/application.rb | 18 ++ config/boot.rb | 3 + config/cable.yml | 10 + config/database.yml | 25 +++ config/environment.rb | 5 + config/environments/development.rb | 54 +++++ config/environments/production.rb | 91 +++++++++ config/environments/test.rb | 42 ++++ .../application_controller_renderer.rb | 8 + config/initializers/assets.rb | 14 ++ config/initializers/backtrace_silencers.rb | 7 + config/initializers/cookies_serializer.rb | 5 + .../initializers/filter_parameter_logging.rb | 4 + config/initializers/inflections.rb | 16 ++ config/initializers/mime_types.rb | 4 + config/initializers/wrap_parameters.rb | 14 ++ config/locales/en.yml | 33 ++++ config/puma.rb | 56 ++++++ config/routes.rb | 11 ++ config/secrets.yml | 32 +++ db/migrate/20171011040258_create_users.rb | 10 + db/migrate/20171011040511_create_movies.rb | 12 ++ db/migrate/20171011040524_create_books.rb | 12 ++ db/migrate/20171011040535_create_albums.rb | 12 ++ db/schema.rb | 49 +++++ db/seeds.rb | 7 + lib/assets/.keep | 0 lib/tasks/.keep | 0 log/.keep | 0 package.json | 5 + public/404.html | 67 +++++++ public/422.html | 67 +++++++ public/500.html | 66 +++++++ public/apple-touch-icon-precomposed.png | 0 public/apple-touch-icon.png | 0 public/favicon.ico | 0 public/robots.txt | 1 + test/application_system_test_case.rb | 5 + test/controllers/.keep | 0 test/controllers/album_controller_test.rb | 9 + test/controllers/book_controller_test.rb | 9 + test/controllers/movie_controller_test.rb | 9 + test/controllers/user_controller_test.rb | 9 + test/fixtures/.keep | 0 test/fixtures/albums.yml | 13 ++ test/fixtures/books.yml | 13 ++ test/fixtures/files/.keep | 0 test/fixtures/movies.yml | 13 ++ test/fixtures/users.yml | 9 + test/helpers/.keep | 0 test/integration/.keep | 0 test/mailers/.keep | 0 test/models/.keep | 0 test/models/album_test.rb | 7 + test/models/book_test.rb | 7 + test/models/movie_test.rb | 7 + test/models/user_test.rb | 7 + test/system/.keep | 0 test/test_helper.rb | 9 + tmp/.keep | 0 vendor/.keep | 0 114 files changed, 1406 insertions(+) create mode 100644 .gitignore create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 Rakefile create mode 100644 app/assets/config/manifest.js create mode 100644 app/assets/images/.keep create mode 100644 app/assets/javascripts/album.coffee create mode 100644 app/assets/javascripts/application.js create mode 100644 app/assets/javascripts/book.coffee create mode 100644 app/assets/javascripts/cable.js create mode 100644 app/assets/javascripts/channels/.keep create mode 100644 app/assets/javascripts/movie.coffee create mode 100644 app/assets/javascripts/user.coffee create mode 100644 app/assets/stylesheets/album.scss create mode 100644 app/assets/stylesheets/application.css create mode 100644 app/assets/stylesheets/book.scss create mode 100644 app/assets/stylesheets/movie.scss create mode 100644 app/assets/stylesheets/user.scss create mode 100644 app/channels/application_cable/channel.rb create mode 100644 app/channels/application_cable/connection.rb create mode 100644 app/controllers/album_controller.rb create mode 100644 app/controllers/application_controller.rb create mode 100644 app/controllers/book_controller.rb create mode 100644 app/controllers/concerns/.keep create mode 100644 app/controllers/movie_controller.rb create mode 100644 app/controllers/user_controller.rb create mode 100644 app/helpers/album_helper.rb create mode 100644 app/helpers/application_helper.rb create mode 100644 app/helpers/book_helper.rb create mode 100644 app/helpers/movie_helper.rb create mode 100644 app/helpers/user_helper.rb create mode 100644 app/jobs/application_job.rb create mode 100644 app/mailers/application_mailer.rb create mode 100644 app/models/album.rb create mode 100644 app/models/application_record.rb create mode 100644 app/models/book.rb create mode 100644 app/models/concerns/.keep create mode 100644 app/models/movie.rb create mode 100644 app/models/user.rb create mode 100644 app/views/album/index.html.erb create mode 100644 app/views/book/index.html.erb create mode 100644 app/views/layouts/application.html.erb create mode 100644 app/views/layouts/mailer.html.erb create mode 100644 app/views/layouts/mailer.text.erb create mode 100644 app/views/movie/index.html.erb create mode 100644 app/views/user/index.html.erb create mode 100644 bin/bundle create mode 100644 bin/rails create mode 100644 bin/rake create mode 100644 bin/setup create mode 100644 bin/update create mode 100644 bin/yarn create mode 100644 config.ru create mode 100644 config/application.rb create mode 100644 config/boot.rb create mode 100644 config/cable.yml create mode 100644 config/database.yml create mode 100644 config/environment.rb create mode 100644 config/environments/development.rb create mode 100644 config/environments/production.rb create mode 100644 config/environments/test.rb create mode 100644 config/initializers/application_controller_renderer.rb create mode 100644 config/initializers/assets.rb create mode 100644 config/initializers/backtrace_silencers.rb create mode 100644 config/initializers/cookies_serializer.rb create mode 100644 config/initializers/filter_parameter_logging.rb create mode 100644 config/initializers/inflections.rb create mode 100644 config/initializers/mime_types.rb create mode 100644 config/initializers/wrap_parameters.rb create mode 100644 config/locales/en.yml create mode 100644 config/puma.rb create mode 100644 config/routes.rb create mode 100644 config/secrets.yml create mode 100644 db/migrate/20171011040258_create_users.rb create mode 100644 db/migrate/20171011040511_create_movies.rb create mode 100644 db/migrate/20171011040524_create_books.rb create mode 100644 db/migrate/20171011040535_create_albums.rb create mode 100644 db/schema.rb create mode 100644 db/seeds.rb create mode 100644 lib/assets/.keep create mode 100644 lib/tasks/.keep create mode 100644 log/.keep create mode 100644 package.json create mode 100644 public/404.html create mode 100644 public/422.html create mode 100644 public/500.html create mode 100644 public/apple-touch-icon-precomposed.png create mode 100644 public/apple-touch-icon.png create mode 100644 public/favicon.ico create mode 100644 public/robots.txt create mode 100644 test/application_system_test_case.rb create mode 100644 test/controllers/.keep create mode 100644 test/controllers/album_controller_test.rb create mode 100644 test/controllers/book_controller_test.rb create mode 100644 test/controllers/movie_controller_test.rb create mode 100644 test/controllers/user_controller_test.rb create mode 100644 test/fixtures/.keep create mode 100644 test/fixtures/albums.yml create mode 100644 test/fixtures/books.yml create mode 100644 test/fixtures/files/.keep create mode 100644 test/fixtures/movies.yml create mode 100644 test/fixtures/users.yml create mode 100644 test/helpers/.keep create mode 100644 test/integration/.keep create mode 100644 test/mailers/.keep create mode 100644 test/models/.keep create mode 100644 test/models/album_test.rb create mode 100644 test/models/book_test.rb create mode 100644 test/models/movie_test.rb create mode 100644 test/models/user_test.rb create mode 100644 test/system/.keep create mode 100644 test/test_helper.rb create mode 100644 tmp/.keep create mode 100644 vendor/.keep diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..dcc5b36f34 --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +# See https://help.github.com/articles/ignoring-files for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile '~/.gitignore_global' + +# Ignore bundler config. +/.bundle + +# Ignore the default SQLite database. +/db/*.sqlite3 +/db/*.sqlite3-journal + +# Ignore all logfiles and tempfiles. +/log/* +/tmp/* +!/log/.keep +!/tmp/.keep + +/node_modules +/yarn-error.log + +.byebug_history diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000000..d35de94c78 --- /dev/null +++ b/Gemfile @@ -0,0 +1,50 @@ +source 'https://rubygems.org' + +git_source(:github) do |repo_name| + repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") + "https://github.com/#{repo_name}.git" +end + + +# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' +gem 'rails', '~> 5.1.4' +# Use sqlite3 as the database for Active Record +gem 'sqlite3' +# Use Puma as the app server +gem 'puma', '~> 3.7' +# Use SCSS for stylesheets +gem 'sass-rails', '~> 5.0' +# Use Uglifier as compressor for JavaScript assets +gem 'uglifier', '>= 1.3.0' +# See https://github.com/rails/execjs#readme for more supported runtimes +# gem 'therubyracer', platforms: :ruby + +# Use CoffeeScript for .coffee assets and views +gem 'coffee-rails', '~> 4.2' +# 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.5' +# Use Redis adapter to run Action Cable in production +# gem 'redis', '~> 3.0' +# Use ActiveModel has_secure_password +# gem 'bcrypt', '~> 3.1.7' + +# Use Capistrano for deployment +# gem 'capistrano-rails', group: :development + +group :development, :test do + # Call 'byebug' anywhere in the code to stop execution and get a debugger console + gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] + # Adds support for Capybara system testing and selenium driver + gem 'capybara', '~> 2.13' + gem 'selenium-webdriver' +end + +group :development do + # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. + gem 'web-console', '>= 3.3.0' +end + +# Windows does not include zoneinfo files, so bundle the tzinfo-data gem +gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000000..86bfccda7b --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,187 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.1.4) + actionpack (= 5.1.4) + nio4r (~> 2.0) + websocket-driver (~> 0.6.1) + actionmailer (5.1.4) + actionpack (= 5.1.4) + actionview (= 5.1.4) + activejob (= 5.1.4) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.1.4) + actionview (= 5.1.4) + activesupport (= 5.1.4) + rack (~> 2.0) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.1.4) + activesupport (= 5.1.4) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.1.4) + activesupport (= 5.1.4) + globalid (>= 0.3.6) + activemodel (5.1.4) + activesupport (= 5.1.4) + activerecord (5.1.4) + activemodel (= 5.1.4) + activesupport (= 5.1.4) + arel (~> 8.0) + activesupport (5.1.4) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (~> 0.7) + minitest (~> 5.1) + tzinfo (~> 1.1) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) + arel (8.0.0) + bindex (0.5.0) + builder (3.2.3) + byebug (9.1.0) + capybara (2.15.4) + addressable + mini_mime (>= 0.1.3) + nokogiri (>= 1.3.3) + rack (>= 1.0.0) + rack-test (>= 0.5.4) + xpath (~> 2.0) + childprocess (0.8.0) + ffi (~> 1.0, >= 1.0.11) + coffee-rails (4.2.2) + coffee-script (>= 2.2.0) + railties (>= 4.0.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.12.2) + concurrent-ruby (1.0.5) + crass (1.0.2) + erubi (1.7.0) + execjs (2.7.0) + ffi (1.9.18-x86-mingw32) + globalid (0.4.0) + activesupport (>= 4.2.0) + i18n (0.8.6) + jbuilder (2.7.0) + activesupport (>= 4.2.0) + multi_json (>= 1.2) + loofah (2.1.1) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.6.6) + mime-types (>= 1.16, < 4) + method_source (0.9.0) + mime-types (3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2016.0521) + mini_mime (0.1.4) + mini_portile2 (2.3.0) + minitest (5.10.3) + multi_json (1.12.2) + nio4r (2.1.0) + nokogiri (1.8.1-x86-mingw32) + mini_portile2 (~> 2.3.0) + public_suffix (3.0.0) + puma (3.10.0) + rack (2.0.3) + rack-test (0.7.0) + rack (>= 1.0, < 3) + rails (5.1.4) + actioncable (= 5.1.4) + actionmailer (= 5.1.4) + actionpack (= 5.1.4) + actionview (= 5.1.4) + activejob (= 5.1.4) + activemodel (= 5.1.4) + activerecord (= 5.1.4) + activesupport (= 5.1.4) + bundler (>= 1.3.0) + railties (= 5.1.4) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.0.3) + loofah (~> 2.0) + railties (5.1.4) + actionpack (= 5.1.4) + activesupport (= 5.1.4) + method_source + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (12.1.0) + rb-fsevent (0.10.2) + rb-inotify (0.9.10) + ffi (>= 0.5.0, < 2) + rubyzip (1.2.1) + sass (3.5.2) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sass-rails (5.0.6) + railties (>= 4.0.0, < 6) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (>= 1.1, < 3) + selenium-webdriver (3.6.0) + childprocess (~> 0.5) + rubyzip (~> 1.0) + sprockets (3.7.1) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.3.13-x86-mingw32) + thor (0.20.0) + thread_safe (0.3.6) + tilt (2.0.8) + turbolinks (5.0.1) + turbolinks-source (~> 5) + turbolinks-source (5.0.3) + tzinfo (1.2.3) + thread_safe (~> 0.1) + tzinfo-data (1.2017.2) + tzinfo (>= 1.0.0) + uglifier (3.2.0) + execjs (>= 0.3.0, < 3) + web-console (3.5.1) + actionview (>= 5.0) + activemodel (>= 5.0) + bindex (>= 0.4.0) + railties (>= 5.0) + websocket-driver (0.6.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.2) + xpath (2.1.0) + nokogiri (~> 1.3) + +PLATFORMS + x86-mingw32 + +DEPENDENCIES + byebug + capybara (~> 2.13) + coffee-rails (~> 4.2) + jbuilder (~> 2.5) + puma (~> 3.7) + rails (~> 5.1.4) + sass-rails (~> 5.0) + selenium-webdriver + sqlite3 + turbolinks (~> 5) + tzinfo-data + uglifier (>= 1.3.0) + web-console (>= 3.3.0) + +BUNDLED WITH + 1.15.4 diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000000..e85f913914 --- /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/assets/config/manifest.js b/app/assets/config/manifest.js new file mode 100644 index 0000000000..b16e53d6d5 --- /dev/null +++ b/app/assets/config/manifest.js @@ -0,0 +1,3 @@ +//= link_tree ../images +//= link_directory ../javascripts .js +//= 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/javascripts/album.coffee b/app/assets/javascripts/album.coffee new file mode 100644 index 0000000000..24f83d18bb --- /dev/null +++ b/app/assets/javascripts/album.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 0000000000..46b20359fa --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,15 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's +// vendor/assets/javascripts directory can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// compiled file. JavaScript code in this file should be added after the last require_* statement. +// +// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details +// about supported directives. +// +//= require rails-ujs +//= require turbolinks +//= require_tree . diff --git a/app/assets/javascripts/book.coffee b/app/assets/javascripts/book.coffee new file mode 100644 index 0000000000..24f83d18bb --- /dev/null +++ b/app/assets/javascripts/book.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/cable.js b/app/assets/javascripts/cable.js new file mode 100644 index 0000000000..739aa5f022 --- /dev/null +++ b/app/assets/javascripts/cable.js @@ -0,0 +1,13 @@ +// 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. +// +//= require action_cable +//= require_self +//= require_tree ./channels + +(function() { + this.App || (this.App = {}); + + App.cable = ActionCable.createConsumer(); + +}).call(this); diff --git a/app/assets/javascripts/channels/.keep b/app/assets/javascripts/channels/.keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/app/assets/javascripts/movie.coffee b/app/assets/javascripts/movie.coffee new file mode 100644 index 0000000000..24f83d18bb --- /dev/null +++ b/app/assets/javascripts/movie.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/user.coffee b/app/assets/javascripts/user.coffee new file mode 100644 index 0000000000..24f83d18bb --- /dev/null +++ b/app/assets/javascripts/user.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/album.scss b/app/assets/stylesheets/album.scss new file mode 100644 index 0000000000..9253c8b50f --- /dev/null +++ b/app/assets/stylesheets/album.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Album controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css new file mode 100644 index 0000000000..d05ea0f511 --- /dev/null +++ b/app/assets/stylesheets/application.css @@ -0,0 +1,15 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, 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. + * + *= require_tree . + *= require_self + */ diff --git a/app/assets/stylesheets/book.scss b/app/assets/stylesheets/book.scss new file mode 100644 index 0000000000..3c371b0734 --- /dev/null +++ b/app/assets/stylesheets/book.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Book controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/movie.scss b/app/assets/stylesheets/movie.scss new file mode 100644 index 0000000000..8a74af9b1b --- /dev/null +++ b/app/assets/stylesheets/movie.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Movie controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/user.scss b/app/assets/stylesheets/user.scss new file mode 100644 index 0000000000..c47a13e0c4 --- /dev/null +++ b/app/assets/stylesheets/user.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the User controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://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/album_controller.rb b/app/controllers/album_controller.rb new file mode 100644 index 0000000000..4c199cdc4d --- /dev/null +++ b/app/controllers/album_controller.rb @@ -0,0 +1,4 @@ +class AlbumController < ApplicationController + def index + end +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 0000000000..1c07694e9d --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,3 @@ +class ApplicationController < ActionController::Base + protect_from_forgery with: :exception +end diff --git a/app/controllers/book_controller.rb b/app/controllers/book_controller.rb new file mode 100644 index 0000000000..bbc99a9e9b --- /dev/null +++ b/app/controllers/book_controller.rb @@ -0,0 +1,4 @@ +class BookController < ApplicationController + def index + 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/movie_controller.rb b/app/controllers/movie_controller.rb new file mode 100644 index 0000000000..6a8dc423b5 --- /dev/null +++ b/app/controllers/movie_controller.rb @@ -0,0 +1,4 @@ +class MovieController < ApplicationController + def index + end +end diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb new file mode 100644 index 0000000000..887bcb7f3f --- /dev/null +++ b/app/controllers/user_controller.rb @@ -0,0 +1,4 @@ +class UserController < ApplicationController + def index + end +end diff --git a/app/helpers/album_helper.rb b/app/helpers/album_helper.rb new file mode 100644 index 0000000000..23ace66827 --- /dev/null +++ b/app/helpers/album_helper.rb @@ -0,0 +1,2 @@ +module AlbumHelper +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb new file mode 100644 index 0000000000..de6be7945c --- /dev/null +++ b/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/app/helpers/book_helper.rb b/app/helpers/book_helper.rb new file mode 100644 index 0000000000..2b0a0ca787 --- /dev/null +++ b/app/helpers/book_helper.rb @@ -0,0 +1,2 @@ +module BookHelper +end diff --git a/app/helpers/movie_helper.rb b/app/helpers/movie_helper.rb new file mode 100644 index 0000000000..abf580fa44 --- /dev/null +++ b/app/helpers/movie_helper.rb @@ -0,0 +1,2 @@ +module MovieHelper +end diff --git a/app/helpers/user_helper.rb b/app/helpers/user_helper.rb new file mode 100644 index 0000000000..0147c3fe6a --- /dev/null +++ b/app/helpers/user_helper.rb @@ -0,0 +1,2 @@ +module UserHelper +end diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb new file mode 100644 index 0000000000..a009ace51c --- /dev/null +++ b/app/jobs/application_job.rb @@ -0,0 +1,2 @@ +class ApplicationJob < ActiveJob::Base +end diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb new file mode 100644 index 0000000000..286b2239d1 --- /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/album.rb b/app/models/album.rb new file mode 100644 index 0000000000..9153b4079a --- /dev/null +++ b/app/models/album.rb @@ -0,0 +1,2 @@ +class Album < ApplicationRecord +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/book.rb b/app/models/book.rb new file mode 100644 index 0000000000..03d56b43cc --- /dev/null +++ b/app/models/book.rb @@ -0,0 +1,2 @@ +class Book < ApplicationRecord +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/movie.rb b/app/models/movie.rb new file mode 100644 index 0000000000..dc614df15f --- /dev/null +++ b/app/models/movie.rb @@ -0,0 +1,2 @@ +class Movie < ApplicationRecord +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000000..379658a509 --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,2 @@ +class User < ApplicationRecord +end diff --git a/app/views/album/index.html.erb b/app/views/album/index.html.erb new file mode 100644 index 0000000000..75733a72f3 --- /dev/null +++ b/app/views/album/index.html.erb @@ -0,0 +1,2 @@ +

Album#index

+

Find me in app/views/album/index.html.erb

diff --git a/app/views/book/index.html.erb b/app/views/book/index.html.erb new file mode 100644 index 0000000000..7c71019039 --- /dev/null +++ b/app/views/book/index.html.erb @@ -0,0 +1,2 @@ +

Book#index

+

Find me in app/views/book/index.html.erb

diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb new file mode 100644 index 0000000000..6af511b830 --- /dev/null +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ + + + + MediaRanker + <%= csrf_meta_tags %> + + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> + <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> + + + + <%= yield %> + + 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/movie/index.html.erb b/app/views/movie/index.html.erb new file mode 100644 index 0000000000..1522c39719 --- /dev/null +++ b/app/views/movie/index.html.erb @@ -0,0 +1,2 @@ +

Movie#index

+

Find me in app/views/movie/index.html.erb

diff --git a/app/views/user/index.html.erb b/app/views/user/index.html.erb new file mode 100644 index 0000000000..c825aaffc5 --- /dev/null +++ b/app/views/user/index.html.erb @@ -0,0 +1,2 @@ +

User#index

+

Find me in app/views/user/index.html.erb

diff --git a/bin/bundle b/bin/bundle new file mode 100644 index 0000000000..e3c2f622b6 --- /dev/null +++ b/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby.exe +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails new file mode 100644 index 0000000000..bec72ac231 --- /dev/null +++ b/bin/rails @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby.exe +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 100644 index 0000000000..f6ed5a2a66 --- /dev/null +++ b/bin/rake @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby.exe +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/bin/setup b/bin/setup new file mode 100644 index 0000000000..00ad3ec531 --- /dev/null +++ b/bin/setup @@ -0,0 +1,38 @@ +#!/usr/bin/env ruby.exe +require 'pathname' +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + + + # puts "\n== Copying sample files ==" + # unless File.exist?('config/database.yml') + # cp 'config/database.yml.sample', 'config/database.yml' + # end + + puts "\n== Preparing database ==" + system! 'bin/rails db:setup' + + 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/update b/bin/update new file mode 100644 index 0000000000..deb1df28e2 --- /dev/null +++ b/bin/update @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby.exe +require 'pathname' +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a way to update your development environment automatically. + # Add necessary update steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + puts "\n== Updating database ==" + system! 'bin/rails db:migrate' + + 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/yarn b/bin/yarn new file mode 100644 index 0000000000..07471fe9ef --- /dev/null +++ b/bin/yarn @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby.exe +VENDOR_PATH = File.expand_path('..', __dir__) +Dir.chdir(VENDOR_PATH) do + begin + exec "yarnpkg #{ARGV.join(" ")}" + 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..f7ba0b527b --- /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..610fb5d08c --- /dev/null +++ b/config/application.rb @@ -0,0 +1,18 @@ +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 MediaRanker + class Application < Rails::Application + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 5.1 + + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + end +end diff --git a/config/boot.rb b/config/boot.rb new file mode 100644 index 0000000000..30f5120df6 --- /dev/null +++ b/config/boot.rb @@ -0,0 +1,3 @@ +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) + +require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/config/cable.yml b/config/cable.yml new file mode 100644 index 0000000000..3a27f13933 --- /dev/null +++ b/config/cable.yml @@ -0,0 +1,10 @@ +development: + adapter: async + +test: + adapter: async + +production: + adapter: redis + url: redis://localhost:6379/1 + channel_prefix: MediaRanker_production diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 0000000000..0d02f24980 --- /dev/null +++ b/config/database.yml @@ -0,0 +1,25 @@ +# SQLite version 3.x +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem 'sqlite3' +# +default: &default + adapter: sqlite3 + pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> + timeout: 5000 + +development: + <<: *default + database: db/development.sqlite3 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + <<: *default + database: db/test.sqlite3 + +production: + <<: *default + database: db/production.sqlite3 diff --git a/config/environment.rb b/config/environment.rb new file mode 100644 index 0000000000..426333bb46 --- /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..55d8c9e7bb --- /dev/null +++ b/config/environments/development.rb @@ -0,0 +1,54 @@ +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. + if Rails.root.join('tmp/caching-dev.txt').exist? + config.action_controller.perform_caching = true + + config.cache_store = :memory_store + config.public_file_server.headers = { + 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}" + } + else + config.action_controller.perform_caching = false + + config.cache_store = :null_store + end + + # 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 + + # 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..d242dac65c --- /dev/null +++ b/config/environments/production.rb @@ -0,0 +1,91 @@ +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 + + # Attempt to read encrypted secrets from `config/secrets.yml.enc`. + # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or + # `config/secrets.yml.key`. + config.read_encrypted_secrets = 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 JavaScripts and CSS. + config.assets.js_compressor = :uglifier + # config.assets.css_compressor = :sass + + # Do not fallback to assets pipeline if a precompiled asset is missed. + config.assets.compile = false + + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + + # 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 + + # 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 = "MediaRanker_#{Rails.env}" + 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 +end diff --git a/config/environments/test.rb b/config/environments/test.rb new file mode 100644 index 0000000000..8e5cbde533 --- /dev/null +++ b/config/environments/test.rb @@ -0,0 +1,42 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false + + # Configure 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.seconds.to_i}" + } + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + 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/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..4b828e80cb --- /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/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/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..decc5a8573 --- /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 http://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..1e19380dcb --- /dev/null +++ b/config/puma.rb @@ -0,0 +1,56 @@ +# 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. +# +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } +threads threads_count, 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 number of `workers` to boot in clustered mode. +# Workers are forked webserver 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. If you use this option +# you need to make sure to reconnect any threads in the `on_worker_boot` +# block. +# +# preload_app! + +# If you are preloading your application and using Active Record, it's +# recommended that you close any connections to the database before workers +# are forked to prevent connection leakage. +# +# before_fork do +# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord) +# end + +# The code in the `on_worker_boot` will be called if you are using +# clustered mode by specifying a number of `workers`. After each worker +# process is booted, this block will be run. If you are using the `preload_app!` +# option, you will want to use this block to reconnect to any threads +# or connections that may have been created at application boot, as Ruby +# cannot share connections between processes. +# +# on_worker_boot do +# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) +# end +# + +# 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..a89530cf35 --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,11 @@ +Rails.application.routes.draw do + get 'album/index' + + get 'book/index' + + get 'movie/index' + + get 'user/index' + + # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html +end diff --git a/config/secrets.yml b/config/secrets.yml new file mode 100644 index 0000000000..51cf968c44 --- /dev/null +++ b/config/secrets.yml @@ -0,0 +1,32 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rails secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +# Shared secrets are available across all environments. + +# shared: +# api_key: a1B2c3D4e5F6 + +# Environmental secrets are only available for that specific environment. + +development: + secret_key_base: a298f8fb9c3fa3dac3b44935e3f31dd4340481a65ff89f4b7e788e174e7bc9aceafc0d4968d5e530e3c4388b3b18e081b4aa928d9b3fb06e729e3086f16e894a + +test: + secret_key_base: e6db51b1017d0a8883e4bc6df1bd28d390a6cb6e326393a53aaeaaf8c8775319a28322dc3338a73cbd00a2e1971dd3d5f85d1fb498ef5c6b4ea434b66a9f5a6e + +# Do not keep production secrets in the unencrypted secrets file. +# Instead, either read values from the environment. +# Or, use `bin/rails secrets:setup` to configure encrypted secrets +# and move the `production:` environment over there. + +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/db/migrate/20171011040258_create_users.rb b/db/migrate/20171011040258_create_users.rb new file mode 100644 index 0000000000..4def90374b --- /dev/null +++ b/db/migrate/20171011040258_create_users.rb @@ -0,0 +1,10 @@ +class CreateUsers < ActiveRecord::Migration[5.1] + def change + create_table :users do |t| + t.string :name + t.date :joined_on + + t.timestamps + end + end +end diff --git a/db/migrate/20171011040511_create_movies.rb b/db/migrate/20171011040511_create_movies.rb new file mode 100644 index 0000000000..351bca0f15 --- /dev/null +++ b/db/migrate/20171011040511_create_movies.rb @@ -0,0 +1,12 @@ +class CreateMovies < ActiveRecord::Migration[5.1] + def change + create_table :movies do |t| + t.string :title + t.string :creator + t.date :published + t.string :description + + t.timestamps + end + end +end diff --git a/db/migrate/20171011040524_create_books.rb b/db/migrate/20171011040524_create_books.rb new file mode 100644 index 0000000000..057396d9b6 --- /dev/null +++ b/db/migrate/20171011040524_create_books.rb @@ -0,0 +1,12 @@ +class CreateBooks < ActiveRecord::Migration[5.1] + def change + create_table :books do |t| + t.string :title + t.string :creator + t.date :published + t.string :description + + t.timestamps + end + end +end diff --git a/db/migrate/20171011040535_create_albums.rb b/db/migrate/20171011040535_create_albums.rb new file mode 100644 index 0000000000..74c2fa634b --- /dev/null +++ b/db/migrate/20171011040535_create_albums.rb @@ -0,0 +1,12 @@ +class CreateAlbums < ActiveRecord::Migration[5.1] + def change + create_table :albums do |t| + t.string :title + t.string :creator + t.date :published + t.string :description + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000000..1f6269c517 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,49 @@ +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20171011040535) do + + create_table "albums", force: :cascade do |t| + t.string "title" + t.string "creator" + t.date "published" + t.string "description" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "books", force: :cascade do |t| + t.string "title" + t.string "creator" + t.date "published" + t.string "description" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "movies", force: :cascade do |t| + t.string "title" + t.string "creator" + t.date "published" + t.string "description" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "users", force: :cascade do |t| + t.string "name" + t.date "joined_on" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + +end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 0000000000..1beea2accd --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,7 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). +# +# Examples: +# +# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) +# Character.create(name: 'Luke', movie: movies.first) diff --git a/lib/assets/.keep b/lib/assets/.keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/tasks/.keep b/lib/tasks/.keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/log/.keep b/log/.keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/package.json b/package.json new file mode 100644 index 0000000000..625900f9d8 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "name": "MediaRanker", + "private": true, + "dependencies": {} +} diff --git a/public/404.html b/public/404.html new file mode 100644 index 0000000000..2be3af26fc --- /dev/null +++ b/public/404.html @@ -0,0 +1,67 @@ + + + + The page you were looking for doesn't exist (404) + + + + + + +
+
+

The page you were looking for doesn't exist.

+

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

+
+

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

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

The change you wanted was rejected.

+

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

+
+

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

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

We're sorry, but something went wrong.

+
+

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

+
+ + diff --git a/public/apple-touch-icon-precomposed.png b/public/apple-touch-icon-precomposed.png new file mode 100644 index 0000000000..e69de29bb2 diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png new file mode 100644 index 0000000000..e69de29bb2 diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000000..e69de29bb2 diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000000..37b576a4a0 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1 @@ +# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb new file mode 100644 index 0000000000..d19212abd5 --- /dev/null +++ b/test/application_system_test_case.rb @@ -0,0 +1,5 @@ +require "test_helper" + +class ApplicationSystemTestCase < ActionDispatch::SystemTestCase + driven_by :selenium, using: :chrome, screen_size: [1400, 1400] +end diff --git a/test/controllers/.keep b/test/controllers/.keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/controllers/album_controller_test.rb b/test/controllers/album_controller_test.rb new file mode 100644 index 0000000000..cd2a6daf45 --- /dev/null +++ b/test/controllers/album_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class AlbumControllerTest < ActionDispatch::IntegrationTest + test "should get index" do + get album_index_url + assert_response :success + end + +end diff --git a/test/controllers/book_controller_test.rb b/test/controllers/book_controller_test.rb new file mode 100644 index 0000000000..e4ef75f1fb --- /dev/null +++ b/test/controllers/book_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class BookControllerTest < ActionDispatch::IntegrationTest + test "should get index" do + get book_index_url + assert_response :success + end + +end diff --git a/test/controllers/movie_controller_test.rb b/test/controllers/movie_controller_test.rb new file mode 100644 index 0000000000..8399764748 --- /dev/null +++ b/test/controllers/movie_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class MovieControllerTest < ActionDispatch::IntegrationTest + test "should get index" do + get movie_index_url + assert_response :success + end + +end diff --git a/test/controllers/user_controller_test.rb b/test/controllers/user_controller_test.rb new file mode 100644 index 0000000000..62207343f5 --- /dev/null +++ b/test/controllers/user_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class UserControllerTest < ActionDispatch::IntegrationTest + test "should get index" do + get user_index_url + assert_response :success + end + +end diff --git a/test/fixtures/.keep b/test/fixtures/.keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/fixtures/albums.yml b/test/fixtures/albums.yml new file mode 100644 index 0000000000..214c6c5b4d --- /dev/null +++ b/test/fixtures/albums.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + title: MyString + creator: MyString + published: 2017-10-10 + description: MyString + +two: + title: MyString + creator: MyString + published: 2017-10-10 + description: MyString diff --git a/test/fixtures/books.yml b/test/fixtures/books.yml new file mode 100644 index 0000000000..214c6c5b4d --- /dev/null +++ b/test/fixtures/books.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + title: MyString + creator: MyString + published: 2017-10-10 + description: MyString + +two: + title: MyString + creator: MyString + published: 2017-10-10 + description: MyString diff --git a/test/fixtures/files/.keep b/test/fixtures/files/.keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/fixtures/movies.yml b/test/fixtures/movies.yml new file mode 100644 index 0000000000..214c6c5b4d --- /dev/null +++ b/test/fixtures/movies.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + title: MyString + creator: MyString + published: 2017-10-10 + description: MyString + +two: + title: MyString + creator: MyString + published: 2017-10-10 + description: MyString diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml new file mode 100644 index 0000000000..5d63da82b6 --- /dev/null +++ b/test/fixtures/users.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: + joined_on: 2017-10-10 + +two: + name: + joined_on: 2017-10-10 diff --git a/test/helpers/.keep b/test/helpers/.keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/integration/.keep b/test/integration/.keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/mailers/.keep b/test/mailers/.keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/models/.keep b/test/models/.keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/models/album_test.rb b/test/models/album_test.rb new file mode 100644 index 0000000000..1efcda03fb --- /dev/null +++ b/test/models/album_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class AlbumTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/book_test.rb b/test/models/book_test.rb new file mode 100644 index 0000000000..e48079d4f7 --- /dev/null +++ b/test/models/book_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class BookTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/movie_test.rb b/test/models/movie_test.rb new file mode 100644 index 0000000000..22d7084689 --- /dev/null +++ b/test/models/movie_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class MovieTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/user_test.rb b/test/models/user_test.rb new file mode 100644 index 0000000000..82f61e0109 --- /dev/null +++ b/test/models/user_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/system/.keep b/test/system/.keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 0000000000..e3c4ff0b8e --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,9 @@ +require File.expand_path('../../config/environment', __FILE__) +require 'rails/test_help' + +class ActiveSupport::TestCase + # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. + fixtures :all + + # Add more helper methods to be used by all tests here... +end diff --git a/tmp/.keep b/tmp/.keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/vendor/.keep b/vendor/.keep new file mode 100644 index 0000000000..e69de29bb2 From 695fde59738f903b978ce5f8851e166ae0cfd0e7 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Thu, 12 Oct 2017 15:54:34 -0700 Subject: [PATCH 02/40] adding resources to routes --- config/routes.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/routes.rb b/config/routes.rb index a89530cf35..d425bc6793 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,5 +7,6 @@ get 'user/index' + resources :users, :books, :movies, :albums # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end From b9cf20ff07b5874b6b0ae3ba11a74aeb2f91c549 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Thu, 12 Oct 2017 16:43:29 -0700 Subject: [PATCH 03/40] saving work --- app/controllers/album_controller.rb | 1 + app/views/layouts/application.html.erb | 2 +- config/routes.rb | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/album_controller.rb b/app/controllers/album_controller.rb index 4c199cdc4d..a0ba490afa 100644 --- a/app/controllers/album_controller.rb +++ b/app/controllers/album_controller.rb @@ -1,4 +1,5 @@ class AlbumController < ApplicationController def index + @albums = Album.all end end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 6af511b830..c4e3157ca0 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,7 +5,7 @@ <%= csrf_meta_tags %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> - <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> + <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> diff --git a/config/routes.rb b/config/routes.rb index d425bc6793..c1e6c34a24 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,6 +7,9 @@ get 'user/index' + get 'layouts/application' + resources :users, :books, :movies, :albums + # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end From a20baad0db9714affa0ca5e120c32815dbe44218 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Thu, 12 Oct 2017 19:35:28 -0700 Subject: [PATCH 04/40] changing file names --- app/controllers/album_controller.rb | 5 ---- app/controllers/albums_controller.rb | 5 ++++ app/controllers/book_controller.rb | 4 --- app/controllers/books_controller.rb | 4 +++ app/controllers/movie_controller.rb | 4 --- app/controllers/movies_controller.rb | 4 +++ app/controllers/user_controller.rb | 4 --- app/controllers/users_controller.rb | 4 +++ app/views/album/index.html.erb | 7 +++++ db/seeds.rb | 45 +++++++++++++++++++++++----- 10 files changed, 62 insertions(+), 24 deletions(-) delete mode 100644 app/controllers/album_controller.rb create mode 100644 app/controllers/albums_controller.rb delete mode 100644 app/controllers/book_controller.rb create mode 100644 app/controllers/books_controller.rb delete mode 100644 app/controllers/movie_controller.rb create mode 100644 app/controllers/movies_controller.rb delete mode 100644 app/controllers/user_controller.rb create mode 100644 app/controllers/users_controller.rb diff --git a/app/controllers/album_controller.rb b/app/controllers/album_controller.rb deleted file mode 100644 index a0ba490afa..0000000000 --- a/app/controllers/album_controller.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AlbumController < ApplicationController - def index - @albums = Album.all - end -end diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb new file mode 100644 index 0000000000..3100b21721 --- /dev/null +++ b/app/controllers/albums_controller.rb @@ -0,0 +1,5 @@ +class AlbumsController < ApplicationController + def index + @albums = Album.all + end +end diff --git a/app/controllers/book_controller.rb b/app/controllers/book_controller.rb deleted file mode 100644 index bbc99a9e9b..0000000000 --- a/app/controllers/book_controller.rb +++ /dev/null @@ -1,4 +0,0 @@ -class BookController < ApplicationController - def index - end -end diff --git a/app/controllers/books_controller.rb b/app/controllers/books_controller.rb new file mode 100644 index 0000000000..c14e900612 --- /dev/null +++ b/app/controllers/books_controller.rb @@ -0,0 +1,4 @@ +class BooksController < ApplicationController + def index + end +end diff --git a/app/controllers/movie_controller.rb b/app/controllers/movie_controller.rb deleted file mode 100644 index 6a8dc423b5..0000000000 --- a/app/controllers/movie_controller.rb +++ /dev/null @@ -1,4 +0,0 @@ -class MovieController < ApplicationController - def index - end -end diff --git a/app/controllers/movies_controller.rb b/app/controllers/movies_controller.rb new file mode 100644 index 0000000000..b5ecfec7ca --- /dev/null +++ b/app/controllers/movies_controller.rb @@ -0,0 +1,4 @@ +class MoviesController < ApplicationController + def index + end +end diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb deleted file mode 100644 index 887bcb7f3f..0000000000 --- a/app/controllers/user_controller.rb +++ /dev/null @@ -1,4 +0,0 @@ -class UserController < ApplicationController - def index - end -end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb new file mode 100644 index 0000000000..3004a55609 --- /dev/null +++ b/app/controllers/users_controller.rb @@ -0,0 +1,4 @@ +class UsersController < ApplicationController + def index + end +end diff --git a/app/views/album/index.html.erb b/app/views/album/index.html.erb index 75733a72f3..00e03f6cfb 100644 --- a/app/views/album/index.html.erb +++ b/app/views/album/index.html.erb @@ -1,2 +1,9 @@

Album#index

Find me in app/views/album/index.html.erb

+ +<% @albums.each do |album| %> +

+ <%=album.title%> +

+ +<%end%> diff --git a/db/seeds.rb b/db/seeds.rb index 1beea2accd..283c9826f1 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,7 +1,38 @@ -# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). -# -# Examples: -# -# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) -# Character.create(name: 'Luke', movie: movies.first) +require 'csv' +require 'rails' + +puts Rails.root + +DRIVER_FILE = Rails.root.join('db', 'media_seeds.csv') +puts "Loading raw driver data from #{DRIVER_FILE}" + +driver_failures = [] +CSV.foreach(DRIVER_FILE, :headers => true) do |row| + if row['category'] == 'album' + record = Album.new + record.id = row['id'] + record.title = row['title'] + record.creator = row['creator'] + record.published = row['published'] + puts "Created Album: #{record.inspect}" + successful = record.save + if !successful + driver_failures << record + end + else + record = Book.new + record.id = row['id'] + record.title = row['title'] + record.creator = row['creator'] + record.published = row['published'] + puts "Created Album: #{record.inspect}" + successful = record.save + if !successful + driver_failures << record + end + end + +end + +puts "Added #{Driver.count} driver records" +puts "#{driver_failures.length} drivers failed to save" From e89bb8d739550488561d6894e69230b334940fbe Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Thu, 12 Oct 2017 23:01:41 -0700 Subject: [PATCH 05/40] adding head nav --- app/assets/javascripts/application.js | 1 - app/controllers/works_controller.rb | 5 ++++ app/views/album/index.html.erb | 9 ------- app/views/albums/index.html.erb | 6 +++++ app/views/{book => books}/index.html.erb | 0 app/views/{movie => movies}/index.html.erb | 0 app/views/{user => users}/index.html.erb | 0 app/views/works/index.html.erb | 28 ++++++++++++++++++++++ config/routes.rb | 18 +++++++------- 9 files changed, 48 insertions(+), 19 deletions(-) create mode 100644 app/controllers/works_controller.rb delete mode 100644 app/views/album/index.html.erb create mode 100644 app/views/albums/index.html.erb rename app/views/{book => books}/index.html.erb (100%) rename app/views/{movie => movies}/index.html.erb (100%) rename app/views/{user => users}/index.html.erb (100%) create mode 100644 app/views/works/index.html.erb diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 46b20359fa..af9ee26751 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -12,4 +12,3 @@ // //= require rails-ujs //= require turbolinks -//= require_tree . diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb new file mode 100644 index 0000000000..d748dabcd9 --- /dev/null +++ b/app/controllers/works_controller.rb @@ -0,0 +1,5 @@ +class WorksController < ApplicationController + def index + @albums = Album.all + end +end diff --git a/app/views/album/index.html.erb b/app/views/album/index.html.erb deleted file mode 100644 index 00e03f6cfb..0000000000 --- a/app/views/album/index.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -

Album#index

-

Find me in app/views/album/index.html.erb

- -<% @albums.each do |album| %> -

- <%=album.title%> -

- -<%end%> diff --git a/app/views/albums/index.html.erb b/app/views/albums/index.html.erb new file mode 100644 index 0000000000..cfdcb7690f --- /dev/null +++ b/app/views/albums/index.html.erb @@ -0,0 +1,6 @@ + +<% @albums.each do |album| %> +

+ <%= link_to "#{album.title}", album_path(album)%>

+ +<%end%> diff --git a/app/views/book/index.html.erb b/app/views/books/index.html.erb similarity index 100% rename from app/views/book/index.html.erb rename to app/views/books/index.html.erb diff --git a/app/views/movie/index.html.erb b/app/views/movies/index.html.erb similarity index 100% rename from app/views/movie/index.html.erb rename to app/views/movies/index.html.erb diff --git a/app/views/user/index.html.erb b/app/views/users/index.html.erb similarity index 100% rename from app/views/user/index.html.erb rename to app/views/users/index.html.erb diff --git a/app/views/works/index.html.erb b/app/views/works/index.html.erb new file mode 100644 index 0000000000..82b884cd2e --- /dev/null +++ b/app/views/works/index.html.erb @@ -0,0 +1,28 @@ +
+ + + + + +
+ +<% @albums.each do |album| %> +

+ <%= link_to "#{album.title}", album_path(album)%>

+ +<%end%> diff --git a/config/routes.rb b/config/routes.rb index c1e6c34a24..e47d5e7999 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,13 +1,13 @@ Rails.application.routes.draw do - get 'album/index' - - get 'book/index' - - get 'movie/index' - - get 'user/index' - - get 'layouts/application' + #root 'home#index' + get '/works', to: 'works#index', as: 'works' +# get '/albums', to: 'albums#index', as: 'albums' + get '/albums/new', to: 'albums#new', as: 'new_album' + post '/albums', to: 'albums#create' + get '/albums/:id', to: 'albums#show', as: 'album' + get '/albums/:id/edit', to: 'albums#edit', as: 'edit_album' + patch '/albums/:id', to: 'albums#update' + delete '/albums/:id', to: 'albums#destory' resources :users, :books, :movies, :albums From f7f4ee4d50c51a324b9266eca703922f8af80eb9 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Thu, 12 Oct 2017 23:26:57 -0700 Subject: [PATCH 06/40] making more routes and building pages --- app/controllers/works_controller.rb | 19 ++++++++++ app/views/albums/show.html.erb | 2 ++ app/views/books/show.html.erb | 2 ++ app/views/movies/show.html.erb | 2 ++ app/views/works/index.html.erb | 55 ++++++++++++++++++++++++++--- app/views/works/new.html.erb | 43 ++++++++++++++++++++++ config/routes.rb | 18 ++++++---- 7 files changed, 130 insertions(+), 11 deletions(-) create mode 100644 app/views/albums/show.html.erb create mode 100644 app/views/books/show.html.erb create mode 100644 app/views/movies/show.html.erb create mode 100644 app/views/works/new.html.erb diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb index d748dabcd9..698d6b0c6c 100644 --- a/app/controllers/works_controller.rb +++ b/app/controllers/works_controller.rb @@ -1,5 +1,24 @@ class WorksController < ApplicationController def index @albums = Album.all + + @books = Book.all + + @movies = Movie.all + end + + def show + @work = Task.find(params[:id]) + end + + def new + if params[:category] == 'book' + + end + + def create + task = Task.new(title: params[:task][:title], description: params[:task][:description], due_date: params[:task][:due_date], complete: false) + task.save + redirect_to tasks_path end end diff --git a/app/views/albums/show.html.erb b/app/views/albums/show.html.erb new file mode 100644 index 0000000000..1522c39719 --- /dev/null +++ b/app/views/albums/show.html.erb @@ -0,0 +1,2 @@ +

Movie#index

+

Find me in app/views/movie/index.html.erb

diff --git a/app/views/books/show.html.erb b/app/views/books/show.html.erb new file mode 100644 index 0000000000..1522c39719 --- /dev/null +++ b/app/views/books/show.html.erb @@ -0,0 +1,2 @@ +

Movie#index

+

Find me in app/views/movie/index.html.erb

diff --git a/app/views/movies/show.html.erb b/app/views/movies/show.html.erb new file mode 100644 index 0000000000..1522c39719 --- /dev/null +++ b/app/views/movies/show.html.erb @@ -0,0 +1,2 @@ +

Movie#index

+

Find me in app/views/movie/index.html.erb

diff --git a/app/views/works/index.html.erb b/app/views/works/index.html.erb index 82b884cd2e..eeb661012e 100644 --- a/app/views/works/index.html.erb +++ b/app/views/works/index.html.erb @@ -21,8 +21,53 @@ -<% @albums.each do |album| %> -

- <%= link_to "#{album.title}", album_path(album)%>

- -<%end%> +
+

+ Place holder for top media +

+
+ +
+

+ Top Albums +

+ +
    + <% @albums.each do |album| %> +
  • + <%= link_to "#{album.title}", album_path(album)%> + by <%= album.creator%> +
  • + <%end%> +
+
+ +
+

+ Top Movies +

+ +
    + <% @movies.each do |movie| %> +
  • + <%= link_to "#{movie.title}", movie_path(movie)%> + by <%= movie.creator%> +
  • + <%end%> +
+
+ +
+

+ Top Books +

+ +
    + <% @books.each do |book| %> +
  • + <%= link_to "#{book.title}", book_path(book)%> + by <%= book.creator%> +
  • + <%end%> +
+
diff --git a/app/views/works/new.html.erb b/app/views/works/new.html.erb new file mode 100644 index 0000000000..1f882d56ba --- /dev/null +++ b/app/views/works/new.html.erb @@ -0,0 +1,43 @@ +
+ + + + + +
+ +

Create new work

+ +
+

+ <%= form_for @task do |f| %> + <%= f.label :title %> + <%= f.text_field :title %> +
+ <%= f.label :description %> + <%= f.text_field :description %> +
+ <%= f.label :due_date %> + <%= f.date_field :due_date %> +
+ <%= f.submit "Make a new task"%> + <% end %> + + + +

diff --git a/config/routes.rb b/config/routes.rb index e47d5e7999..d0511c2f94 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,12 +2,18 @@ #root 'home#index' get '/works', to: 'works#index', as: 'works' # get '/albums', to: 'albums#index', as: 'albums' - get '/albums/new', to: 'albums#new', as: 'new_album' - post '/albums', to: 'albums#create' - get '/albums/:id', to: 'albums#show', as: 'album' - get '/albums/:id/edit', to: 'albums#edit', as: 'edit_album' - patch '/albums/:id', to: 'albums#update' - delete '/albums/:id', to: 'albums#destory' + get '/works/new', to: 'works#new', as: 'new_work' + post '/works', to: 'works#create' + get '/albums/:id' to 'albums#show', as: 'album' + get '/movies/:id' to 'movies#show', as: 'movie' + get '/books/:id' to 'books#show', as: 'book' + get '/works/:id/edit', to: 'works#edit', as: 'edit_work' + patch '/works/:id', to: 'works#update' + delete '/works/:id', to: 'works#destory' + + get '/albums/:id' to 'albums#show', as: 'album' + get '/movies/:id' to 'movies#show', as: 'movie' + get '/books/:id' to 'books#show', as: 'book' resources :users, :books, :movies, :albums From cac420e06c179faf51b611148bc45a0e0c0e3de6 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Fri, 13 Oct 2017 02:50:16 -0700 Subject: [PATCH 07/40] helper methods and more content for pages --- app/controllers/albums_controller.rb | 9 ++- app/controllers/works_controller.rb | 5 +- app/helpers/application_helper.rb | 4 ++ app/models/vote.rb | 2 + app/views/albums/edit.html.erb | 42 +++++++++++++ app/views/albums/show.html.erb | 76 ++++++++++++++++++++++- config/routes.rb | 11 ++-- db/migrate/20171013090655_create_votes.rb | 12 ++++ db/schema.rb | 11 +++- test/fixtures/votes.yml | 13 ++++ test/models/vote_test.rb | 7 +++ 11 files changed, 178 insertions(+), 14 deletions(-) create mode 100644 app/models/vote.rb create mode 100644 app/views/albums/edit.html.erb create mode 100644 db/migrate/20171013090655_create_votes.rb create mode 100644 test/fixtures/votes.yml create mode 100644 test/models/vote_test.rb diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index 3100b21721..e9d70a9b92 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -1,5 +1,10 @@ class AlbumsController < ApplicationController - def index - @albums = Album.all + def show + @album = Album.find(params[:id]) + @votes = Vote.where(work_id: @album.id) + end + + def edit + @album = Album.find(params[:id]) end end diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb index 698d6b0c6c..0d6e060956 100644 --- a/app/controllers/works_controller.rb +++ b/app/controllers/works_controller.rb @@ -8,11 +8,12 @@ def index end def show - @work = Task.find(params[:id]) + + end def new - if params[:category] == 'book' + #if params[:category] == 'book' end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be7945c..0400f4f2cd 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,6 @@ module ApplicationHelper + def find_user(id) + return User.find(id).name + end + end diff --git a/app/models/vote.rb b/app/models/vote.rb new file mode 100644 index 0000000000..4c58e4f3d5 --- /dev/null +++ b/app/models/vote.rb @@ -0,0 +1,2 @@ +class Vote < ApplicationRecord +end diff --git a/app/views/albums/edit.html.erb b/app/views/albums/edit.html.erb new file mode 100644 index 0000000000..e3308cd857 --- /dev/null +++ b/app/views/albums/edit.html.erb @@ -0,0 +1,42 @@ +
+ + + + + +
+ +<%= form_for @album do |form| %> + <%= form.label :category %> + <%= form.select :category, ['album', 'book', 'movie'] %> +
+ <%= form.label :title %> + <%= form.text_field :title %> +
+ <%= form.label :creator %> + <%= form.date_field :creator %> +
+ <%= form.label :published %> + <%= form.check_box :published %> +
+ <%= form.label :description %> + <%= form.check_box :description %> +
+ + <%= form.submit "Update work"%> +<% end %> diff --git a/app/views/albums/show.html.erb b/app/views/albums/show.html.erb index 1522c39719..c6b931dd43 100644 --- a/app/views/albums/show.html.erb +++ b/app/views/albums/show.html.erb @@ -1,2 +1,74 @@ -

Movie#index

-

Find me in app/views/movie/index.html.erb

+
+ + + + + +
+ +
+

+ <%= @album.title %> +

+ +

+ Created by <%= @album.creator %> +

+ +

+ Published: <%= @album.published %> +

+ +

+ <%= @album.description %> +

+
+ +
+

+ <%= @votes.count %> Votes for this Album +

+ + + + + + + + + + <% @votes.each do |vote| %> + + + + + <% end %> + + +
UserDate
<%= find_user(vote.user_id)%> <%= vote.date %>
+ + + +
+ + diff --git a/config/routes.rb b/config/routes.rb index d0511c2f94..be6e42a372 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,17 +4,14 @@ # get '/albums', to: 'albums#index', as: 'albums' get '/works/new', to: 'works#new', as: 'new_work' post '/works', to: 'works#create' - get '/albums/:id' to 'albums#show', as: 'album' - get '/movies/:id' to 'movies#show', as: 'movie' - get '/books/:id' to 'books#show', as: 'book' + get '/albums/:id', to: 'albums#show', as: 'album' + get '/movies/:id', to: 'movies#show', as: 'movie' + get '/books/:id', to: 'books#show', as: 'book' get '/works/:id/edit', to: 'works#edit', as: 'edit_work' patch '/works/:id', to: 'works#update' delete '/works/:id', to: 'works#destory' - get '/albums/:id' to 'albums#show', as: 'album' - get '/movies/:id' to 'movies#show', as: 'movie' - get '/books/:id' to 'books#show', as: 'book' - +# root 'works#index' resources :users, :books, :movies, :albums # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html diff --git a/db/migrate/20171013090655_create_votes.rb b/db/migrate/20171013090655_create_votes.rb new file mode 100644 index 0000000000..1d6996190e --- /dev/null +++ b/db/migrate/20171013090655_create_votes.rb @@ -0,0 +1,12 @@ +class CreateVotes < ActiveRecord::Migration[5.1] + def change + create_table :votes do |t| + t.string :category + t.integer :work_id + t.integer :user_id + t.date :date + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 1f6269c517..2b126670c7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20171011040535) do +ActiveRecord::Schema.define(version: 20171013090655) do create_table "albums", force: :cascade do |t| t.string "title" @@ -46,4 +46,13 @@ t.datetime "updated_at", null: false end + create_table "votes", force: :cascade do |t| + t.string "category" + t.integer "work_id" + t.integer "user_id" + t.date "date" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + end diff --git a/test/fixtures/votes.yml b/test/fixtures/votes.yml new file mode 100644 index 0000000000..06519cc948 --- /dev/null +++ b/test/fixtures/votes.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + category: MyString + work_id: 1 + user_id: 1 + date: 2017-10-13 + +two: + category: MyString + work_id: 1 + user_id: 1 + date: 2017-10-13 diff --git a/test/models/vote_test.rb b/test/models/vote_test.rb new file mode 100644 index 0000000000..f31f99299c --- /dev/null +++ b/test/models/vote_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class VoteTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end From a1a79d1047e2d09110ad866d4fe6ff5b0cfe43f9 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Fri, 13 Oct 2017 11:43:31 -0700 Subject: [PATCH 08/40] adding work model and updating index page --- app/controllers/works_controller.rb | 18 +++--- app/models/work.rb | 2 + app/views/albums/edit.html.erb | 2 +- app/views/works/all.html.erb | 1 + app/views/works/index.html.erb | 24 +++----- app/views/works/show.html.erb | 74 +++++++++++++++++++++++ config/routes.rb | 5 +- db/migrate/20171013181157_create_works.rb | 13 ++++ db/schema.rb | 12 +++- db/seeds.rb | 19 +----- test/fixtures/works.yml | 15 +++++ test/models/work_test.rb | 7 +++ 12 files changed, 145 insertions(+), 47 deletions(-) create mode 100644 app/models/work.rb create mode 100644 app/views/works/all.html.erb create mode 100644 app/views/works/show.html.erb create mode 100644 db/migrate/20171013181157_create_works.rb create mode 100644 test/fixtures/works.yml create mode 100644 test/models/work_test.rb diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb index 0d6e060956..a591f597c7 100644 --- a/app/controllers/works_controller.rb +++ b/app/controllers/works_controller.rb @@ -1,15 +1,13 @@ class WorksController < ApplicationController def index - @albums = Album.all - - @books = Book.all - - @movies = Movie.all + @works = Work.all + @top_work_id = Vote.limit(1).group(:work_id).order('count_work_id DESC').count('work_id') + @top_work = Work.find(@top_work_id.keys[0]) end def show - - + @work = Work.find(params[:id]) + @votes = Vote.where(work_id: @work.id) end def new @@ -17,8 +15,12 @@ def new end + def show_all + @works = Work.all + end + def create - task = Task.new(title: params[:task][:title], description: params[:task][:description], due_date: params[:task][:due_date], complete: false) + task = Work.new(title: params[:task][:title], description: params[:task][:description], due_date: params[:task][:due_date], complete: false) task.save redirect_to tasks_path end diff --git a/app/models/work.rb b/app/models/work.rb new file mode 100644 index 0000000000..95322dd45e --- /dev/null +++ b/app/models/work.rb @@ -0,0 +1,2 @@ +class Work < ApplicationRecord +end diff --git a/app/views/albums/edit.html.erb b/app/views/albums/edit.html.erb index e3308cd857..7a1ed75516 100644 --- a/app/views/albums/edit.html.erb +++ b/app/views/albums/edit.html.erb @@ -23,7 +23,7 @@ <%= form_for @album do |form| %> <%= form.label :category %> - <%= form.select :category, ['album', 'book', 'movie'] %> + <%= form.select :category, options_for_select['book', 'movie', 'album'] %>
<%= form.label :title %> <%= form.text_field :title %> diff --git a/app/views/works/all.html.erb b/app/views/works/all.html.erb new file mode 100644 index 0000000000..14a3799397 --- /dev/null +++ b/app/views/works/all.html.erb @@ -0,0 +1 @@ +

place holder

diff --git a/app/views/works/index.html.erb b/app/views/works/index.html.erb index eeb661012e..bfdf616304 100644 --- a/app/views/works/index.html.erb +++ b/app/views/works/index.html.erb @@ -23,20 +23,20 @@

- Place holder for top media + Media Spotlight: <%= @top_work.title %> by <%= @top_work.creator%>

- Top Albums + Top work

    - <% @albums.each do |album| %> + <% @works.each do |work| %>
  • - <%= link_to "#{album.title}", album_path(album)%> - by <%= album.creator%> + <%= link_to "#{work.title}", work_path(work)%> + by <%= work.creator%>
  • <%end%>
@@ -48,12 +48,7 @@
    - <% @movies.each do |movie| %> -
  • - <%= link_to "#{movie.title}", movie_path(movie)%> - by <%= movie.creator%> -
  • - <%end%> +
@@ -63,11 +58,6 @@
    - <% @books.each do |book| %> -
  • - <%= link_to "#{book.title}", book_path(book)%> - by <%= book.creator%> -
  • - <%end%> +
diff --git a/app/views/works/show.html.erb b/app/views/works/show.html.erb new file mode 100644 index 0000000000..8783dc2d0c --- /dev/null +++ b/app/views/works/show.html.erb @@ -0,0 +1,74 @@ +
+ + + + + +
+ +
+

+ <%= @work.title %> +

+ +

+ Created by <%= @work.creator %> +

+ +

+ Published: <%= @work.published %> +

+ +

+ <%= @work.description %> +

+
+ +
+

+ <%= @votes.count %> Votes for this work +

+ + + + + + + + + + <% @votes.each do |vote| %> + + + + + <% end %> + + +
UserDate
<%= find_user(vote.user_id)%> <%= vote.date %>
+ + + +
+ + diff --git a/config/routes.rb b/config/routes.rb index be6e42a372..de5a809575 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,12 +1,9 @@ Rails.application.routes.draw do #root 'home#index' get '/works', to: 'works#index', as: 'works' -# get '/albums', to: 'albums#index', as: 'albums' get '/works/new', to: 'works#new', as: 'new_work' post '/works', to: 'works#create' - get '/albums/:id', to: 'albums#show', as: 'album' - get '/movies/:id', to: 'movies#show', as: 'movie' - get '/books/:id', to: 'books#show', as: 'book' + get '/works/:id', to: 'works#show', as: 'work' get '/works/:id/edit', to: 'works#edit', as: 'edit_work' patch '/works/:id', to: 'works#update' delete '/works/:id', to: 'works#destory' diff --git a/db/migrate/20171013181157_create_works.rb b/db/migrate/20171013181157_create_works.rb new file mode 100644 index 0000000000..64312307b7 --- /dev/null +++ b/db/migrate/20171013181157_create_works.rb @@ -0,0 +1,13 @@ +class CreateWorks < ActiveRecord::Migration[5.1] + def change + create_table :works do |t| + t.string :category + t.string :title + t.string :creator + t.string :published + t.text :description + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 2b126670c7..6f76fa8973 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20171013090655) do +ActiveRecord::Schema.define(version: 20171013181157) do create_table "albums", force: :cascade do |t| t.string "title" @@ -55,4 +55,14 @@ t.datetime "updated_at", null: false end + create_table "works", force: :cascade do |t| + t.string "category" + t.string "title" + t.string "creator" + t.string "published" + t.text "description" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + end diff --git a/db/seeds.rb b/db/seeds.rb index 283c9826f1..a570a32874 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -8,9 +8,9 @@ driver_failures = [] CSV.foreach(DRIVER_FILE, :headers => true) do |row| - if row['category'] == 'album' - record = Album.new + record = Work.new record.id = row['id'] + record.category = row['category'] record.title = row['title'] record.creator = row['creator'] record.published = row['published'] @@ -19,20 +19,7 @@ if !successful driver_failures << record end - else - record = Book.new - record.id = row['id'] - record.title = row['title'] - record.creator = row['creator'] - record.published = row['published'] - puts "Created Album: #{record.inspect}" - successful = record.save - if !successful - driver_failures << record - end - end - end -puts "Added #{Driver.count} driver records" +puts "Added #{Work.count} driver records" puts "#{driver_failures.length} drivers failed to save" diff --git a/test/fixtures/works.yml b/test/fixtures/works.yml new file mode 100644 index 0000000000..b92d19bc01 --- /dev/null +++ b/test/fixtures/works.yml @@ -0,0 +1,15 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + category: MyString + title: MyString + creator: MyString + published: MyString + description: MyText + +two: + category: MyString + title: MyString + creator: MyString + published: MyString + description: MyText diff --git a/test/models/work_test.rb b/test/models/work_test.rb new file mode 100644 index 0000000000..b9047fab13 --- /dev/null +++ b/test/models/work_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class WorkTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end From 2b47435ef7089f6c5694a64cf649c30b1c0ed444 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Fri, 13 Oct 2017 12:28:56 -0700 Subject: [PATCH 09/40] adding update and edit functionality --- app/controllers/works_controller.rb | 20 +++++++++++ app/helpers/application_helper.rb | 3 ++ app/views/works/edit.html.erb | 45 +++++++++++++++++++++++++ app/views/works/index.html.erb | 52 +++++++++++++++++++++-------- app/views/works/show.html.erb | 7 ++-- 5 files changed, 110 insertions(+), 17 deletions(-) create mode 100644 app/views/works/edit.html.erb diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb index a591f597c7..b390c3b108 100644 --- a/app/controllers/works_controller.rb +++ b/app/controllers/works_controller.rb @@ -1,8 +1,12 @@ class WorksController < ApplicationController def index @works = Work.all + @albums = Work.where(category: 'album') + @books = Work.where(category: 'book') + @movies = Work.where(category: 'movie') @top_work_id = Vote.limit(1).group(:work_id).order('count_work_id DESC').count('work_id') @top_work = Work.find(@top_work_id.keys[0]) + @top_work_votes = Vote.where(work_id: @top_work_id.keys[0]) end def show @@ -15,6 +19,22 @@ def new end + def update + @work = Work.find(params[:id]) + @work.category = params[:work][:category] + @work.description = params[:work][:description] + @work.creator = params[:work][:creator] + @work.published = params[:work][:published] + @work.title = params[:work][:title] + + @work.save + redirect_to work_path + end + + def edit + @work = Work.find(params[:id]) + end + def show_all @works = Work.all end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0400f4f2cd..7947e5cc66 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3,4 +3,7 @@ def find_user(id) return User.find(id).name end + def votes_for_work(work) + return Vote.where(work_id: work.id).count + end end diff --git a/app/views/works/edit.html.erb b/app/views/works/edit.html.erb new file mode 100644 index 0000000000..55fac93197 --- /dev/null +++ b/app/views/works/edit.html.erb @@ -0,0 +1,45 @@ +
+ + + + + +
+ +

Edit this

+ +<%= form_for @work do |f| %> + <%= f.label :category %> + <%= f.select :category, [['Album', 'album'], ['Book', 'book'], ['Movie', 'movies']] %> +
+ <%= f.label :title %> + <%= f.text_field :title %> +
+ <%= f.label :creator %> + <%= f.text_field :creator %> +
+ <%= f.label :published %> + <%= f.text_field :published %> +
+ <%= f.label :description %> + <%= f.text_area :description %> +
+ + <%= f.submit %> + +<% end %> diff --git a/app/views/works/index.html.erb b/app/views/works/index.html.erb index bfdf616304..a8d2347a7c 100644 --- a/app/views/works/index.html.erb +++ b/app/views/works/index.html.erb @@ -25,39 +25,65 @@

Media Spotlight: <%= @top_work.title %> by <%= @top_work.creator%>

+

+ <%= @top_work_votes.count %> votes - <%= @top_work.description %> +

- Top work + Top Albums

    - <% @works.each do |work| %> + <% @albums.each do |album| %>
  • - <%= link_to "#{work.title}", work_path(work)%> - by <%= work.creator%> +

    + <%= link_to album.title, work_path(album) %> + by <%= album.creator %> +

    +

    + <%= votes_for_work(album) %> votes +

  • - <%end%> + <% end %>
-

- Top Movies -

- -
    - -
+

Top Movies

+
    + <% @movies.each do |movie| %> +
  • +

    + <%= link_to movie.title, work_path(movie) %> + by <%= movie.creator %> +

    +

    + <%= votes_for_work(movie) %> votes +

    +
  • + <% end %> +
+

Top Books

    - + <% @books.each do |book| %> +
  • +

    + <%= link_to book.title, work_path(book) %> + by <%= book.creator %> +

    +

    + <%= votes_for_work(book) %> votes +

    +
  • + <% end %>
diff --git a/app/views/works/show.html.erb b/app/views/works/show.html.erb index 8783dc2d0c..0dfc690875 100644 --- a/app/views/works/show.html.erb +++ b/app/views/works/show.html.erb @@ -61,14 +61,13 @@ + - - From 291ff703e83f303e83912d2438135dd0b7e79933 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Fri, 13 Oct 2017 12:41:37 -0700 Subject: [PATCH 10/40] adding destory --- app/controllers/works_controller.rb | 11 +++++++++++ app/views/works/show.html.erb | 2 +- config/routes.rb | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb index b390c3b108..a64c1ba341 100644 --- a/app/controllers/works_controller.rb +++ b/app/controllers/works_controller.rb @@ -9,6 +9,13 @@ def index @top_work_votes = Vote.where(work_id: @top_work_id.keys[0]) end + def destroy + @work = Work.find(params[:id]) + @work.destroy + + redirect_to works_path + end + def show @work = Work.find(params[:id]) @votes = Vote.where(work_id: @work.id) @@ -19,6 +26,7 @@ def new end + def update @work = Work.find(params[:id]) @work.category = params[:work][:category] @@ -44,4 +52,7 @@ def create task.save redirect_to tasks_path end + + + end diff --git a/app/views/works/show.html.erb b/app/views/works/show.html.erb index 0dfc690875..6c0e800858 100644 --- a/app/views/works/show.html.erb +++ b/app/views/works/show.html.erb @@ -69,5 +69,5 @@ <%= link_to 'Back to media ranks', works_path %> <%= link_to 'Edit', edit_work_path %> <%= link_to 'Upvote', works_path(@work) %> - <%= link_to 'Delete', works_path(@work) %> + <%= link_to 'Delete', work_path(@work), method: :delete, data: { confirm: "Are you sure?" } %> diff --git a/config/routes.rb b/config/routes.rb index de5a809575..9becd35151 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,7 +6,7 @@ get '/works/:id', to: 'works#show', as: 'work' get '/works/:id/edit', to: 'works#edit', as: 'edit_work' patch '/works/:id', to: 'works#update' - delete '/works/:id', to: 'works#destory' + delete '/works/:id', to: 'works#destroy' # root 'works#index' resources :users, :books, :movies, :albums From cef8bbb4f247e13c750ef5f8c5458926d13392d9 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Fri, 13 Oct 2017 14:16:39 -0700 Subject: [PATCH 11/40] adding upvotes --- app/controllers/works_controller.rb | 40 +++++++++++++++++++++-------- app/helpers/application_helper.rb | 4 +++ app/views/works/new.html.erb | 22 +++++++++------- app/views/works/show.html.erb | 2 +- config/routes.rb | 1 + 5 files changed, 48 insertions(+), 21 deletions(-) diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb index a64c1ba341..9820114f0b 100644 --- a/app/controllers/works_controller.rb +++ b/app/controllers/works_controller.rb @@ -1,7 +1,9 @@ +require 'date' + class WorksController < ApplicationController def index - @works = Work.all @albums = Work.where(category: 'album') + @books = Work.where(category: 'book') @movies = Work.where(category: 'movie') @top_work_id = Vote.limit(1).group(:work_id).order('count_work_id DESC').count('work_id') @@ -22,10 +24,35 @@ def show end def new - #if params[:category] == 'book' + @work = Work.new + end + + def create + @work = Work.new(title: params[:work][:title], + description: params[:work][:description], + category: params[:work][:category], + creator: params[:work][:creator], + published: params[:work][:published]) + @work.save + redirect_to works_path end + def upvote + @work = Work.find(params[:id]) + #@vote = Vote.new(category: params[:work][:category], + #work_id: params[:work][:work_id], +# user_id: 1) + + @vote = Vote.new(category: @work.category, + work_id: @work.id, + date: Date.today, + user_id: 1) + @vote.save + + redirect_to work_path + + end def update @work = Work.find(params[:id]) @@ -46,13 +73,4 @@ def edit def show_all @works = Work.all end - - def create - task = Work.new(title: params[:task][:title], description: params[:task][:description], due_date: params[:task][:due_date], complete: false) - task.save - redirect_to tasks_path - end - - - end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7947e5cc66..059520794a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -6,4 +6,8 @@ def find_user(id) def votes_for_work(work) return Vote.where(work_id: work.id).count end + + def top_10_albums + @albums = Work.where(category: 'album') + end end diff --git a/app/views/works/new.html.erb b/app/views/works/new.html.erb index 1f882d56ba..bf39e46c03 100644 --- a/app/views/works/new.html.erb +++ b/app/views/works/new.html.erb @@ -24,20 +24,24 @@

Create new work

-

- <%= form_for @task do |f| %> + <%= form_for @work do |f| %> + <%= f.label :category %> + <%= f.select :category, [['album', 'album'], ['book', 'book'], ['movie', 'movie']] %> +
<%= f.label :title %> <%= f.text_field :title %>
- <%= f.label :description %> - <%= f.text_field :description %> + <%= f.label :creator %> + <%= f.text_field :creator %>
- <%= f.label :due_date %> - <%= f.date_field :due_date %> + <%= f.label :published %> + <%= f.text_field :published %> +
+ <%= f.label :description %> + <%= f.text_area :description %>
- <%= f.submit "Make a new task"%> - <% end %> - + <%= f.submit %> + <% end %>

diff --git a/app/views/works/show.html.erb b/app/views/works/show.html.erb index 6c0e800858..b2770aecd6 100644 --- a/app/views/works/show.html.erb +++ b/app/views/works/show.html.erb @@ -68,6 +68,6 @@ diff --git a/config/routes.rb b/config/routes.rb index 9becd35151..9845593461 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,6 +3,7 @@ get '/works', to: 'works#index', as: 'works' get '/works/new', to: 'works#new', as: 'new_work' post '/works', to: 'works#create' + post '/works/:id/upvote', to: 'works#upvote', as: 'upvote_work' get '/works/:id', to: 'works#show', as: 'work' get '/works/:id/edit', to: 'works#edit', as: 'edit_work' patch '/works/:id', to: 'works#update' From faefbd5533b112eb2c09ccc9dda3a4de35a6e420 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Fri, 13 Oct 2017 15:31:00 -0700 Subject: [PATCH 12/40] fixing top 10 works per section --- app/controllers/works_controller.rb | 5 ----- app/helpers/application_helper.rb | 9 +++++++-- app/views/works/index.html.erb | 6 +++--- app/views/works/{all.html.erb => works.html.erb} | 0 4 files changed, 10 insertions(+), 10 deletions(-) rename app/views/works/{all.html.erb => works.html.erb} (100%) diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb index 9820114f0b..312eec9bbb 100644 --- a/app/controllers/works_controller.rb +++ b/app/controllers/works_controller.rb @@ -3,7 +3,6 @@ class WorksController < ApplicationController def index @albums = Work.where(category: 'album') - @books = Work.where(category: 'book') @movies = Work.where(category: 'movie') @top_work_id = Vote.limit(1).group(:work_id).order('count_work_id DESC').count('work_id') @@ -40,10 +39,6 @@ def create def upvote @work = Work.find(params[:id]) - #@vote = Vote.new(category: params[:work][:category], - #work_id: params[:work][:work_id], -# user_id: 1) - @vote = Vote.new(category: @work.category, work_id: @work.id, date: Date.today, diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 059520794a..dd24d01532 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -7,7 +7,12 @@ def votes_for_work(work) return Vote.where(work_id: work.id).count end - def top_10_albums - @albums = Work.where(category: 'album') + def top_10(category) + result = [] + @top_works = Vote.limit(10).select('work_id, count(*) as count').where(category: category).group('work_id').order('count DESC') + @top_works.each do |work| + result << Work.find(work.work_id) + end + return result end end diff --git a/app/views/works/index.html.erb b/app/views/works/index.html.erb index a8d2347a7c..e6b05359d1 100644 --- a/app/views/works/index.html.erb +++ b/app/views/works/index.html.erb @@ -36,7 +36,7 @@
    - <% @albums.each do |album| %> + <% top_10('album').each do |album| %>
  • <%= link_to album.title, work_path(album) %> @@ -53,7 +53,7 @@

    Top Movies

      - <% @movies.each do |movie| %> + <% top_10('movie').each do |movie| %>
    • <%= link_to movie.title, work_path(movie) %> @@ -74,7 +74,7 @@

        - <% @books.each do |book| %> + <% top_10('book').each do |book| %>
      • <%= link_to book.title, work_path(book) %> diff --git a/app/views/works/all.html.erb b/app/views/works/works.html.erb similarity index 100% rename from app/views/works/all.html.erb rename to app/views/works/works.html.erb From cad2acdce39a75137f98f0bf12c6fd0e363fc64a Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Fri, 13 Oct 2017 17:06:22 -0700 Subject: [PATCH 13/40] changing homepage --- app/controllers/application_controller.rb | 4 + app/controllers/home_controller.rb | 7 ++ app/views/home/index.html.erb | 89 +++++++++++++++++++++++ config/routes.rb | 2 +- 4 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 app/controllers/home_controller.rb create mode 100644 app/views/home/index.html.erb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1c07694e9d..d512c034d8 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,7 @@ class ApplicationController < ActionController::Base protect_from_forgery with: :exception + + def index + end + end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb new file mode 100644 index 0000000000..5e54203379 --- /dev/null +++ b/app/controllers/home_controller.rb @@ -0,0 +1,7 @@ +class HomeController < ApplicationController + def index + @top_work_id = Vote.limit(1).group(:work_id).order('count_work_id DESC').count('work_id') + @top_work = Work.find(@top_work_id.keys[0]) + @top_work_votes = Vote.where(work_id: @top_work_id.keys[0]) + end +end diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb new file mode 100644 index 0000000000..e6b05359d1 --- /dev/null +++ b/app/views/home/index.html.erb @@ -0,0 +1,89 @@ +
        + + + + + +
        + +
        +

        + Media Spotlight: <%= @top_work.title %> by <%= @top_work.creator%> +

        +

        + <%= @top_work_votes.count %> votes - <%= @top_work.description %> +

        +
        + +
        +

        + Top Albums +

        + +
          + <% top_10('album').each do |album| %> +
        • +

          + <%= link_to album.title, work_path(album) %> + by <%= album.creator %> +

          +

          + <%= votes_for_work(album) %> votes +

          +
        • + <% end %> +
        +
        + +
        +

        Top Movies

        +
          + <% top_10('movie').each do |movie| %> +
        • +

          + <%= link_to movie.title, work_path(movie) %> + by <%= movie.creator %> +

          +

          + <%= votes_for_work(movie) %> votes +

          +
        • + <% end %> +
        +
        + + +
        +

        + Top Books +

        + +
          + <% top_10('book').each do |book| %> +
        • +

          + <%= link_to book.title, work_path(book) %> + by <%= book.creator %> +

          +

          + <%= votes_for_work(book) %> votes +

          +
        • + <% end %> +
        +
        diff --git a/config/routes.rb b/config/routes.rb index 9845593461..a8a3252365 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,7 +8,7 @@ get '/works/:id/edit', to: 'works#edit', as: 'edit_work' patch '/works/:id', to: 'works#update' delete '/works/:id', to: 'works#destroy' - + root 'home#index' # root 'works#index' resources :users, :books, :movies, :albums From 53a688f35f92f0fb1734b71f44913eb0b9d7a4cd Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Fri, 13 Oct 2017 17:46:14 -0700 Subject: [PATCH 14/40] updating users page --- app/controllers/users_controller.rb | 1 + app/controllers/works_controller.rb | 3 - app/helpers/application_helper.rb | 4 + app/views/users/index.html.erb | 45 +++++- app/views/works/index.html.erb | 204 ++++++++++++++++++++-------- 5 files changed, 196 insertions(+), 61 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 3004a55609..0b399889ef 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,4 +1,5 @@ class UsersController < ApplicationController def index + @users = User.all end end diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb index 312eec9bbb..bf2af48459 100644 --- a/app/controllers/works_controller.rb +++ b/app/controllers/works_controller.rb @@ -5,9 +5,6 @@ def index @albums = Work.where(category: 'album') @books = Work.where(category: 'book') @movies = Work.where(category: 'movie') - @top_work_id = Vote.limit(1).group(:work_id).order('count_work_id DESC').count('work_id') - @top_work = Work.find(@top_work_id.keys[0]) - @top_work_votes = Vote.where(work_id: @top_work_id.keys[0]) end def destroy diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index dd24d01532..4ce9711944 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -15,4 +15,8 @@ def top_10(category) end return result end + + def votes_for_users(user) + return Vote.where(user_id: user.id).count + end end diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index c825aaffc5..aa03e541ef 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1,2 +1,43 @@ -

        User#index

        -

        Find me in app/views/user/index.html.erb

        +
        + + + + + +
        + +

        List of Users

        + + + + + + + + + <% @users.each do |user| %> + + + + + + <% end %> + +
        Username Votes Joined
        <%= user.name %> <%= votes_for_users(user) %> <%= user.joined_on %>
        + +<%= link_to 'Back to Media List', root_path %> diff --git a/app/views/works/index.html.erb b/app/views/works/index.html.erb index e6b05359d1..0aa8949dbf 100644 --- a/app/views/works/index.html.erb +++ b/app/views/works/index.html.erb @@ -21,69 +21,161 @@ -
        -

        - Media Spotlight: <%= @top_work.title %> by <%= @top_work.creator%> -

        -

        - <%= @top_work_votes.count %> votes - <%= @top_work.description %> -

        -
        + +

        List of works

        -

        - Top Albums -

        - -
          - <% top_10('album').each do |album| %> -
        • -

          - <%= link_to album.title, work_path(album) %> - by <%= album.creator %> -

          -

          - <%= votes_for_work(album) %> votes -

          -
        • - <% end %> -
        +

        + Albums +

        + + + + + + + + + + + + <% @albums.each do |album| %> + + + + + + + + + + + + <% end %> + +
        + Votes + + Title + + Created By + + Published + + Upvote +
        + <%= votes_for_work(album) %> + + <%= link_to album.title, work_path(album) %> + + <%= album.creator %> + + <%= album.published %> + + <%= link_to 'Upvote', upvote_work_path(album), method: :post %> +
        -

        Top Movies

        -
          - <% top_10('movie').each do |movie| %> -
        • -

          - <%= link_to movie.title, work_path(movie) %> - by <%= movie.creator %> -

          -

          - <%= votes_for_work(movie) %> votes -

          -
        • +

          + books +

          + + + + + + + + + + + + <% @books.each do |book| %> + + + + + + + + + + + <% end %> - + +
          + Votes + + Title + + Created By + + Published + + Upvote +
          + <%= votes_for_work(book) %> + + <%= link_to book.title, work_path(book) %> + + <%= book.creator %> + + <%= book.published %> + + <%= link_to 'Upvote', upvote_work_path(book), method: :post %> +
        -
        -

        - Top Books -

        - -
          - <% top_10('book').each do |book| %> -
        • -

          - <%= link_to book.title, work_path(book) %> - by <%= book.creator %> -

          -

          - <%= votes_for_work(book) %> votes -

          -
        • - <% end %> -
        +

        + Movie +

        + + + + + + + + + + + + <% @movies.each do |movie| %> + + + + + + + + + + + + <% end %> + +
        + Votes + + Title + + Created By + + Published + + Upvote +
        + <%= votes_for_work(movie) %> + + <%= link_to movie.title, work_path(movie) %> + + <%= movie.creator %> + + <%= movie.published %> + + <%= link_to 'Upvote', upvote_work_path(movie), method: :post %> +
        From 63149ab8908f52a4b63f2e101423917a186b508e Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Fri, 13 Oct 2017 19:47:53 -0700 Subject: [PATCH 15/40] adding controllers --- app/controllers/logins_controller.rb | 5 +++++ app/controllers/sessions_contoller.rb | 5 +++++ app/views/login/index.html.erb | 30 +++++++++++++++++++++++++++ app/views/works/index.html.erb | 3 +++ app/views/works/works.html.erb | 1 - config/routes.rb | 1 + 6 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 app/controllers/logins_controller.rb create mode 100644 app/controllers/sessions_contoller.rb create mode 100644 app/views/login/index.html.erb delete mode 100644 app/views/works/works.html.erb diff --git a/app/controllers/logins_controller.rb b/app/controllers/logins_controller.rb new file mode 100644 index 0000000000..a76396785c --- /dev/null +++ b/app/controllers/logins_controller.rb @@ -0,0 +1,5 @@ +class LoginsController < ApplicationController + def index + + end +end diff --git a/app/controllers/sessions_contoller.rb b/app/controllers/sessions_contoller.rb new file mode 100644 index 0000000000..3935129869 --- /dev/null +++ b/app/controllers/sessions_contoller.rb @@ -0,0 +1,5 @@ +class SessionsController < ApplicationController + def login + + end +end diff --git a/app/views/login/index.html.erb b/app/views/login/index.html.erb new file mode 100644 index 0000000000..f528842502 --- /dev/null +++ b/app/views/login/index.html.erb @@ -0,0 +1,30 @@ +
        + + + + + +
        + +

        Log In

        + +<% form_tag({controller: 'sessions', action: 'login'}, method: 'post') do |f| %> + <%= f.label :name %> + <%= f.text_field :name %> + <%= f.submit %> +<% end %> diff --git a/app/views/works/index.html.erb b/app/views/works/index.html.erb index 0aa8949dbf..d2b0f3d50b 100644 --- a/app/views/works/index.html.erb +++ b/app/views/works/index.html.erb @@ -179,3 +179,6 @@

    + +<%= link_to 'View top media', root_path %> +<%= link_to 'Add a new work', new_work_path %> diff --git a/app/views/works/works.html.erb b/app/views/works/works.html.erb deleted file mode 100644 index 14a3799397..0000000000 --- a/app/views/works/works.html.erb +++ /dev/null @@ -1 +0,0 @@ -

    place holder

    diff --git a/config/routes.rb b/config/routes.rb index a8a3252365..2c5abe0efe 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,7 @@ Rails.application.routes.draw do #root 'home#index' get '/works', to: 'works#index', as: 'works' + get '/login', to: 'login#index', as: 'login' get '/works/new', to: 'works#new', as: 'new_work' post '/works', to: 'works#create' post '/works/:id/upvote', to: 'works#upvote', as: 'upvote_work' From 1c049c7427488a433549d7584866a2d6073753fe Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Fri, 13 Oct 2017 22:08:59 -0700 Subject: [PATCH 16/40] session work --- app/controllers/sessions_contoller.rb | 20 +++++++++++++++++++- app/views/{login => logins}/index.html.erb | 5 +++-- app/views/sessions/new.html.erb | 10 ++++++++++ config/routes.rb | 5 +++-- 4 files changed, 35 insertions(+), 5 deletions(-) rename app/views/{login => logins}/index.html.erb (82%) create mode 100644 app/views/sessions/new.html.erb diff --git a/app/controllers/sessions_contoller.rb b/app/controllers/sessions_contoller.rb index 3935129869..0399131897 100644 --- a/app/controllers/sessions_contoller.rb +++ b/app/controllers/sessions_contoller.rb @@ -1,5 +1,23 @@ +require 'date' + class SessionsController < ApplicationController - def login + def new + end + + def create + user = User.find_by(name: params[:name]) + + if user + session[:user_id] = user.id + redirect_to root_url, notice: "log in successful!" + else + flash.now.alert = 'Invalid email or password' + render "new " + end + end + def destory + session[:user_id] = nil + redirect_to root_url end end diff --git a/app/views/login/index.html.erb b/app/views/logins/index.html.erb similarity index 82% rename from app/views/login/index.html.erb rename to app/views/logins/index.html.erb index f528842502..6400c532ba 100644 --- a/app/views/login/index.html.erb +++ b/app/views/logins/index.html.erb @@ -23,8 +23,9 @@

    Log In

    -<% form_tag({controller: 'sessions', action: 'login'}, method: 'post') do |f| %> + +<%= form_for :sessions, url:login_session_path do |f| %> <%= f.label :name %> <%= f.text_field :name %> - <%= f.submit %> + <%= f.submit 'Log In' %> <% end %> diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb new file mode 100644 index 0000000000..bf506c66b8 --- /dev/null +++ b/app/views/sessions/new.html.erb @@ -0,0 +1,10 @@ +

    + Log In +

    + +<%= form_tag sessions_path do %> + <%= label_tag :name %> + <%= text_field_tag :name, params[:name] %> + + <%= submit_tag "Log In" %> +<% end %> diff --git a/config/routes.rb b/config/routes.rb index 2c5abe0efe..8560374d88 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,8 @@ Rails.application.routes.draw do #root 'home#index' get '/works', to: 'works#index', as: 'works' - get '/login', to: 'login#index', as: 'login' + get 'login', to: 'sessions#new', as: 'login' + get 'logout', to: 'sessions#destory', as: 'logout' get '/works/new', to: 'works#new', as: 'new_work' post '/works', to: 'works#create' post '/works/:id/upvote', to: 'works#upvote', as: 'upvote_work' @@ -11,7 +12,7 @@ delete '/works/:id', to: 'works#destroy' root 'home#index' # root 'works#index' - resources :users, :books, :movies, :albums + resources :users, :books, :movies, :albums, :sessions # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end From a7cd8072389a1c3318e8c070371509df68595c30 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Fri, 13 Oct 2017 23:29:29 -0700 Subject: [PATCH 17/40] login and out working --- app/assets/javascripts/sessions.coffee | 3 ++ app/assets/stylesheets/sessions.scss | 3 ++ app/controllers/sessions_contoller.rb | 23 ------------- app/controllers/sessions_controller.rb | 29 ++++++++++++++++ app/controllers/users_controller.rb | 23 +++++++++++++ app/helpers/application_helper.rb | 16 +++++++++ app/helpers/sessions_helper.rb | 2 ++ app/views/home/index.html.erb | 27 ++++----------- app/views/layouts/_header.html.erb | 28 +++++++++++++++ app/views/logins/index.html.erb | 23 +------------ app/views/sessions/home/index.html.erb | 14 ++++++++ app/views/sessions/new.html.erb | 9 +++-- app/views/users/index.html.erb | 25 ++------------ app/views/users/show.html.erb | 36 ++++++++++++++++++++ app/views/works/edit.html.erb | 23 +------------ app/views/works/index.html.erb | 23 +------------ app/views/works/new.html.erb | 23 +------------ app/views/works/show.html.erb | 23 +------------ config/routes.rb | 1 + test/controllers/sessions_controller_test.rb | 7 ++++ 20 files changed, 179 insertions(+), 182 deletions(-) create mode 100644 app/assets/javascripts/sessions.coffee create mode 100644 app/assets/stylesheets/sessions.scss delete mode 100644 app/controllers/sessions_contoller.rb create mode 100644 app/controllers/sessions_controller.rb create mode 100644 app/helpers/sessions_helper.rb create mode 100644 app/views/layouts/_header.html.erb create mode 100644 app/views/sessions/home/index.html.erb create mode 100644 app/views/users/show.html.erb create mode 100644 test/controllers/sessions_controller_test.rb diff --git a/app/assets/javascripts/sessions.coffee b/app/assets/javascripts/sessions.coffee new file mode 100644 index 0000000000..24f83d18bb --- /dev/null +++ b/app/assets/javascripts/sessions.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/sessions.scss b/app/assets/stylesheets/sessions.scss new file mode 100644 index 0000000000..ccb1ed25b2 --- /dev/null +++ b/app/assets/stylesheets/sessions.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Sessions controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/sessions_contoller.rb b/app/controllers/sessions_contoller.rb deleted file mode 100644 index 0399131897..0000000000 --- a/app/controllers/sessions_contoller.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'date' - -class SessionsController < ApplicationController - def new - end - - def create - user = User.find_by(name: params[:name]) - - if user - session[:user_id] = user.id - redirect_to root_url, notice: "log in successful!" - else - flash.now.alert = 'Invalid email or password' - render "new " - end - end - - def destory - session[:user_id] = nil - redirect_to root_url - end -end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb new file mode 100644 index 0000000000..4efdb69bdd --- /dev/null +++ b/app/controllers/sessions_controller.rb @@ -0,0 +1,29 @@ +require 'date' +class SessionsController < ApplicationController + def new + end + + def create + user = User.find_by(name: params[:name]) + + if user + flash[:notice] = 'Logged in as existing user' + session[:user_id] = user.id + redirect_to root_path, notice: "Successfully logged in as existing user test" + else + @new_user = User.new + @new_user.joined_on = Date.today + @new_user.name = params[:name] + @new_user.save + session[:user_id] = @new_user.id + flash[:notice] = "Successfully created new user #{@new_user.name} with ID #{@new_user.id}" + redirect_to root_path + end + end + + def destory + session[:user_id] = nil + flash[:notice] = 'Successfully logged out' + redirect_to root_path + end +end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0b399889ef..bd6806f98b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2,4 +2,27 @@ class UsersController < ApplicationController def index @users = User.all end + + def new + @user = User.new + end + + def create + @user = User.new(user_params) + + if @user.save + redirect_to root_url + else + render 'new' + end + end + + def show + @user = User.find(params[:id]) + end + + private + def user_params + params.require(:user).permit(:name, :joined_on) + end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4ce9711944..761a2df6f6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -19,4 +19,20 @@ def top_10(category) def votes_for_users(user) return Vote.where(user_id: user.id).count end + + def user_signed_in + return session[:user_id] != nil + end + + def get_user_id + return session[:user_id] + end + + def get_user_name + return User.find(session[:user_id]).name + end + + def user_cast_votes(user) + return Vote.where(user_id: user.id) + end end diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb new file mode 100644 index 0000000000..309f8b2eb3 --- /dev/null +++ b/app/helpers/sessions_helper.rb @@ -0,0 +1,2 @@ +module SessionsHelper +end diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index e6b05359d1..55418e5a6f 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,25 +1,10 @@ -
    - - - - - -
    +
    + <% flash.each do |key, value|%> +

    <%= value %>

    + <% end %> +

    diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb new file mode 100644 index 0000000000..b6bc18f80a --- /dev/null +++ b/app/views/layouts/_header.html.erb @@ -0,0 +1,28 @@ +
    + + + + +
    + <% if user_signed_in %> + <%= link_to 'Logout', logout_path %> + <%= link_to 'Logged in as '+ get_user_name, user_path(get_user_id) %> + <% else %> + <%= link_to 'Log In', login_path %> + <% end %> + +
    +
    diff --git a/app/views/logins/index.html.erb b/app/views/logins/index.html.erb index 6400c532ba..6a14935d9b 100644 --- a/app/views/logins/index.html.erb +++ b/app/views/logins/index.html.erb @@ -1,25 +1,4 @@ -
    - - - - - -
    +<%= render partial: 'layouts/header' %>

    Log In

    diff --git a/app/views/sessions/home/index.html.erb b/app/views/sessions/home/index.html.erb new file mode 100644 index 0000000000..2bb077e0e9 --- /dev/null +++ b/app/views/sessions/home/index.html.erb @@ -0,0 +1,14 @@ +

    Welcome Home

    +

    + <%= link_to "All Trips", trips_path, :id => "home" %> +

    +Some cool guy + +

    + Welcome to RideShare with Rails. As a rider you can enjoy a smooth + and traffic free ride in one of our vehicles for you and all of + your friends! As a driver you will have access to our traffic-be-gone + technology which will enable you to travel at the speed limit + regardless of the time of day! Sign up today! + +

    diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index bf506c66b8..9af44ee27c 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -1,10 +1,9 @@ -

    - Log In -

    +<%= render partial: 'layouts/header' %> +

    Log In

    <%= form_tag sessions_path do %> <%= label_tag :name %> - <%= text_field_tag :name, params[:name] %> + <%= text_field_tag :name %> - <%= submit_tag "Log In" %> + <%= submit_tag 'Log In' %> <% end %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index aa03e541ef..e777bc7972 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1,25 +1,4 @@ -
    - - - - - -
    +<%= render partial: 'layouts/header' %>

    List of Users

    @@ -32,7 +11,7 @@ <% @users.each do |user| %> - + diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb new file mode 100644 index 0000000000..e5fa64c2da --- /dev/null +++ b/app/views/users/show.html.erb @@ -0,0 +1,36 @@ +<%= render partial: 'layouts/header' %> + +

    User Summary: + <%= link_to @user.name, user_path(@user) %> +

    + +

    + Joined site <%= @user.joined_on %> +

    + +

    Votes

    + +
    <%= user.name %> <%= link_to user.name, user_path(user) %> <%= votes_for_users(user) %> <%= user.joined_on %>
    + + + + + + + + + + + <% user_cast_votes(@user).each do |vote| %> + + + + + + + + <% end %> + +
    Media Title Created By Published Category Voted On
    + +<%= link_to 'Back to Media List', root_path %> diff --git a/app/views/works/edit.html.erb b/app/views/works/edit.html.erb index 55fac93197..95bf4e166b 100644 --- a/app/views/works/edit.html.erb +++ b/app/views/works/edit.html.erb @@ -1,25 +1,4 @@ -
    - - - - - -
    +<%= render partial: 'layouts/header' %>

    Edit this

    diff --git a/app/views/works/index.html.erb b/app/views/works/index.html.erb index d2b0f3d50b..466f93b248 100644 --- a/app/views/works/index.html.erb +++ b/app/views/works/index.html.erb @@ -1,25 +1,4 @@ -
    - - - - - -
    +<%= render partial: 'layouts/header' %>

    List of works

    diff --git a/app/views/works/new.html.erb b/app/views/works/new.html.erb index bf39e46c03..6c3e1b2cdf 100644 --- a/app/views/works/new.html.erb +++ b/app/views/works/new.html.erb @@ -1,25 +1,4 @@ -
    - - - - - -
    +<%= render partial: 'layouts/header' %>

    Create new work

    diff --git a/app/views/works/show.html.erb b/app/views/works/show.html.erb index b2770aecd6..a0e8e4501a 100644 --- a/app/views/works/show.html.erb +++ b/app/views/works/show.html.erb @@ -1,25 +1,4 @@ -
    - - - - - -
    +<%= render partial: 'layouts/header' %>

    diff --git a/config/routes.rb b/config/routes.rb index 8560374d88..c8d069b730 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,6 +3,7 @@ get '/works', to: 'works#index', as: 'works' get 'login', to: 'sessions#new', as: 'login' get 'logout', to: 'sessions#destory', as: 'logout' + get 'signup', to: 'users#new', as: 'signup' get '/works/new', to: 'works#new', as: 'new_work' post '/works', to: 'works#create' post '/works/:id/upvote', to: 'works#upvote', as: 'upvote_work' diff --git a/test/controllers/sessions_controller_test.rb b/test/controllers/sessions_controller_test.rb new file mode 100644 index 0000000000..6135ce6afc --- /dev/null +++ b/test/controllers/sessions_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SessionsControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end From de3c5765940f17819b8e62b426111d2ce3c79850 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Fri, 13 Oct 2017 23:38:16 -0700 Subject: [PATCH 18/40] fixing linking back and forth between users and works --- app/helpers/application_helper.rb | 12 ++++++++++++ app/views/users/show.html.erb | 12 ++++++------ app/views/works/show.html.erb | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 761a2df6f6..243aa822af 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -35,4 +35,16 @@ def get_user_name def user_cast_votes(user) return Vote.where(user_id: user.id) end + + def get_title(id) + return Work.find(id).title + end + + def get_published(id) + return Work.find(id).published + end + + def get_creator(id) + return Work.find(id).creator + end end diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index e5fa64c2da..5d19cbc57f 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,6 +1,6 @@ <%= render partial: 'layouts/header' %> -

    User Summary: +

    User Summary: <%= link_to @user.name, user_path(@user) %>

    @@ -23,11 +23,11 @@ <% user_cast_votes(@user).each do |vote| %> - - - - - + <%= link_to get_title(vote.work_id), work_path(vote.work_id) %> + <%= get_creator(vote.work_id) %> + <%- get_published(vote.work_id) %> + <%= vote.category %> + <%= vote.date %> <% end %> diff --git a/app/views/works/show.html.erb b/app/views/works/show.html.erb index a0e8e4501a..cd9f6b8f21 100644 --- a/app/views/works/show.html.erb +++ b/app/views/works/show.html.erb @@ -33,7 +33,7 @@ <% @votes.each do |vote| %> - <%= find_user(vote.user_id)%> + <%= link_to find_user(vote.user_id), user_path(vote.user_id)%> <%= vote.date %> <% end %> From a2acae10e80b79d74d70a711a5c1fa6900764b9c Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Fri, 13 Oct 2017 23:56:56 -0700 Subject: [PATCH 19/40] adding more to the partial loader --- app/controllers/sessions_controller.rb | 2 +- app/controllers/works_controller.rb | 22 ++++++++++++++++++++++ app/views/home/index.html.erb | 6 ------ app/views/layouts/_header.html.erb | 6 ++++++ app/views/sessions/home/index.html.erb | 14 -------------- app/views/works/index.html.erb | 1 + 6 files changed, 30 insertions(+), 21 deletions(-) delete mode 100644 app/views/sessions/home/index.html.erb diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 4efdb69bdd..b640373410 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -9,7 +9,7 @@ def create if user flash[:notice] = 'Logged in as existing user' session[:user_id] = user.id - redirect_to root_path, notice: "Successfully logged in as existing user test" + redirect_to root_path, notice: "Successfully logged in as existing user #{user.name}" else @new_user = User.new @new_user.joined_on = Date.today diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb index bf2af48459..408e398d28 100644 --- a/app/controllers/works_controller.rb +++ b/app/controllers/works_controller.rb @@ -36,6 +36,28 @@ def create def upvote @work = Work.find(params[:id]) + @user_id = session[:user_id] + if session[:user_id] == nil + flash[:notice] = 'You must log in to do that' + + else + @check = Vote.where(user_id: session[:user_id], work_id: @work.id) + if @check == nil + @vote = Vote.new(category: @work.category, + work_id: @work.id, + date: Date.today, + user_id: session[:user_id]) + @vote.save + + + else + flash[:notice] = "You have already voted for this work" + + end + + redirect_to works_path + end + @vote = Vote.new(category: @work.category, work_id: @work.id, date: Date.today, diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 55418e5a6f..1dff74491f 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,11 +1,5 @@ <%= render partial: 'layouts/header' %> -
    - <% flash.each do |key, value|%> -

    <%= value %>

    - <% end %> -
    -

    Media Spotlight: <%= @top_work.title %> by <%= @top_work.creator%> diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index b6bc18f80a..88025a96f9 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -26,3 +26,9 @@ + +
    + <% flash.each do |key, value|%> +

    <%= value %>

    + <% end %> +
    diff --git a/app/views/sessions/home/index.html.erb b/app/views/sessions/home/index.html.erb deleted file mode 100644 index 2bb077e0e9..0000000000 --- a/app/views/sessions/home/index.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -

    Welcome Home

    -

    - <%= link_to "All Trips", trips_path, :id => "home" %> -

    -Some cool guy - -

    - Welcome to RideShare with Rails. As a rider you can enjoy a smooth - and traffic free ride in one of our vehicles for you and all of - your friends! As a driver you will have access to our traffic-be-gone - technology which will enable you to travel at the speed limit - regardless of the time of day! Sign up today! - -

    diff --git a/app/views/works/index.html.erb b/app/views/works/index.html.erb index 466f93b248..fbf069f180 100644 --- a/app/views/works/index.html.erb +++ b/app/views/works/index.html.erb @@ -1,5 +1,6 @@ <%= render partial: 'layouts/header' %> +<%

    List of works

    From 1b9be581412989b2c10bb3d21d9fdd9a6a05df86 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Sat, 14 Oct 2017 00:02:30 -0700 Subject: [PATCH 20/40] fixing bug with voting occuring when it shouldn't --- app/controllers/sessions_controller.rb | 3 ++- app/controllers/works_controller.rb | 12 ------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index b640373410..fd24db6dc5 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -23,7 +23,8 @@ def create def destory session[:user_id] = nil - flash[:notice] = 'Successfully logged out' + flash[:notice] = 'Successfully logged out' + flash[:info] = session[:user_id] redirect_to root_path end end diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb index 408e398d28..e691e3dc0c 100644 --- a/app/controllers/works_controller.rb +++ b/app/controllers/works_controller.rb @@ -39,7 +39,6 @@ def upvote @user_id = session[:user_id] if session[:user_id] == nil flash[:notice] = 'You must log in to do that' - else @check = Vote.where(user_id: session[:user_id], work_id: @work.id) if @check == nil @@ -49,23 +48,12 @@ def upvote user_id: session[:user_id]) @vote.save - else flash[:notice] = "You have already voted for this work" - end - - redirect_to works_path end - @vote = Vote.new(category: @work.category, - work_id: @work.id, - date: Date.today, - user_id: 1) - @vote.save - redirect_to work_path - end def update From c8ab2a744b71a0beb9271fe86d087f2a2705be35 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Sat, 14 Oct 2017 00:07:32 -0700 Subject: [PATCH 21/40] finishing up functionality before CSS begins --- app/controllers/works_controller.rb | 3 +++ app/views/works/index.html.erb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb index e691e3dc0c..df6874aee7 100644 --- a/app/controllers/works_controller.rb +++ b/app/controllers/works_controller.rb @@ -50,10 +50,13 @@ def upvote else flash[:notice] = "You have already voted for this work" + end + end redirect_to work_path + end def update diff --git a/app/views/works/index.html.erb b/app/views/works/index.html.erb index fbf069f180..33f876c8b1 100644 --- a/app/views/works/index.html.erb +++ b/app/views/works/index.html.erb @@ -1,6 +1,6 @@ <%= render partial: 'layouts/header' %> -<% +

    List of works

    From 1fd46035913358ff6a6e14102f34db83135f68b9 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Sat, 14 Oct 2017 12:48:21 -0700 Subject: [PATCH 22/40] fixing CSS for header --- app/assets/stylesheets/application.css | 68 ++++++++++++++++++++++++++ app/views/layouts/_header.html.erb | 34 ++++++------- 2 files changed, 85 insertions(+), 17 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index d05ea0f511..c800bef5f1 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -13,3 +13,71 @@ *= require_tree . *= require_self */ + + header { + background-color: #B2DfDB; + max-width: 100%; + border-bottom: 1px solid #EEEEEE; + padding: 25px 20px 10px 20px; + } + + header h2 { + margin: 25px auto 40px auto; + + } + header h2 a { + + color: #FF5722; + padding-right: 25px; + margin-right: 15px; + border-right: white 2px solid; + } + +header h2 small { + color: white; +} + +h1, h2, h3, h4{ + font-weight: bold; +} + +nav{ + width: 100%; +} + +.columns{ + float:left; +} + +.button { + background-color: #26A69A; + display: inline-block; + vertical-align: middle; + margin: 0 0 1rem 0; + padding: 0.85em 1em; + -webkit-appearance: none; + border: 1px solid transparent; + border-radius: 0; + font-size: 0.9rem; + line-height: 1; + text-align: center; + cursor: pointer; + color: #fefefe; +} + +.button-right { + background-color: #26A69A; + display: inline-block; + vertical-align: middle; + margin: 0 0 1rem 0; + padding: 0.85em 1em; + -webkit-appearance: none; + border: 1px solid transparent; + border-radius: 0; + font-size: 0.9rem; + line-height: 1; + text-align: center; + cursor: pointer; + color: #fefefe; + float: right; +} diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 88025a96f9..3ca8594e96 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -1,30 +1,30 @@
    - - -
    +
    +
    From 28681af17b00ed31d24aefa25ecbf6dcc19ac804 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Sat, 14 Oct 2017 12:54:46 -0700 Subject: [PATCH 23/40] updates for flash CSS --- app/assets/stylesheets/application.css | 16 ++++++++++++++++ app/controllers/sessions_controller.rb | 1 - app/views/layouts/_header.html.erb | 7 ++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index c800bef5f1..3defaa7d3a 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -14,6 +14,20 @@ *= require_self */ + .success{ + border-radius: 5px; + background-color: #e6e6e6; + padding: 20px 25px; + margin-top: 30px; + + } + +.success h3{ + font-weight: normal; + font-size: 1em; + color: #8a8a8a; +} + header { background-color: #B2DfDB; max-width: 100%; @@ -45,6 +59,8 @@ nav{ width: 100%; } + + .columns{ float:left; } diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index fd24db6dc5..3482c32223 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -24,7 +24,6 @@ def create def destory session[:user_id] = nil flash[:notice] = 'Successfully logged out' - flash[:info] = session[:user_id] redirect_to root_path end end diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 3ca8594e96..03b0de92e5 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -27,8 +27,9 @@ -
    + <% flash.each do |key, value|%> -

    <%= value %>

    +
    +

    <%= value %>

    +
    <% end %> -
    From fa7eaef8e8238c9ed55c70104c3df8d3ea414b4d Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Sat, 14 Oct 2017 13:24:40 -0700 Subject: [PATCH 24/40] saving css so far --- app/assets/stylesheets/application.css | 40 ++++++++++- app/views/home/index.html.erb | 94 +++++++++++++------------- 2 files changed, 87 insertions(+), 47 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 3defaa7d3a..baf9c387b6 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -14,6 +14,11 @@ *= require_self */ +body{ + font-family: 'Gudea', sans-serif; + font-size: 1.5rem; +} + .success{ border-radius: 5px; background-color: #e6e6e6; @@ -59,7 +64,26 @@ nav{ width: 100%; } +a, h3{ + color: #26a69a; +} + +main{ + max-width: 75rem; + margin-left: auto; + margin-right: auto; + padding-top: 2rem; + padding-bottom: 2rem; +} + +.spotlight{ + padding: 32px; + border-bottom: 1px solid gray; +} +.spotlight_text{ + color: black; +} .columns{ float:left; @@ -69,7 +93,7 @@ nav{ background-color: #26A69A; display: inline-block; vertical-align: middle; - margin: 0 0 1rem 0; + margin: 1px; padding: 0.85em 1em; -webkit-appearance: none; border: 1px solid transparent; @@ -79,6 +103,7 @@ nav{ text-align: center; cursor: pointer; color: #fefefe; + } .button-right { @@ -96,4 +121,17 @@ nav{ cursor: pointer; color: #fefefe; float: right; + margin: 1px; +} + +.top_10{ + width: 30%; + float: left; + padding: 15px; + +} + +.top_10 h3{ + border-bottom: 2px solid #26A69A; + } diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 1dff74491f..83186c2939 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,68 +1,70 @@ <%= render partial: 'layouts/header' %> -
    +

    - Media Spotlight: <%= @top_work.title %> by <%= @top_work.creator%> + Media Spotlight: <%= @top_work.title %> by <%= @top_work.creator%>

    <%= @top_work_votes.count %> votes - <%= @top_work.description %>

    -
    -

    - Top Albums -

    - -
      - <% top_10('album').each do |album| %> -
    • -

      - <%= link_to album.title, work_path(album) %> - by <%= album.creator %> -

      -

      - <%= votes_for_work(album) %> votes -

      -
    • - <% end %> -
    -
    +
    +
    +

    + Top Albums +

    -
    -

    Top Movies

      - <% top_10('movie').each do |movie| %> + <% top_10('album').each do |album| %>
    • - <%= link_to movie.title, work_path(movie) %> - by <%= movie.creator %> + <%= link_to album.title, work_path(album) %> + by <%= album.creator %>

      - <%= votes_for_work(movie) %> votes + <%= votes_for_work(album) %> votes

    • <% end %>
    -
    +
    +
    +

    Top Movies

    +
      + <% top_10('movie').each do |movie| %> +
    • +

      + <%= link_to movie.title, work_path(movie) %> + by <%= movie.creator %> +

      +

      + <%= votes_for_work(movie) %> votes +

      +
    • + <% end %> +
    +
    -
    -

    - Top Books -

    -
      - <% top_10('book').each do |book| %> -
    • -

      - <%= link_to book.title, work_path(book) %> - by <%= book.creator %> -

      -

      - <%= votes_for_work(book) %> votes -

      -
    • - <% end %> -
    -
    +
    +

    + Top Books +

    + +
      + <% top_10('book').each do |book| %> +
    • +

      + <%= link_to book.title, work_path(book) %> + by <%= book.creator %> +

      +

      + <%= votes_for_work(book) %> votes +

      +
    • + <% end %> +
    +
    +
    From a286e09e54402959f4294274be70f775dcbe2fbf Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Sat, 14 Oct 2017 23:13:30 -0700 Subject: [PATCH 25/40] adding css framework --- app/assets/stylesheets/application.css | 52 +- app/assets/stylesheets/foundation.scss | 682 +++++++++++++++++++++++++ app/views/home/index.html.erb | 11 +- app/views/layouts/_header.html.erb | 10 +- 4 files changed, 732 insertions(+), 23 deletions(-) create mode 100644 app/assets/stylesheets/foundation.scss diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index baf9c387b6..6f50255c0a 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -14,26 +14,25 @@ *= require_self */ + +header { + background-color: #B2DfDB; + max-width: 100%; + border-bottom: 1px solid #EEEEEE; + padding: 25px 20px 10px 20px; +} + + + body{ font-family: 'Gudea', sans-serif; font-size: 1.5rem; } - .success{ - border-radius: 5px; - background-color: #e6e6e6; - padding: 20px 25px; - margin-top: 30px; - } - -.success h3{ - font-weight: normal; - font-size: 1em; - color: #8a8a8a; -} header { + background-color: #B2DfDB; max-width: 100%; border-bottom: 1px solid #EEEEEE; @@ -41,7 +40,9 @@ body{ } header h2 { - margin: 25px auto 40px auto; + margin-left: 15%; + margin-bottom: 40px; + } header h2 a { @@ -76,11 +77,29 @@ main{ padding-bottom: 2rem; } +.success{ + border-radius: 5px; + background-color: #e6e6e6; + padding: 20px 25px; + margin-top: 30px; + +} + +.success h3{ + font-weight: normal; + font-size: 1em; + color: #8a8a8a; +} + .spotlight{ padding: 32px; border-bottom: 1px solid gray; } +.spotlight p{ + font-size: 1rem; +} + .spotlight_text{ color: black; } @@ -133,5 +152,12 @@ main{ .top_10 h3{ border-bottom: 2px solid #26A69A; +} + +.top_10 small{ + color: slategray; +} +.top_10 p{ + font-size: 1rem; } diff --git a/app/assets/stylesheets/foundation.scss b/app/assets/stylesheets/foundation.scss new file mode 100644 index 0000000000..e7fd4a889d --- /dev/null +++ b/app/assets/stylesheets/foundation.scss @@ -0,0 +1,682 @@ + +@charset "UTF-8"; /** * Foundation for Sites by ZURB * Version 6.3.1 * foundation.zurb.com * Licensed under MIT Open Source */ /*! normalize-scss | MIT/GPLv2 License | bit.ly/normalize-scss */ /* Document ========================================================================== */ /** * 1. Change the default font family in all browsers (opinionated). * 2. Correct the line height in all browsers. * 3. Prevent adjustments of font size after orientation changes in * IE on Windows Phone and in iOS. */ +html { + font-family: sans-serif; + /* 1 */ + line-height: 1.15; + /* 2 */ -ms-text-size-adjust: 100%; + /* 3 */ -webkit-text-size-adjust: 100%; + /* 3 */ + } /* Sections ========================================================================== */ /** * Remove the margin in all browsers (opinionated). */ body { margin: 0; } /** * Add the correct display in IE 9-. */ article, aside, footer, header, nav, section { display: block; } /** * Correct the font size and margin on `h1` elements within `section` and * `article` contexts in Chrome, Firefox, and Safari. */ h1 { font-size: 2em; margin: 0.67em 0; } /* Grouping content ========================================================================== */ /** * Add the correct display in IE 9-. */ + figcaption, figure { display: block; } + /** * Add the correct margin in IE 8. */ + figure { margin: 1em 40px; } + /** * 1. Add the correct box sizing in Firefox. * 2. Show the overflow in Edge and IE. */ + hr { + -webkit-box-sizing: content-box; + box-sizing: + content-box; /* 1 */ + height: 0; /* 1 */ + overflow: visible; /* 2 */ + } /** * Add the correct display in IE. */ + + main { display: block; } + /** * 1. Correct the inheritance and scaling of font size in all browsers. * 2. Correct the odd `em` font sizing in all browsers. */ + pre { + font-family: monospace, monospace; + /* 1 */ font-size: 1em; /* 2 */ + } /* Links ========================================================================== */ /** * 1. Remove the gray background on active links in IE 10. * 2. Remove gaps in links underline in iOS 8+ and Safari 8+. */ + + a { background-color: transparent; + /* 1 */ -webkit-text-decoration-skip: objects; /* 2 */ + } /** * Remove the outline on focused links when they are also active or hovered * in all browsers (opinionated). */ + + a:active, a:hover { outline-width: 0; } + + /* Text-level semantics ========================================================================== */ /** * 1. Remove the bottom border in Firefox 39-. * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. */ abbr[title] { border-bottom: none; /* 1 */ text-decoration: underline; /* 2 */ text-decoration: underline dotted; /* 2 */ } /** * Prevent the duplicate application of `bolder` by the next rule in Safari 6. */ b, strong { font-weight: inherit; } /** * Add the correct font weight in Chrome, Edge, and Safari. */ + b, strong { font-weight: bolder; } + /** * 1. Correct the inheritance and scaling of font size in all browsers. * 2. Correct the odd `em` font sizing in all browsers. */ + + code, kbd, samp { font-family: monospace, monospace; + /* 1 */ font-size: 1em; /* 2 */ + } /** * Add the correct font style in Android 4.3-. */ + + dfn { font-style: italic; } /** * Add the correct background and color in IE 9-. */ + + mark { background-color: #ff0; color: #000; } + /** * Add the correct font size in all browsers. */ + + small { font-size: 80%; } /** * Prevent `sub` and `sup` elements from affecting the line height in * all browsers. */ + + sub, sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; + } + + sub { bottom: -0.25em; } + sup { top: -0.5em; } /* Embedded content ========================================================================== */ /** * Add the correct display in IE 9-. */ + + audio, video { display: inline-block; } /** * Add the correct display in iOS 4-7. */ + + audio:not([controls]) { display: none; height: 0; } /** * Remove the border on images inside links in IE 10-. */ + + img { border-style: none; } /** * Hide the overflow in IE. */ + svg:not(:root) { overflow: hidden; } /* Forms ========================================================================== */ /** * 1. Change the font styles in all browsers (opinionated). * 2. Remove the margin in Firefox and Safari. */ + + button, input, optgroup, select, textarea { + font-family: sans-serif; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1.15; /* 1 */ + margin: 0; /* 2 */ + } /** * Show the overflow in IE. */ + + button { overflow: visible; } /** * Remove the inheritance of text transform in Edge, Firefox, and IE. * 1. Remove the inheritance of text transform in Firefox. */ + + button, select { /* 1 */ text-transform: none; } /** * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video` * controls in Android 4. * 2. Correct the inability to style clickable types in iOS and Safari. */ + + button, html [type="button"], [type="reset"], [type="submit"] { + -webkit-appearance: button; /* 2 */ + } + + button, [type="button"], [type="reset"], [type="submit"] { /** * Remove the inner border and padding in Firefox. */ /** * Restore the focus styles unset by the previous rule. */ + } + + button::-moz-focus-inner, [type="button"]::-moz-focus-inner, [type="reset"]::-moz-focus-inner, [type="submit"]::-moz-focus-inner { + border-style: none; padding: 0; + } + + button:-moz-focusring, [type="button"]:-moz-focusring, [type="reset"]:-moz-focusring, [type="submit"]:-moz-focusring { + outline: 1px dotted ButtonText; + } /** * Show the overflow in Edge. */ + + input { overflow: visible; } + /** * 1. Add the correct box sizing in IE 10-. * 2. Remove the padding in IE 10-. */ + [type="checkbox"], [type="radio"] { + -webkit-box-sizing: border-box; + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ + } /** * Correct the cursor style of increment and decrement buttons in Chrome. */ + + [type="number"]::-webkit-inner-spin-button, [type="number"]::-webkit-outer-spin-button { + height: auto; + } /** * 1. Correct the odd appearance in Chrome and Safari. * 2. Correct the outline style in Safari. */ + + [type="search"] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ /** * Remove the inner padding and cancel buttons in Chrome and Safari on macOS. */ + } + + [type="search"]::-webkit-search-cancel-button, [type="search"]::-webkit-search-decoration { + -webkit-appearance: none; + } /** * 1. Correct the inability to style clickable types in iOS and Safari. * 2. Change font properties to `inherit` in Safari. */ + + ::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ + } /** * Change the border, margin, and padding in all browsers (opinionated). */ + + fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; + } /** * 1. Correct the text wrapping in Edge and IE. * 2. Correct the color inheritance from `fieldset` elements in IE. * 3. Remove the padding so developers are not caught out when they zero out * `fieldset` elements in all browsers. */ + + legend { + -webkit-box-sizing: border-box; + box-sizing: border-box; /* 1 */ + display: table; /* 1 */ + max-width: 100%; /* 1 */ + padding: 0; /* 3 */ + color: inherit; /* 2 */ + white-space: normal; /* 1 */ + } /** * 1. Add the correct display in IE 9-. * 2. Add the correct vertical alignment in Chrome, Firefox, and Opera. */ + + progress { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ + } /** * Remove the default vertical scrollbar in IE. */ + + textarea { overflow: auto; } /* Interactive ========================================================================== */ /* * Add the correct display in Edge, IE, and Firefox. */ + + details { display: block; } /* * Add the correct display in all browsers. */ + + summary { display: list-item; } /* * Add the correct display in IE 9-. */ + + menu { display: block; } /* Scripting ========================================================================== */ /** * Add the correct display in IE 9-. */ + + canvas { display: inline-block; } /** * Add the correct display in IE. */ + + template { display: none; } /* Hidden ========================================================================== */ /** * Add the correct display in IE 10-. */ + + [hidden] { display: none; } .foundation-mq { + font-family: "small=0em&medium=40em&large=64em&xlarge=75em&xxlarge=90em"; + } + + html { + -webkit-box-sizing: border-box; box-sizing: border-box; font-size: 100%; + } + *, *::before, *::after { + -webkit-box-sizing: inherit; box-sizing: inherit; + } + + body { + margin: 0; + padding: 0; + background: #fefefe; + font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; + font-weight: normal; + line-height: 1.5; + color: #0a0a0a; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + } + + img { + display: inline-block; + vertical-align: middle; + max-width: 100%; + height: auto; + -ms-interpolation-mode: bicubic; + } + + textarea { + height: auto; + min-height: 50px; + border-radius: 0; + } + + select { + -webkit-box-sizing: border-box; + box-sizing: border-box; width: 100%; + border-radius: 0; + } + + .map_canvas img, .map_canvas embed, .map_canvas object, .mqa-display img, .mqa-display embed, .mqa-display object { + max-width: none !important; + } + + button { + padding: 0; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + border: 0; + border-radius: 0; + background: transparent; + line-height: 1; + } + + [data-whatinput='mouse'] button { + outline: 0; + } + + pre { overflow: auto; } + + .is-visible { display: block !important; } + + .is-hidden { display: none !important; } + + + .row { max-width: 75rem; margin-right: auto; margin-left: auto; } + + .row::before, .row::after { display: table; content: ' '; } + + .row::after { clear: both; } + + .row.collapse > .column, .row.collapse > .columns { padding-right: 0; padding-left: 0; } + + .row .row { margin-right: -0.625rem; margin-left: -0.625rem; } + + @media print, screen and (min-width: 40em) { + .row .row { + margin-right: -0.9375rem; + margin-left: -0.9375rem; } + } + + @media print, screen and (min-width: 64em) { + .row .row { + margin-right: -0.9375rem; + margin-left: -0.9375rem; + } + } + + .row .row.collapse { + margin-right: 0; + margin-left: 0; + } + + .row.expanded { + max-width: none; + } + + .row.expanded .row { + margin-right: auto; + margin-left: auto; + } + + .row:not(.expanded) .row { + max-width: none; + } + + .row.gutter-small > .column, .row.gutter-small > .columns { + padding-right: 0.625rem; + padding-left: 0.625rem; + } + + .row.gutter-medium > .column, .row.gutter-medium > .columns { + padding-right: 0.9375rem; + padding-left: 0.9375rem; + } + + .column, .columns { + width: 100%; float: left; + padding-right: 0.625rem; + padding-left: 0.625rem; + } + + @media print, screen and (min-width: 40em) { + .column, .columns { + padding-right: 0.9375rem; + padding-left: 0.9375rem; + } + } + + .column:last-child:not(:first-child), + + .columns:last-child:not(:first-child) { float: right; } + + .column.end:last-child:last-child, .end.columns:last-child:last-child { + float: left; + } + + .column.row.row, .row.row.columns { + float: none; + } + + .row .column.row.row, .row .row.row.columns { + margin-right: 0; + margin-left: 0; + padding-right: 0; + padding-left: 0; + } + + .small-1 { + width: 8.33333%; + } + + .small-push-1 { + position: relative; + left: 8.33333%; + } + + .small-pull-1 { + position: relative; + left: -8.33333%; + } + + .small-offset-0 { + margin-left: 0%; + } + + .small-2 { + width: 16.66667%; + } + + .small-push-2 { + position: relative; + left: 16.66667%; + } + + .small-pull-2 { + position: relative; + left: -16.66667%; + } + + .small-offset-1 { + margin-left: 8.33333%; + } + + .small-3 { + width: 25%; + } + + .small-push-3 { + position: relative; + left: 25%; + } + + .small-pull-3 { + position: relative; + left: -25%; + } + + .small-offset-2 { + margin-left: 16.66667%; + } + + .small-4 { + width: 33.33333%; + } + + .small-push-4 { + position: relative; + left: 33.33333%; + } + + .small-pull-4 { + position: relative; + left: -33.33333%; + } + + .small-offset-3 { + margin-left: 25%; + } + .small-5 { + width: 41.66667%; + } + + .small-push-5 { + position: relative; + left: 41.66667%; + } + + .small-pull-5 { + position: relative; + left: -41.66667%; + } + + .small-offset-4 { + margin-left: 33.33333%; + } + + .small-6 { width: 50%; } + + .small-push-6 { position: relative; left: 50%; } + + .small-pull-6 { position: relative; left: -50%; } + + .small-offset-5 { margin-left: 41.66667%; } + + .small-7 { width: 58.33333%; } + + .small-push-7 { position: relative; left: 58.33333%; } + + .small-pull-7 { position: relative; left: -58.33333%; } + + .small-offset-6 { margin-left: 50%; } + + .small-8 { width: 66.66667%; } + + .small-push-8 { position: relative; left: 66.66667%; } + + .small-pull-8 { position: relative; left: -66.66667%; } + + .small-offset-7 { margin-left: 58.33333%; } + + .small-9 { width: 75%; } + + .small-push-9 { position: relative; left: 75%; } + + .small-pull-9 { position: relative; left: -75%; } + + .small-offset-8 { margin-left: 66.66667%; } + + .small-10 { width: 83.33333%; } + + .small-push-10 { position: relative; left: 83.33333%; } + + .small-pull-10 { position: relative; left: -83.33333%; } + + .small-offset-9 { margin-left: 75%; } + + .small-11 { width: 91.66667%; } + + .small-push-11 { position: relative; left: 91.66667%; } + + .small-pull-11 { position: relative; left: -91.66667%; } + + .small-offset-10 { margin-left: 83.33333%; } + + .small-12 { width: 100%; } + + .small-offset-11 { margin-left: 91.66667%; } + + .small-up-1 > .column, .small-up-1 > .columns { + float: left; width: 100%; + } + + .small-up-1 > .column:nth-of-type(1n), .small-up-1 > .columns:nth-of-type(1n) { + clear: none; + } + + .small-up-1 > .column:nth-of-type(1n+1), .small-up-1 > .columns:nth-of-type(1n+1) { + clear: both; + } + + .small-up-1 > + .column:last-child, .small-up-1 > .columns:last-child { float: left; } + .small-up-2 > .column, .small-up-2 > .columns { float: left; width: 50%; } + .small-up-2 > .column:nth-of-type(1n), .small-up-2 > .columns:nth-of-type(1n) { + clear: none; + } + + .small-up-2 > .column:nth-of-type(2n+1), .small-up-2 > .columns:nth-of-type(2n+1) { + clear: both; + } + + .small-up-2 > .column:last-child, .small-up-2 > .columns:last-child { float: left; } + + .small-up-3 > .column, .small-up-3 > .columns { float: left; width: 33.33333%; } + + .small-up-3 > .column:nth-of-type(1n), .small-up-3 > .columns:nth-of-type(1n) { + clear: none; + } + + .small-up-3 > .column:nth-of-type(3n+1), .small-up-3 > .columns:nth-of-type(3n+1) { + clear: both; + } + + .small-up-3 > .column:last-child, .small-up-3 > .columns:last-child { float: left; } + + .small-up-4 > .column, .small-up-4 > .columns { float: left; width: 25%; } + .small-up-4 > .column:nth-of-type(1n), .small-up-4 > .columns:nth-of-type(1n) { + clear: none; + } + .small-up-4 > .column:nth-of-type(4n+1), .small-up-4 > .columns:nth-of-type(4n+1) { + clear: both; + } + + .small-up-4 > .column:last-child, .small-up-4 > .columns:last-child { float: left; } + + .small-up-5 > .column, .small-up-5 > .columns { float: left; width: 20%; } + .small-up-5 > .column:nth-of-type(1n), .small-up-5 > .columns:nth-of-type(1n) { + clear: none; + } + + .small-up-5 > .column:nth-of-type(5n+1), .small-up-5 > .columns:nth-of-type(5n+1) { + clear: both; + } + + .small-up-5 > .column:last-child, .small-up-5 > .columns:last-child { float: left; } + + .small-up-6 > .column, .small-up-6 > .columns { float: left; width: 16.66667%; } + + .small-up-6 > .column:nth-of-type(1n), .small-up-6 > .columns:nth-of-type(1n) { + clear: none; + } + + .small-up-6 > .column:nth-of-type(6n+1), .small-up-6 > .columns:nth-of-type(6n+1) { + clear: both; + } + + .small-up-6 > .column:last-child, .small-up-6 > .columns:last-child { float: left; } + + .small-up-7 > .column, .small-up-7 > .columns { float: left; width: 14.28571%; } + + .small-up-7 > .column:nth-of-type(1n), .small-up-7 > .columns:nth-of-type(1n) { + clear: none; + } + + .small-up-7 > .column:nth-of-type(7n+1), .small-up-7 > .columns:nth-of-type(7n+1) { + clear: both; + } + + .small-up-7 > .column:last-child, .small-up-7 > .columns:last-child { float: left; } + + .small-up-8 > .column, .small-up-8 > .columns { float: left; width: 12.5%; } + + .small-up-8 > .column:nth-of-type(1n), .small-up-8 > .columns:nth-of-type(1n) { + clear: none; + } + + .small-up-8 > .column:nth-of-type(8n+1), .small-up-8 > .columns:nth-of-type(8n+1) { clear: both; } + + .small-up-8 > .column:last-child, .small-up-8 > .columns:last-child { float: left; } + + .small-collapse > .column, .small-collapse > .columns { padding-right: 0; padding-left: 0; } + + .small-collapse .row { margin-right: 0; margin-left: 0; } + + .expanded.row .small-collapse.row { margin-right: 0; margin-left: 0; } + + .small-uncollapse > .column, .small-uncollapse > .columns { padding-right: 0.625rem; padding-left: 0.625rem; } + + .small-centered { margin-right: auto; margin-left: auto; } + + .small-centered, .small-centered:last-child:not(:first-child) { float: none; clear: both; } + + .small-uncentered, .small-push-0, .small-pull-0 { position: static; float: left; margin-right: 0; margin-left: 0; } + + @media print, screen and (min-width: 40em) { + .medium-1 { + width: 8.33333%; + } + .medium-push-1 { + position: relative; + left: 8.33333%; + } + .medium-pull-1 { position: relative; left: -8.33333%; } + .medium-offset-0 { margin-left: 0%; } .medium-2 { width: 16.66667%; } + .medium-push-2 { position: relative; left: 16.66667%; } + .medium-pull-2 { position: relative; left: -16.66667%; } + .medium-offset-1 { margin-left: 8.33333%; } + .medium-3 { width: 25%; } + .medium-push-3 { position: relative; left: 25%; } + .medium-pull-3 { position: relative; left: -25%; } + .medium-offset-2 { margin-left: 16.66667%; } + .medium-4 { width: 33.33333%; } + .medium-push-4 { position: relative; left: 33.33333%; } + .medium-pull-4 { position: relative; left: -33.33333%; } + .medium-offset-3 { margin-left: 25%; } + .medium-5 { width: 41.66667%; } + .medium-push-5 { position: relative; left: 41.66667%; } + .medium-pull-5 { position: relative; left: -41.66667%; } + .medium-offset-4 { margin-left: 33.33333%; } + .medium-6 { width: 50%; } + .medium-push-6 { position: relative; left: 50%; } + .medium-pull-6 { position: relative; left: -50%; } + .medium-offset-5 { margin-left: 41.66667%; } + .medium-7 { width: 58.33333%; } + .medium-push-7 { position: relative; left: 58.33333%; } + .medium-pull-7 { position: relative; left: -58.33333%; } + .medium-offset-6 { margin-left: 50%; } + .medium-8 { width: 66.66667%; } + .medium-push-8 { position: relative; left: 66.66667%; } + .medium-pull-8 { position: relative; left: -66.66667%; } + .medium-offset-7 { margin-left: 58.33333%; } + .medium-9 { width: 75%; } + .medium-push-9 { position: relative; left: 75%; } + .medium-pull-9 { position: relative; left: -75%; } + .medium-offset-8 { margin-left: 66.66667%; } + .medium-10 { width: 83.33333%; } + .medium-push-10 { position: relative; left: 83.33333%; } + .medium-pull-10 { position: relative; left: -83.33333%; } + .medium-offset-9 { margin-left: 75%; } + .medium-11 { width: 91.66667%; } + .medium-push-11 { position: relative; left: 91.66667%; } + .medium-pull-11 { position: relative; left: -91.66667%; } + .medium-offset-10 { margin-left: 83.33333%; } + .medium-12 { width: 100%; } + .medium-offset-11 { margin-left: 91.66667%; } + .medium-up-1 > .column, .medium-up-1 > .columns { float: left; width: 100%; } + .medium-up-1 > .column:nth-of-type(1n), .medium-up-1 > .columns:nth-of-type(1n) { clear: none; } + .medium-up-1 > .column:nth-of-type(1n+1), .medium-up-1 > .columns:nth-of-type(1n+1) { clear: both; } + .medium-up-1 > .column:last-child, .medium-up-1 > .columns:last-child { float: left; } + .medium-up-2 > .column, .medium-up-2 > .columns { float: left; width: 50%; } + .medium-up-2 > .column:nth-of-type(1n), .medium-up-2 > .columns:nth-of-type(1n) { clear: none; } + .medium-up-2 > .column:nth-of-type(2n+1), .medium-up-2 > .columns:nth-of-type(2n+1) { clear: both; } + .medium-up-2 > .column:last-child, .medium-up-2 > .columns:last-child { float: left; } + .medium-up-3 > .column, .medium-up-3 > .columns { float: left; width: 33.33333%; } + .medium-up-3 > .column:nth-of-type(1n), .medium-up-3 > .columns:nth-of-type(1n) { clear: none; } + .medium-up-3 > .column:nth-of-type(3n+1), .medium-up-3 > .columns:nth-of-type(3n+1) { clear: both; } + .medium-up-3 > .column:last-child, .medium-up-3 > .columns:last-child { float: left; } + .medium-up-4 > .column, .medium-up-4 > .columns { float: left; width: 25%; } + .medium-up-4 > .column:nth-of-type(1n), .medium-up-4 > .columns:nth-of-type(1n) { clear: none; } + .medium-up-4 > .column:nth-of-type(4n+1), .medium-up-4 > .columns:nth-of-type(4n+1) { clear: both; } + .medium-up-4 > .column:last-child, .medium-up-4 > .columns:last-child { float: left; } + .medium-up-5 > .column, .medium-up-5 > .columns { float: left; width: 20%; } + .medium-up-5 > .column:nth-of-type(1n), .medium-up-5 > .columns:nth-of-type(1n) { clear: none; } + .medium-up-5 > .column:nth-of-type(5n+1), .medium-up-5 > .columns:nth-of-type(5n+1) { clear: both; } + .medium-up-5 > .column:last-child, .medium-up-5 > .columns:last-child { float: left; } + .medium-up-6 > .column, .medium-up-6 > .columns { float: left; width: 16.66667%; } + .medium-up-6 > .column:nth-of-type(1n), .medium-up-6 > .columns:nth-of-type(1n) { clear: none; } + .medium-up-6 > .column:nth-of-type(6n+1), .medium-up-6 > .columns:nth-of-type(6n+1) { clear: both; } + .medium-up-6 > .column:last-child, .medium-up-6 > .columns:last-child { float: left; } + .medium-up-7 > .column, .medium-up-7 > .columns { float: left; width: 14.28571%; } + .medium-up-7 > .column:nth-of-type(1n), .medium-up-7 > .columns:nth-of-type(1n) { clear: none; } + .medium-up-7 > .column:nth-of-type(7n+1), .medium-up-7 > .columns:nth-of-type(7n+1) { clear: both; } + .medium-up-7 > .column:last-child, .medium-up-7 > .columns:last-child { float: left; } + .medium-up-8 > .column, .medium-up-8 > .columns { float: left; width: 12.5%; } + .medium-up-8 > .column:nth-of-type(1n), .medium-up-8 > .columns:nth-of-type(1n) { clear: none; } + .medium-up-8 > .column:nth-of-type(8n+1), .medium-up-8 > .columns:nth-of-type(8n+1) { clear: both; } + .medium-up-8 > .column:last-child, .medium-up-8 > .columns:last-child { float: left; } + .medium-collapse > .column, .medium-collapse > .columns { padding-right: 0; padding-left: 0; } + .medium-collapse .row { margin-right: 0; margin-left: 0; } + .expanded.row .medium-collapse.row { margin-right: 0; margin-left: 0; } + .medium-uncollapse > .column, .medium-uncollapse > .columns { padding-right: 0.9375rem; padding-left: 0.9375rem; } + .medium-centered { margin-right: auto; margin-left: auto; } + .medium-centered, .medium-centered:last-child:not(:first-child) { float: none; clear: both; } + .medium-uncentered, .medium-push-0, .medium-pull-0 { + position: static; + float: left; + margin-right: 0; + margin-left: 0; + } + } + + @media print, screen and (min-width: 64em) { + .large-1 { width: 8.33333%; } + .large-push-1 { position: relative; left: 8.33333%; } + .large-pull-1 { position: relative; left: -8.33333%; } + .large-offset-0 { margin-left: 0%; } .large-2 { width: 16.66667%; } + .large-push-2 { position: relative; left: 16.66667%; } + .large-pull-2 { position: relative; left: -16.66667%; } + .large-offset-1 { margin-left: 8.33333%; } + .large-3 { width: 25%; } + .large-push-3 { position: relative; left: 25%; } + .large-pull-3 { position: relative; left: -25%; } + .large-offset-2 { margin-left: 16.66667%; } + .large-4 { width: 33.33333%; } + .large-push-4 { position: relative; left: 33.33333%; } + .large-pull-4 { position: relative; left: -33.33333%; } + .large-offset-3 { margin-left: 25%; } + .large-5 { width: 41.66667%; } + .large-push-5 { position: relative; left: 41.66667%; } + .large-pull-5 { position: relative; left: -41.66667%; } + .large-offset-4 { margin-left: 33.33333%; } + .large-6 { width: 50%; } + .large-push-6 { position: relative; left: 50%; } + .large-pull-6 { position: relative; left: -50%; } + .large-offset-5 { margin-left: 41.66667%; } + .large-7 { width: 58.33333%; } + .large-push-7 { position: relative; left: 58.33333%; } + .large-pull-7 { position: relative; left: -58.33333%; } + .large-offset-6 { margin-left: 50%; } + .large-8 { width: 66.66667%; } + .large-push-8 { position: relative; left: 66.66667%; } + .large-pull-8 { position: relative; left: -66.66667%; } + .large-offset-7 { margin-left: 58.33333%; } + .large-9 { width: 75%; } + .large-push-9 { position: relative; left: 75%; } .large-pull-9 { position: relative; left: -75%; } .large-offset-8 { margin-left: 66.66667%; } .large-10 { width: 83.33333%; } .large-push-10 { position: relative; left: 83.33333%; } .large-pull-10 { position: relative; left: -83.33333%; } .large-offset-9 { margin-left: 75%; } .large-11 { width: 91.66667%; } .large-push-11 { position: relative; left: 91.66667%; } .large-pull-11 { position: relative; left: -91.66667%; } .large-offset-10 { margin-left: 83.33333%; } .large-12 { width: 100%; } .large-offset-11 { margin-left: 91.66667%; } .large-up-1 > .column, .large-up-1 > .columns { float: left; width: 100%; } .large-up-1 > .column:nth-of-type(1n), .large-up-1 > .columns:nth-of-type(1n) { clear: none; } .large-up-1 > .column:nth-of-type(1n+1), .large-up-1 > .columns:nth-of-type(1n+1) { clear: both; } .large-up-1 > .column:last-child, .large-up-1 > .columns:last-child { float: left; } .large-up-2 > .column, .large-up-2 > .columns { float: left; width: 50%; } .large-up-2 > .column:nth-of-type(1n), .large-up-2 > .columns:nth-of-type(1n) { clear: none; } .large-up-2 > .column:nth-of-type(2n+1), .large-up-2 > .columns:nth-of-type(2n+1) { clear: both; } .large-up-2 > .column:last-child, .large-up-2 > .columns:last-child { float: left; } .large-up-3 > .column, .large-up-3 > .columns { float: left; width: 33.33333%; } .large-up-3 > .column:nth-of-type(1n), .large-up-3 > .columns:nth-of-type(1n) { clear: none; } .large-up-3 > .column:nth-of-type(3n+1), .large-up-3 > .columns:nth-of-type(3n+1) { clear: both; } .large-up-3 > .column:last-child, .large-up-3 > .columns:last-child { float: left; } .large-up-4 > .column, .large-up-4 > .columns { float: left; width: 25%; } .large-up-4 > .column:nth-of-type(1n), .large-up-4 > .columns:nth-of-type(1n) { clear: none; } .large-up-4 > .column:nth-of-type(4n+1), .large-up-4 > .columns:nth-of-type(4n+1) { clear: both; } .large-up-4 > .column:last-child, .large-up-4 > .columns:last-child { float: left; } .large-up-5 > .column, .large-up-5 > .columns { float: left; width: 20%; } .large-up-5 > .column:nth-of-type(1n), .large-up-5 > .columns:nth-of-type(1n) { clear: none; } .large-up-5 > .column:nth-of-type(5n+1), .large-up-5 > .columns:nth-of-type(5n+1) { clear: both; } .large-up-5 > .column:last-child, .large-up-5 > .columns:last-child { float: left; } .large-up-6 > .column, .large-up-6 > .columns { float: left; width: 16.66667%; } .large-up-6 > .column:nth-of-type(1n), .large-up-6 > .columns:nth-of-type(1n) { clear: none; } .large-up-6 > .column:nth-of-type(6n+1), .large-up-6 > .columns:nth-of-type(6n+1) { clear: both; } .large-up-6 > .column:last-child, .large-up-6 > .columns:last-child { float: left; } .large-up-7 > .column, .large-up-7 > .columns { float: left; width: 14.28571%; } .large-up-7 > .column:nth-of-type(1n), .large-up-7 > .columns:nth-of-type(1n) { clear: none; } .large-up-7 > .column:nth-of-type(7n+1), .large-up-7 > .columns:nth-of-type(7n+1) { clear: both; } .large-up-7 > .column:last-child, .large-up-7 > .columns:last-child { float: left; } .large-up-8 > .column, .large-up-8 > .columns { float: left; width: 12.5%; } .large-up-8 > .column:nth-of-type(1n), .large-up-8 > .columns:nth-of-type(1n) { clear: none; } .large-up-8 > .column:nth-of-type(8n+1), .large-up-8 > .columns:nth-of-type(8n+1) { clear: both; } .large-up-8 > .column:last-child, .large-up-8 > .columns:last-child { float: left; } .large-collapse > .column, .large-collapse > .columns { padding-right: 0; padding-left: 0; } .large-collapse .row { margin-right: 0; margin-left: 0; } .expanded.row .large-collapse.row { margin-right: 0; margin-left: 0; } .large-uncollapse > .column, .large-uncollapse > .columns { padding-right: 0.9375rem; padding-left: 0.9375rem; } .large-centered { margin-right: auto; margin-left: auto; } .large-centered, .large-centered:last-child:not(:first-child) { float: none; clear: both; } .large-uncentered, .large-push-0, .large-pull-0 { position: static; float: left; margin-right: 0; margin-left: 0; } } .column-block { margin-bottom: 1.25rem; } .column-block > :last-child { margin-bottom: 0; } @media print, screen and (min-width: 40em) { .column-block { margin-bottom: 1.875rem; } .column-block > :last-child { margin-bottom: 0; } } div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, p, blockquote, th, td { margin: 0; padding: 0; } p { margin-bottom: 1rem; font-size: inherit; line-height: 1.6; text-rendering: optimizeLegibility; } em, i { font-style: italic; line-height: inherit; } strong, b { font-weight: bold; line-height: inherit; } small { font-size: 80%; line-height: inherit; } h1, h2, h3, h4, h5, h6 { font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; font-style: normal; font-weight: normal; color: inherit; text-rendering: optimizeLegibility; } h1 small, h2 small, h3 small, h4 small, h5 small, h6 small { line-height: 0; color: #cacaca; } h1 { font-size: 1.5rem; line-height: 1.4; margin-top: 0; margin-bottom: 0.5rem; } h2 { font-size: 1.25rem; line-height: 1.4; margin-top: 0; margin-bottom: 0.5rem; } h3 { font-size: 1.1875rem; line-height: 1.4; margin-top: 0; margin-bottom: 0.5rem; } h4 { font-size: 1.125rem; line-height: 1.4; margin-top: 0; margin-bottom: 0.5rem; } h5 { font-size: 1.0625rem; line-height: 1.4; margin-top: 0; margin-bottom: 0.5rem; } h6 { font-size: 1rem; line-height: 1.4; margin-top: 0; margin-bottom: 0.5rem; } @media print, screen and (min-width: 40em) { h1 { font-size: 3rem; } h2 { font-size: 2.5rem; } h3 { font-size: 1.9375rem; } h4 { font-size: 1.5625rem; } h5 { font-size: 1.25rem; } h6 { font-size: 1rem; } } a { line-height: inherit; color: #1779ba; text-decoration: none; cursor: pointer; } a:hover, a:focus { color: #1468a0; } a img { border: 0; } hr { clear: both; max-width: 75rem; height: 0; margin: 1.25rem auto; border-top: 0; border-right: 0; border-bottom: 1px solid #cacaca; border-left: 0; } ul, ol, dl { margin-bottom: 1rem; list-style-position: outside; line-height: 1.6; } li { font-size: inherit; } ul { margin-left: 1.25rem; list-style-type: disc; } ol { margin-left: 1.25rem; } ul ul, ol ul, ul ol, ol ol { margin-left: 1.25rem; margin-bottom: 0; } dl { margin-bottom: 1rem; } dl dt { margin-bottom: 0.3rem; font-weight: bold; } blockquote { margin: 0 0 1rem; padding: 0.5625rem 1.25rem 0 1.1875rem; border-left: 1px solid #cacaca; } blockquote, blockquote p { line-height: 1.6; color: #8a8a8a; } cite { display: block; font-size: 0.8125rem; color: #8a8a8a; } cite:before { content: "— "; } abbr { border-bottom: 1px dotted #0a0a0a; color: #0a0a0a; cursor: help; } figure { margin: 0; } code { padding: 0.125rem 0.3125rem 0.0625rem; border: 1px solid #cacaca; background-color: #e6e6e6; font-family: Consolas, "Liberation Mono", Courier, monospace; font-weight: normal; color: #0a0a0a; } kbd { margin: 0; padding: 0.125rem 0.25rem 0; background-color: #e6e6e6; font-family: Consolas, "Liberation Mono", Courier, monospace; color: #0a0a0a; } .subheader { margin-top: 0.2rem; margin-bottom: 0.5rem; font-weight: normal; line-height: 1.4; color: #8a8a8a; } .lead { font-size: 125%; line-height: 1.6; } .stat { font-size: 2.5rem; line-height: 1; } p + .stat { margin-top: -1rem; } .no-bullet { margin-left: 0; list-style: none; } .text-left { text-align: left; } .text-right { text-align: right; } .text-center { text-align: center; } .text-justify { text-align: justify; } @media print, screen and (min-width: 40em) { .medium-text-left { text-align: left; } .medium-text-right { text-align: right; } .medium-text-center { text-align: center; } .medium-text-justify { text-align: justify; } } @media print, screen and (min-width: 64em) { .large-text-left { text-align: left; } .large-text-right { text-align: right; } .large-text-center { text-align: center; } .large-text-justify { text-align: justify; } } .show-for-print { display: none !important; } @media print { * { background: transparent !important; -webkit-box-shadow: none !important; box-shadow: none !important; color: black !important; text-shadow: none !important; } .show-for-print { display: block !important; } .hide-for-print { display: none !important; } table.show-for-print { display: table !important; } thead.show-for-print { display: table-header-group !important; } tbody.show-for-print { display: table-row-group !important; } tr.show-for-print { display: table-row !important; } td.show-for-print { display: table-cell !important; } th.show-for-print { display: table-cell !important; } a, a:visited { text-decoration: underline; } a[href]:after { content: " (" attr(href) ")"; } .ir a:after, a[href^='javascript:']:after, a[href^='#']:after { content: ''; } abbr[title]:after { content: " (" attr(title) ")"; } pre, blockquote { border: 1px solid #8a8a8a; page-break-inside: avoid; } thead { display: table-header-group; } tr, img { page-break-inside: avoid; } img { max-width: 100% !important; } @page { margin: 0.5cm; } p, h2, h3 { orphans: 3; widows: 3; } h2, h3 { page-break-after: avoid; } } [type='text'], [type='password'], [type='date'], [type='datetime'], [type='datetime-local'], [type='month'], [type='week'], [type='email'], [type='number'], [type='search'], [type='tel'], [type='time'], [type='url'], [type='color'], textarea { display: block; -webkit-box-sizing: border-box; box-sizing: border-box; width: 100%; height: 2.4375rem; margin: 0 0 1rem; padding: 0.5rem; border: 1px solid #cacaca; border-radius: 0; background-color: #fefefe; -webkit-box-shadow: inset 0 1px 2px rgba(10, 10, 10, 0.1); box-shadow: inset 0 1px 2px rgba(10, 10, 10, 0.1); font-family: inherit; font-size: 1rem; font-weight: normal; color: #0a0a0a; -webkit-transition: border-color 0.25s ease-in-out, -webkit-box-shadow 0.5s; transition: border-color 0.25s ease-in-out, -webkit-box-shadow 0.5s; transition: box-shadow 0.5s, border-color 0.25s ease-in-out; transition: box-shadow 0.5s, border-color 0.25s ease-in-out, -webkit-box-shadow 0.5s; -webkit-appearance: none; -moz-appearance: none; appearance: none; } [type='text']:focus, [type='password']:focus, [type='date']:focus, [type='datetime']:focus, [type='datetime-local']:focus, [type='month']:focus, [type='week']:focus, [type='email']:focus, [type='number']:focus, [type='search']:focus, [type='tel']:focus, [type='time']:focus, [type='url']:focus, [type='color']:focus, textarea:focus { outline: none; border: 1px solid #8a8a8a; background-color: #fefefe; -webkit-box-shadow: 0 0 5px #cacaca; box-shadow: 0 0 5px #cacaca; -webkit-transition: border-color 0.25s ease-in-out, -webkit-box-shadow 0.5s; transition: border-color 0.25s ease-in-out, -webkit-box-shadow 0.5s; transition: box-shadow 0.5s, border-color 0.25s ease-in-out; transition: box-shadow 0.5s, border-color 0.25s ease-in-out, -webkit-box-shadow 0.5s; } textarea { max-width: 100%; } textarea[rows] { height: auto; } input::-webkit-input-placeholder, textarea::-webkit-input-placeholder { color: #cacaca; } input::-moz-placeholder, textarea::-moz-placeholder { color: #cacaca; } input:-ms-input-placeholder, textarea:-ms-input-placeholder { color: #cacaca; } input::placeholder, textarea::placeholder { color: #cacaca; } input:disabled, input[readonly], textarea:disabled, textarea[readonly] { background-color: #e6e6e6; cursor: not-allowed; } [type='submit'], [type='button'] { -webkit-appearance: none; -moz-appearance: none; appearance: none; border-radius: 0; } input[type='search'] { -webkit-box-sizing: border-box; box-sizing: border-box; } [type='file'], [type='checkbox'], [type='radio'] { margin: 0 0 1rem; } [type='checkbox'] + label, [type='radio'] + label { display: inline-block; vertical-align: baseline; margin-left: 0.5rem; margin-right: 1rem; margin-bottom: 0; } [type='checkbox'] + label[for], [type='radio'] + label[for] { cursor: pointer; } label > [type='checkbox'], label > [type='radio'] { margin-right: 0.5rem; } [type='file'] { width: 100%; } label { display: block; margin: 0; font-size: 0.875rem; font-weight: normal; line-height: 1.8; color: #0a0a0a; } label.middle { margin: 0 0 1rem; padding: 0.5625rem 0; } .help-text { margin-top: -0.5rem; font-size: 0.8125rem; font-style: italic; color: #0a0a0a; } .input-group { display: table; width: 100%; margin-bottom: 1rem; } .input-group > :first-child { border-radius: 0 0 0 0; } .input-group > :last-child > * { border-radius: 0 0 0 0; } .input-group-label, .input-group-field, .input-group-button, .input-group-button a, .input-group-button input, .input-group-button button, .input-group-button label { margin: 0; white-space: nowrap; display: table-cell; vertical-align: middle; } .input-group-label { padding: 0 1rem; border: 1px solid #cacaca; background: #e6e6e6; color: #0a0a0a; text-align: center; white-space: nowrap; width: 1%; height: 100%; } .input-group-label:first-child { border-right: 0; } .input-group-label:last-child { border-left: 0; } .input-group-field { border-radius: 0; height: 2.5rem; } .input-group-button { padding-top: 0; padding-bottom: 0; text-align: center; width: 1%; height: 100%; } .input-group-button a, .input-group-button input, .input-group-button button, .input-group-button label { height: 2.5rem; padding-top: 0; padding-bottom: 0; font-size: 1rem; } .input-group .input-group-button { display: table-cell; } fieldset { margin: 0; padding: 0; border: 0; } legend { max-width: 100%; margin-bottom: 0.5rem; } .fieldset { margin: 1.125rem 0; padding: 1.25rem; border: 1px solid #cacaca; } .fieldset legend { margin: 0; margin-left: -0.1875rem; padding: 0 0.1875rem; background: #fefefe; } select { height: 2.4375rem; margin: 0 0 1rem; padding: 0.5rem; -webkit-appearance: none; -moz-appearance: none; appearance: none; border: 1px solid #cacaca; border-radius: 0; background-color: #fefefe; font-family: inherit; font-size: 1rem; line-height: normal; color: #0a0a0a; background-image: url("data:image/svg+xml;utf8,"); -webkit-background-origin: content-box; background-origin: content-box; background-position: right -1rem center; background-repeat: no-repeat; -webkit-background-size: 9px 6px; background-size: 9px 6px; padding-right: 1.5rem; -webkit-transition: border-color 0.25s ease-in-out, -webkit-box-shadow 0.5s; transition: border-color 0.25s ease-in-out, -webkit-box-shadow 0.5s; transition: box-shadow 0.5s, border-color 0.25s ease-in-out; transition: box-shadow 0.5s, border-color 0.25s ease-in-out, -webkit-box-shadow 0.5s; } @media screen and (min-width: 0\0) { select { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAYCAYAAACbU/80AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIpJREFUeNrEkckNgDAMBBfRkEt0ObRBBdsGXUDgmQfK4XhH2m8czQAAy27R3tsw4Qfe2x8uOO6oYLb6GlOor3GF+swURAOmUJ+RwtEJs9WvTGEYxBXqI1MQAZhCfUQKRzDMVj+TwrAIV6jvSUEkYAr1LSkcyTBb/V+KYfX7xAeusq3sLDtGH3kEGACPWIflNZfhRQAAAABJRU5ErkJggg=="); } } select:focus { outline: none; border: 1px solid #8a8a8a; background-color: #fefefe; -webkit-box-shadow: 0 0 5px #cacaca; box-shadow: 0 0 5px #cacaca; -webkit-transition: border-color 0.25s ease-in-out, -webkit-box-shadow 0.5s; transition: border-color 0.25s ease-in-out, -webkit-box-shadow 0.5s; transition: box-shadow 0.5s, border-color 0.25s ease-in-out; transition: box-shadow 0.5s, border-color 0.25s ease-in-out, -webkit-box-shadow 0.5s; } select:disabled { background-color: #e6e6e6; cursor: not-allowed; } select::-ms-expand { display: none; } select[multiple] { height: auto; background-image: none; } .is-invalid-input:not(:focus) { border-color: #cc4b37; background-color: #f9ecea; } .is-invalid-input:not(:focus)::-webkit-input-placeholder { color: #cc4b37; } .is-invalid-input:not(:focus)::-moz-placeholder { color: #cc4b37; } .is-invalid-input:not(:focus):-ms-input-placeholder { color: #cc4b37; } .is-invalid-input:not(:focus)::placeholder { color: #cc4b37; } .is-invalid-label { color: #cc4b37; } .form-error { display: none; margin-top: -0.5rem; margin-bottom: 1rem; font-size: 0.75rem; font-weight: bold; color: #cc4b37; } .form-error.is-visible { display: block; } .button { display: inline-block; vertical-align: middle; margin: 0 0 1rem 0; padding: 0.85em 1em; -webkit-appearance: none; border: 1px solid transparent; border-radius: 0; -webkit-transition: background-color 0.25s ease-out, color 0.25s ease-out; transition: background-color 0.25s ease-out, color 0.25s ease-out; font-size: 0.9rem; line-height: 1; text-align: center; cursor: pointer; background-color: #1779ba; color: #fefefe; } [data-whatinput='mouse'] .button { outline: 0; } .button:hover, .button:focus { background-color: #14679e; color: #fefefe; } .button.tiny { font-size: 0.6rem; } .button.small { font-size: 0.75rem; } .button.large { font-size: 1.25rem; } .button.expanded { display: block; width: 100%; margin-right: 0; margin-left: 0; } .button.primary { background-color: #1779ba; color: #fefefe; } .button.primary:hover, .button.primary:focus { background-color: #126195; color: #fefefe; } .button.secondary { background-color: #767676; color: #fefefe; } .button.secondary:hover, .button.secondary:focus { background-color: #5e5e5e; color: #fefefe; } .button.success { background-color: #3adb76; color: #0a0a0a; } .button.success:hover, .button.success:focus { background-color: #22bb5b; color: #0a0a0a; } .button.warning { background-color: #ffae00; color: #0a0a0a; } .button.warning:hover, .button.warning:focus { background-color: #cc8b00; color: #0a0a0a; } .button.alert { background-color: #cc4b37; color: #fefefe; } .button.alert:hover, .button.alert:focus { background-color: #a53b2a; color: #fefefe; } .button.hollow { border: 1px solid #1779ba; color: #1779ba; } .button.hollow, .button.hollow:hover, .button.hollow:focus { background-color: transparent; } .button.hollow:hover, .button.hollow:focus { border-color: #0c3d5d; color: #0c3d5d; } .button.hollow.primary { border: 1px solid #1779ba; color: #1779ba; } .button.hollow.primary:hover, .button.hollow.primary:focus { border-color: #0c3d5d; color: #0c3d5d; } .button.hollow.secondary { border: 1px solid #767676; color: #767676; } .button.hollow.secondary:hover, .button.hollow.secondary:focus { border-color: #3b3b3b; color: #3b3b3b; } .button.hollow.success { border: 1px solid #3adb76; color: #3adb76; } .button.hollow.success:hover, .button.hollow.success:focus { border-color: #157539; color: #157539; } .button.hollow.warning { border: 1px solid #ffae00; color: #ffae00; } .button.hollow.warning:hover, .button.hollow.warning:focus { border-color: #805700; color: #805700; } .button.hollow.alert { border: 1px solid #cc4b37; color: #cc4b37; } .button.hollow.alert:hover, .button.hollow.alert:focus { border-color: #67251a; color: #67251a; } .button.disabled, .button[disabled] { opacity: 0.25; cursor: not-allowed; } .button.disabled, .button.disabled:hover, .button.disabled:focus, .button[disabled], .button[disabled]:hover, .button[disabled]:focus { background-color: #1779ba; color: #fefefe; } .button.disabled.primary, .button[disabled].primary { opacity: 0.25; cursor: not-allowed; } .button.disabled.primary, .button.disabled.primary:hover, .button.disabled.primary:focus, .button[disabled].primary, .button[disabled].primary:hover, .button[disabled].primary:focus { background-color: #1779ba; color: #fefefe; } .button.disabled.secondary, .button[disabled].secondary { opacity: 0.25; cursor: not-allowed; } .button.disabled.secondary, .button.disabled.secondary:hover, .button.disabled.secondary:focus, .button[disabled].secondary, .button[disabled].secondary:hover, .button[disabled].secondary:focus { background-color: #767676; color: #fefefe; } .button.disabled.success, .button[disabled].success { opacity: 0.25; cursor: not-allowed; } .button.disabled.success, .button.disabled.success:hover, .button.disabled.success:focus, .button[disabled].success, .button[disabled].success:hover, .button[disabled].success:focus { background-color: #3adb76; color: #0a0a0a; } .button.disabled.warning, .button[disabled].warning { opacity: 0.25; cursor: not-allowed; } .button.disabled.warning, .button.disabled.warning:hover, .button.disabled.warning:focus, .button[disabled].warning, .button[disabled].warning:hover, .button[disabled].warning:focus { background-color: #ffae00; color: #0a0a0a; } .button.disabled.alert, .button[disabled].alert { opacity: 0.25; cursor: not-allowed; } .button.disabled.alert, .button.disabled.alert:hover, .button.disabled.alert:focus, .button[disabled].alert, .button[disabled].alert:hover, .button[disabled].alert:focus { background-color: #cc4b37; color: #fefefe; } .button.dropdown::after { display: block; width: 0; height: 0; border: inset 0.4em; content: ''; border-bottom-width: 0; border-top-style: solid; border-color: #fefefe transparent transparent; position: relative; top: 0.4em; display: inline-block; float: right; margin-left: 1em; } .button.arrow-only::after { top: -0.1em; float: none; margin-left: 0; } .accordion { margin-left: 0; background: #fefefe; list-style-type: none; } .accordion-item:first-child > :first-child { border-radius: 0 0 0 0; } .accordion-item:last-child > :last-child { border-radius: 0 0 0 0; } .accordion-title { position: relative; display: block; padding: 1.25rem 1rem; border: 1px solid #e6e6e6; border-bottom: 0; font-size: 0.75rem; line-height: 1; color: #1779ba; } :last-child:not(.is-active) > .accordion-title { border-bottom: 1px solid #e6e6e6; border-radius: 0 0 0 0; } .accordion-title:hover, .accordion-title:focus { background-color: #e6e6e6; } .accordion-title::before { position: absolute; top: 50%; right: 1rem; margin-top: -0.5rem; content: '+'; } .is-active > .accordion-title::before { content: '\2013'; } .accordion-content { display: none; padding: 1rem; border: 1px solid #e6e6e6; border-bottom: 0; background-color: #fefefe; color: #0a0a0a; } :last-child > .accordion-content:last-child { border-bottom: 1px solid #e6e6e6; } .is-accordion-submenu-parent > a { position: relative; } .is-accordion-submenu-parent > a::after { display: block; width: 0; height: 0; border: inset 6px; content: ''; border-bottom-width: 0; border-top-style: solid; border-color: #1779ba transparent transparent; position: absolute; top: 50%; margin-top: -3px; right: 1rem; } .is-accordion-submenu-parent[aria-expanded='true'] > a::after { -webkit-transform: rotate(180deg); -ms-transform: rotate(180deg); transform: rotate(180deg); -webkit-transform-origin: 50% 50%; -ms-transform-origin: 50% 50%; transform-origin: 50% 50%; } .badge { display: inline-block; min-width: 2.1em; padding: 0.3em; border-radius: 50%; font-size: 0.6rem; text-align: center; background: #1779ba; color: #fefefe; } .badge.primary { background: #1779ba; color: #fefefe; } .badge.secondary { background: #767676; color: #fefefe; } .badge.success { background: #3adb76; color: #0a0a0a; } .badge.warning { background: #ffae00; color: #0a0a0a; } .badge.alert { background: #cc4b37; color: #fefefe; } .breadcrumbs { margin: 0 0 1rem 0; list-style: none; } .breadcrumbs::before, .breadcrumbs::after { display: table; content: ' '; } .breadcrumbs::after { clear: both; } .breadcrumbs li { float: left; font-size: 0.6875rem; color: #0a0a0a; cursor: default; text-transform: uppercase; } .breadcrumbs li:not(:last-child)::after { position: relative; top: 1px; margin: 0 0.75rem; opacity: 1; content: "/"; color: #cacaca; } .breadcrumbs a { color: #1779ba; } .breadcrumbs a:hover { text-decoration: underline; } .breadcrumbs .disabled { color: #cacaca; cursor: not-allowed; } .button-group { margin-bottom: 1rem; font-size: 0; } .button-group::before, .button-group::after { display: table; content: ' '; } .button-group::after { clear: both; } .button-group .button { margin: 0; margin-right: 1px; margin-bottom: 1px; font-size: 0.9rem; } .button-group .button:last-child { margin-right: 0; } .button-group.tiny .button { font-size: 0.6rem; } .button-group.small .button { font-size: 0.75rem; } .button-group.large .button { font-size: 1.25rem; } .button-group.expanded { margin-right: -1px; } .button-group.expanded::before, .button-group.expanded::after { display: none; } .button-group.expanded .button:first-child:last-child { width: 100%; } .button-group.expanded .button:first-child:nth-last-child(2), .button-group.expanded .button:first-child:nth-last-child(2):first-child:nth-last-child(2) ~ .button { display: inline-block; width: calc(50% - 1px); margin-right: 1px; } .button-group.expanded .button:first-child:nth-last-child(2):last-child, .button-group.expanded .button:first-child:nth-last-child(2):first-child:nth-last-child(2) ~ .button:last-child { margin-right: -6px; } .button-group.expanded .button:first-child:nth-last-child(3), .button-group.expanded .button:first-child:nth-last-child(3):first-child:nth-last-child(3) ~ .button { display: inline-block; width: calc(33.33333% - 1px); margin-right: 1px; } .button-group.expanded .button:first-child:nth-last-child(3):last-child, .button-group.expanded .button:first-child:nth-last-child(3):first-child:nth-last-child(3) ~ .button:last-child { margin-right: -6px; } .button-group.expanded .button:first-child:nth-last-child(4), .button-group.expanded .button:first-child:nth-last-child(4):first-child:nth-last-child(4) ~ .button { display: inline-block; width: calc(25% - 1px); margin-right: 1px; } .button-group.expanded .button:first-child:nth-last-child(4):last-child, .button-group.expanded .button:first-child:nth-last-child(4):first-child:nth-last-child(4) ~ .button:last-child { margin-right: -6px; } .button-group.expanded .button:first-child:nth-last-child(5), .button-group.expanded .button:first-child:nth-last-child(5):first-child:nth-last-child(5) ~ .button { display: inline-block; width: calc(20% - 1px); margin-right: 1px; } .button-group.expanded .button:first-child:nth-last-child(5):last-child, .button-group.expanded .button:first-child:nth-last-child(5):first-child:nth-last-child(5) ~ .button:last-child { margin-right: -6px; } .button-group.expanded .button:first-child:nth-last-child(6), .button-group.expanded .button:first-child:nth-last-child(6):first-child:nth-last-child(6) ~ .button { display: inline-block; width: calc(16.66667% - 1px); margin-right: 1px; } .button-group.expanded .button:first-child:nth-last-child(6):last-child, .button-group.expanded .button:first-child:nth-last-child(6):first-child:nth-last-child(6) ~ .button:last-child { margin-right: -6px; } .button-group.primary .button { background-color: #1779ba; color: #fefefe; } .button-group.primary .button:hover, .button-group.primary .button:focus { background-color: #126195; color: #fefefe; } .button-group.secondary .button { background-color: #767676; color: #fefefe; } .button-group.secondary .button:hover, .button-group.secondary .button:focus { background-color: #5e5e5e; color: #fefefe; } .button-group.success .button { background-color: #3adb76; color: #0a0a0a; } .button-group.success .button:hover, .button-group.success .button:focus { background-color: #22bb5b; color: #0a0a0a; } .button-group.warning .button { background-color: #ffae00; color: #0a0a0a; } .button-group.warning .button:hover, .button-group.warning .button:focus { background-color: #cc8b00; color: #0a0a0a; } .button-group.alert .button { background-color: #cc4b37; color: #fefefe; } .button-group.alert .button:hover, .button-group.alert .button:focus { background-color: #a53b2a; color: #fefefe; } .button-group.stacked .button, .button-group.stacked-for-small .button, .button-group.stacked-for-medium .button { width: 100%; } .button-group.stacked .button:last-child, .button-group.stacked-for-small .button:last-child, .button-group.stacked-for-medium .button:last-child { margin-bottom: 0; } @media print, screen and (min-width: 40em) { .button-group.stacked-for-small .button { width: auto; margin-bottom: 0; } } @media print, screen and (min-width: 64em) { .button-group.stacked-for-medium .button { width: auto; margin-bottom: 0; } } @media screen and (max-width: 39.9375em) { .button-group.stacked-for-small.expanded { display: block; } .button-group.stacked-for-small.expanded .button { display: block; margin-right: 0; } } .callout { position: relative; margin: 0 0 1rem 0; padding: 1rem; border: 1px solid rgba(10, 10, 10, 0.25); border-radius: 0; background-color: white; color: #0a0a0a; } .callout > :first-child { margin-top: 0; } .callout > :last-child { margin-bottom: 0; } .callout.primary { background-color: #d7ecfa; color: #0a0a0a; } .callout.secondary { background-color: #eaeaea; color: #0a0a0a; } .callout.success { background-color: #e1faea; color: #0a0a0a; } .callout.warning { background-color: #fff3d9; color: #0a0a0a; } .callout.alert { background-color: #f7e4e1; color: #0a0a0a; } .callout.small { padding-top: 0.5rem; padding-right: 0.5rem; padding-bottom: 0.5rem; padding-left: 0.5rem; } .callout.large { padding-top: 3rem; padding-right: 3rem; padding-bottom: 3rem; padding-left: 3rem; } .card { margin-bottom: 1rem; border: 1px solid #e6e6e6; border-radius: 0; background: #fefefe; -webkit-box-shadow: none; box-shadow: none; overflow: hidden; color: #0a0a0a; } .card > :last-child { margin-bottom: 0; } .card-divider { padding: 1rem; background: #e6e6e6; } .card-divider > :last-child { margin-bottom: 0; } .card-section { padding: 1rem; } .card-section > :last-child { margin-bottom: 0; } .close-button { position: absolute; color: #8a8a8a; cursor: pointer; } [data-whatinput='mouse'] .close-button { outline: 0; } .close-button:hover, .close-button:focus { color: #0a0a0a; } .close-button.small { right: 0.66rem; top: 0.33em; font-size: 1.5em; line-height: 1; } .close-button, .close-button.medium { right: 1rem; top: 0.5rem; font-size: 2em; line-height: 1; } .menu { margin: 0; list-style-type: none; } .menu > li { display: table-cell; vertical-align: middle; } [data-whatinput='mouse'] .menu > li { outline: 0; } .menu > li > a { display: block; padding: 0.7rem 1rem; line-height: 1; } .menu input, .menu select, .menu a, .menu button { margin-bottom: 0; } .menu > li > a img, .menu > li > a i, .menu > li > a svg { vertical-align: middle; } .menu > li > a img + span, .menu > li > a i + span, .menu > li > a svg + span { vertical-align: middle; } .menu > li > a img, .menu > li > a i, .menu > li > a svg { margin-right: 0.25rem; display: inline-block; } .menu > li, .menu.horizontal > li { display: table-cell; } .menu.expanded { display: table; width: 100%; table-layout: fixed; } .menu.expanded > li:first-child:last-child { width: 100%; } .menu.vertical > li { display: block; } @media print, screen and (min-width: 40em) { .menu.medium-horizontal > li { display: table-cell; } .menu.medium-expanded { display: table; width: 100%; table-layout: fixed; } .menu.medium-expanded > li:first-child:last-child { width: 100%; } .menu.medium-vertical > li { display: block; } } @media print, screen and (min-width: 64em) { .menu.large-horizontal > li { display: table-cell; } .menu.large-expanded { display: table; width: 100%; table-layout: fixed; } .menu.large-expanded > li:first-child:last-child { width: 100%; } .menu.large-vertical > li { display: block; } } .menu.simple li { display: inline-block; vertical-align: top; line-height: 1; } .menu.simple a { padding: 0; } .menu.simple li { margin-left: 0; margin-right: 1rem; } .menu.simple.align-right li { margin-right: 0; margin-left: 1rem; } .menu.align-right::before, .menu.align-right::after { display: table; content: ' '; } .menu.align-right::after { clear: both; } .menu.align-right > li { float: right; } .menu.icon-top > li > a { text-align: center; } .menu.icon-top > li > a img, .menu.icon-top > li > a i, .menu.icon-top > li > a svg { display: block; margin: 0 auto 0.25rem; } .menu.icon-top.vertical a > span { margin: auto; } .menu.nested { margin-left: 1rem; } .menu .active > a { background: #1779ba; color: #fefefe; } .menu.menu-bordered li { border: 1px solid #e6e6e6; } .menu.menu-bordered li:not(:first-child) { border-top: 0; } .menu.menu-hover li:hover { background-color: #e6e6e6; } .menu-text { padding-top: 0; padding-bottom: 0; padding: 0.7rem 1rem; font-weight: bold; line-height: 1; color: inherit; } .menu-centered { text-align: center; } .menu-centered > .menu { display: inline-block; vertical-align: top; } .no-js [data-responsive-menu] ul { display: none; } .menu-icon { position: relative; display: inline-block; vertical-align: middle; width: 20px; height: 16px; cursor: pointer; } .menu-icon::after { position: absolute; top: 0; left: 0; display: block; width: 100%; height: 2px; background: #fefefe; -webkit-box-shadow: 0 7px 0 #fefefe, 0 14px 0 #fefefe; box-shadow: 0 7px 0 #fefefe, 0 14px 0 #fefefe; content: ''; } .menu-icon:hover::after { background: #cacaca; -webkit-box-shadow: 0 7px 0 #cacaca, 0 14px 0 #cacaca; box-shadow: 0 7px 0 #cacaca, 0 14px 0 #cacaca; } .menu-icon.dark { position: relative; display: inline-block; vertical-align: middle; width: 20px; height: 16px; cursor: pointer; } .menu-icon.dark::after { position: absolute; top: 0; left: 0; display: block; width: 100%; height: 2px; background: #0a0a0a; -webkit-box-shadow: 0 7px 0 #0a0a0a, 0 14px 0 #0a0a0a; box-shadow: 0 7px 0 #0a0a0a, 0 14px 0 #0a0a0a; content: ''; } .menu-icon.dark:hover::after { background: #8a8a8a; -webkit-box-shadow: 0 7px 0 #8a8a8a, 0 14px 0 #8a8a8a; box-shadow: 0 7px 0 #8a8a8a, 0 14px 0 #8a8a8a; } .is-drilldown { position: relative; overflow: hidden; } .is-drilldown li { display: block; } .is-drilldown.animate-height { -webkit-transition: height 0.5s; transition: height 0.5s; } .is-drilldown-submenu { position: absolute; top: 0; left: 100%; z-index: -1; width: 100%; background: #fefefe; -webkit-transition: -webkit-transform 0.15s linear; transition: -webkit-transform 0.15s linear; transition: transform 0.15s linear; transition: transform 0.15s linear, -webkit-transform 0.15s linear; } .is-drilldown-submenu.is-active { z-index: 1; display: block; -webkit-transform: translateX(-100%); -ms-transform: translateX(-100%); transform: translateX(-100%); } .is-drilldown-submenu.is-closing { -webkit-transform: translateX(100%); -ms-transform: translateX(100%); transform: translateX(100%); } .drilldown-submenu-cover-previous { min-height: 100%; } .is-drilldown-submenu-parent > a { position: relative; } .is-drilldown-submenu-parent > a::after { display: block; width: 0; height: 0; border: inset 6px; content: ''; border-right-width: 0; border-left-style: solid; border-color: transparent transparent transparent #1779ba; position: absolute; top: 50%; margin-top: -6px; right: 1rem; } .js-drilldown-back > a::before { display: block; width: 0; height: 0; border: inset 6px; content: ''; border-left-width: 0; border-right-style: solid; border-color: transparent #1779ba transparent transparent; border-left-width: 0; display: inline-block; vertical-align: middle; margin-right: 0.75rem; border-left-width: 0; } .dropdown-pane { position: absolute; z-index: 10; display: block; width: 300px; padding: 1rem; visibility: hidden; border: 1px solid #cacaca; border-radius: 0; background-color: #fefefe; font-size: 1rem; } .dropdown-pane.is-open { visibility: visible; } .dropdown-pane.tiny { width: 100px; } .dropdown-pane.small { width: 200px; } .dropdown-pane.large { width: 400px; } .dropdown.menu > li.opens-left > .is-dropdown-submenu { top: 100%; right: 0; left: auto; } .dropdown.menu > li.opens-right > .is-dropdown-submenu { top: 100%; right: auto; left: 0; } .dropdown.menu > li.is-dropdown-submenu-parent > a { position: relative; padding-right: 1.5rem; } .dropdown.menu > li.is-dropdown-submenu-parent > a::after { display: block; width: 0; height: 0; border: inset 6px; content: ''; border-bottom-width: 0; border-top-style: solid; border-color: #1779ba transparent transparent; right: 5px; margin-top: -3px; } [data-whatinput='mouse'] .dropdown.menu a { outline: 0; } .no-js .dropdown.menu ul { display: none; } .dropdown.menu.vertical > li .is-dropdown-submenu { top: 0; } .dropdown.menu.vertical > li.opens-left > .is-dropdown-submenu { right: 100%; left: auto; } .dropdown.menu.vertical > li.opens-right > .is-dropdown-submenu { right: auto; left: 100%; } .dropdown.menu.vertical > li > a::after { right: 14px; } .dropdown.menu.vertical > li.opens-left > a::after { display: block; width: 0; height: 0; border: inset 6px; content: ''; border-left-width: 0; border-right-style: solid; border-color: transparent #1779ba transparent transparent; } .dropdown.menu.vertical > li.opens-right > a::after { display: block; width: 0; height: 0; border: inset 6px; content: ''; border-right-width: 0; border-left-style: solid; border-color: transparent transparent transparent #1779ba; } @media print, screen and (min-width: 40em) { .dropdown.menu.medium-horizontal > li.opens-left > .is-dropdown-submenu { top: 100%; right: 0; left: auto; } .dropdown.menu.medium-horizontal > li.opens-right > .is-dropdown-submenu { top: 100%; right: auto; left: 0; } .dropdown.menu.medium-horizontal > li.is-dropdown-submenu-parent > a { position: relative; padding-right: 1.5rem; } .dropdown.menu.medium-horizontal > li.is-dropdown-submenu-parent > a::after { display: block; width: 0; height: 0; border: inset 6px; content: ''; border-bottom-width: 0; border-top-style: solid; border-color: #1779ba transparent transparent; right: 5px; margin-top: -3px; } .dropdown.menu.medium-vertical > li .is-dropdown-submenu { top: 0; } .dropdown.menu.medium-vertical > li.opens-left > .is-dropdown-submenu { right: 100%; left: auto; } .dropdown.menu.medium-vertical > li.opens-right > .is-dropdown-submenu { right: auto; left: 100%; } .dropdown.menu.medium-vertical > li > a::after { right: 14px; } .dropdown.menu.medium-vertical > li.opens-left > a::after { display: block; width: 0; height: 0; border: inset 6px; content: ''; border-left-width: 0; border-right-style: solid; border-color: transparent #1779ba transparent transparent; } .dropdown.menu.medium-vertical > li.opens-right > a::after { display: block; width: 0; height: 0; border: inset 6px; content: ''; border-right-width: 0; border-left-style: solid; border-color: transparent transparent transparent #1779ba; } } @media print, screen and (min-width: 64em) { .dropdown.menu.large-horizontal > li.opens-left > .is-dropdown-submenu { top: 100%; right: 0; left: auto; } .dropdown.menu.large-horizontal > li.opens-right > .is-dropdown-submenu { top: 100%; right: auto; left: 0; } .dropdown.menu.large-horizontal > li.is-dropdown-submenu-parent > a { position: relative; padding-right: 1.5rem; } .dropdown.menu.large-horizontal > li.is-dropdown-submenu-parent > a::after { display: block; width: 0; height: 0; border: inset 6px; content: ''; border-bottom-width: 0; border-top-style: solid; border-color: #1779ba transparent transparent; right: 5px; margin-top: -3px; } .dropdown.menu.large-vertical > li .is-dropdown-submenu { top: 0; } .dropdown.menu.large-vertical > li.opens-left > .is-dropdown-submenu { right: 100%; left: auto; } .dropdown.menu.large-vertical > li.opens-right > .is-dropdown-submenu { right: auto; left: 100%; } .dropdown.menu.large-vertical > li > a::after { right: 14px; } .dropdown.menu.large-vertical > li.opens-left > a::after { display: block; width: 0; height: 0; border: inset 6px; content: ''; border-left-width: 0; border-right-style: solid; border-color: transparent #1779ba transparent transparent; } .dropdown.menu.large-vertical > li.opens-right > a::after { display: block; width: 0; height: 0; border: inset 6px; content: ''; border-right-width: 0; border-left-style: solid; border-color: transparent transparent transparent #1779ba; } } .dropdown.menu.align-right .is-dropdown-submenu.first-sub { top: 100%; right: 0; left: auto; } .is-dropdown-menu.vertical { width: 100px; } .is-dropdown-menu.vertical.align-right { float: right; } .is-dropdown-submenu-parent { position: relative; } .is-dropdown-submenu-parent a::after { position: absolute; top: 50%; right: 5px; margin-top: -6px; } .is-dropdown-submenu-parent.opens-inner > .is-dropdown-submenu { top: 100%; left: auto; } .is-dropdown-submenu-parent.opens-left > .is-dropdown-submenu { right: 100%; left: auto; } .is-dropdown-submenu-parent.opens-right > .is-dropdown-submenu { right: auto; left: 100%; } .is-dropdown-submenu { position: absolute; top: 0; left: 100%; z-index: 1; display: none; min-width: 200px; border: 1px solid #cacaca; background: #fefefe; } .is-dropdown-submenu .is-dropdown-submenu-parent > a::after { right: 14px; } .is-dropdown-submenu .is-dropdown-submenu-parent.opens-left > a::after { display: block; width: 0; height: 0; border: inset 6px; content: ''; border-left-width: 0; border-right-style: solid; border-color: transparent #1779ba transparent transparent; } .is-dropdown-submenu .is-dropdown-submenu-parent.opens-right > a::after { display: block; width: 0; height: 0; border: inset 6px; content: ''; border-right-width: 0; border-left-style: solid; border-color: transparent transparent transparent #1779ba; } .is-dropdown-submenu .is-dropdown-submenu { margin-top: -1px; } .is-dropdown-submenu > li { width: 100%; } .is-dropdown-submenu.js-dropdown-active { display: block; } .responsive-embed, .flex-video { position: relative; height: 0; margin-bottom: 1rem; padding-bottom: 75%; overflow: hidden; } .responsive-embed iframe, .responsive-embed object, .responsive-embed embed, .responsive-embed video, .flex-video iframe, .flex-video object, .flex-video embed, .flex-video video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .responsive-embed.widescreen, .flex-video.widescreen { padding-bottom: 56.25%; } .label { display: inline-block; padding: 0.33333rem 0.5rem; border-radius: 0; font-size: 0.8rem; line-height: 1; white-space: nowrap; cursor: default; background: #1779ba; color: #fefefe; } .label.primary { background: #1779ba; color: #fefefe; } .label.secondary { background: #767676; color: #fefefe; } .label.success { background: #3adb76; color: #0a0a0a; } .label.warning { background: #ffae00; color: #0a0a0a; } .label.alert { background: #cc4b37; color: #fefefe; } .media-object { display: block; margin-bottom: 1rem; } .media-object img { max-width: none; } @media screen and (max-width: 39.9375em) { .media-object.stack-for-small .media-object-section { padding: 0; padding-bottom: 1rem; display: block; } .media-object.stack-for-small .media-object-section img { width: 100%; } } .media-object-section { display: table-cell; vertical-align: top; } .media-object-section:first-child { padding-right: 1rem; } .media-object-section:last-child:not(:nth-child(2)) { padding-left: 1rem; } .media-object-section > :last-child { margin-bottom: 0; } .media-object-section.middle { vertical-align: middle; } .media-object-section.bottom { vertical-align: bottom; } .is-off-canvas-open { overflow: hidden; } .js-off-canvas-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; -webkit-transition: opacity 0.5s ease, visibility 0.5s ease; transition: opacity 0.5s ease, visibility 0.5s ease; background: rgba(254, 254, 254, 0.25); opacity: 0; visibility: hidden; overflow: hidden; } .js-off-canvas-overlay.is-visible { opacity: 1; visibility: visible; } .js-off-canvas-overlay.is-closable { cursor: pointer; } .js-off-canvas-overlay.is-overlay-absolute { position: absolute; } .js-off-canvas-overlay.is-overlay-fixed { position: fixed; } .off-canvas-wrapper { position: relative; overflow: hidden; } .off-canvas { position: fixed; z-index: 1; -webkit-transition: -webkit-transform 0.5s ease; transition: -webkit-transform 0.5s ease; transition: transform 0.5s ease; transition: transform 0.5s ease, -webkit-transform 0.5s ease; -webkit-backface-visibility: hidden; backface-visibility: hidden; background: #e6e6e6; } [data-whatinput='mouse'] .off-canvas { outline: 0; } .off-canvas.is-transition-overlap { z-index: 10; } .off-canvas.is-transition-overlap.is-open { -webkit-box-shadow: 0 0 10px rgba(10, 10, 10, 0.7); box-shadow: 0 0 10px rgba(10, 10, 10, 0.7); } .off-canvas.is-open { -webkit-transform: translate(0, 0); -ms-transform: translate(0, 0); transform: translate(0, 0); } .off-canvas-absolute { position: absolute; z-index: 1; -webkit-transition: -webkit-transform 0.5s ease; transition: -webkit-transform 0.5s ease; transition: transform 0.5s ease; transition: transform 0.5s ease, -webkit-transform 0.5s ease; -webkit-backface-visibility: hidden; backface-visibility: hidden; background: #e6e6e6; } [data-whatinput='mouse'] .off-canvas-absolute { outline: 0; } .off-canvas-absolute.is-transition-overlap { z-index: 10; } .off-canvas-absolute.is-transition-overlap.is-open { -webkit-box-shadow: 0 0 10px rgba(10, 10, 10, 0.7); box-shadow: 0 0 10px rgba(10, 10, 10, 0.7); } .off-canvas-absolute.is-open { -webkit-transform: translate(0, 0); -ms-transform: translate(0, 0); transform: translate(0, 0); } .position-left { top: 0; left: 0; width: 250px; height: 100%; -webkit-transform: translateX(-250px); -ms-transform: translateX(-250px); transform: translateX(-250px); overflow-y: auto; } .position-left.is-open ~ .off-canvas-content { -webkit-transform: translateX(250px); -ms-transform: translateX(250px); transform: translateX(250px); } .position-left.is-transition-push::after { position: absolute; top: 0; right: 0; height: 100%; width: 1px; -webkit-box-shadow: 0 0 10px rgba(10, 10, 10, 0.7); box-shadow: 0 0 10px rgba(10, 10, 10, 0.7); content: " "; } .position-left.is-transition-overlap.is-open ~ .off-canvas-content { -webkit-transform: none; -ms-transform: none; transform: none; } .position-right { top: 0; right: 0; width: 250px; height: 100%; -webkit-transform: translateX(250px); -ms-transform: translateX(250px); transform: translateX(250px); overflow-y: auto; } .position-right.is-open ~ .off-canvas-content { -webkit-transform: translateX(-250px); -ms-transform: translateX(-250px); transform: translateX(-250px); } .position-right.is-transition-push::after { position: absolute; top: 0; left: 0; height: 100%; width: 1px; -webkit-box-shadow: 0 0 10px rgba(10, 10, 10, 0.7); box-shadow: 0 0 10px rgba(10, 10, 10, 0.7); content: " "; } .position-right.is-transition-overlap.is-open ~ .off-canvas-content { -webkit-transform: none; -ms-transform: none; transform: none; } .position-top { top: 0; left: 0; width: 100%; height: 250px; -webkit-transform: translateY(-250px); -ms-transform: translateY(-250px); transform: translateY(-250px); overflow-x: auto; } .position-top.is-open ~ .off-canvas-content { -webkit-transform: translateY(250px); -ms-transform: translateY(250px); transform: translateY(250px); } .position-top.is-transition-push::after { position: absolute; bottom: 0; left: 0; height: 1px; width: 100%; -webkit-box-shadow: 0 0 10px rgba(10, 10, 10, 0.7); box-shadow: 0 0 10px rgba(10, 10, 10, 0.7); content: " "; } .position-top.is-transition-overlap.is-open ~ .off-canvas-content { -webkit-transform: none; -ms-transform: none; transform: none; } .position-bottom { bottom: 0; left: 0; width: 100%; height: 250px; -webkit-transform: translateY(250px); -ms-transform: translateY(250px); transform: translateY(250px); overflow-x: auto; } .position-bottom.is-open ~ .off-canvas-content { -webkit-transform: translateY(-250px); -ms-transform: translateY(-250px); transform: translateY(-250px); } .position-bottom.is-transition-push::after { position: absolute; top: 0; left: 0; height: 1px; width: 100%; -webkit-box-shadow: 0 0 10px rgba(10, 10, 10, 0.7); box-shadow: 0 0 10px rgba(10, 10, 10, 0.7); content: " "; } .position-bottom.is-transition-overlap.is-open ~ .off-canvas-content { -webkit-transform: none; -ms-transform: none; transform: none; } .off-canvas-content { -webkit-transition: -webkit-transform 0.5s ease; transition: -webkit-transform 0.5s ease; transition: transform 0.5s ease; transition: transform 0.5s ease, -webkit-transform 0.5s ease; -webkit-backface-visibility: hidden; backface-visibility: hidden; } @media print, screen and (min-width: 40em) { .position-left.reveal-for-medium { -webkit-transform: none; -ms-transform: none; transform: none; z-index: 1; } .position-left.reveal-for-medium ~ .off-canvas-content { margin-left: 250px; } .position-right.reveal-for-medium { -webkit-transform: none; -ms-transform: none; transform: none; z-index: 1; } .position-right.reveal-for-medium ~ .off-canvas-content { margin-right: 250px; } .position-top.reveal-for-medium { -webkit-transform: none; -ms-transform: none; transform: none; z-index: 1; } .position-top.reveal-for-medium ~ .off-canvas-content { margin-top: 250px; } .position-bottom.reveal-for-medium { -webkit-transform: none; -ms-transform: none; transform: none; z-index: 1; } .position-bottom.reveal-for-medium ~ .off-canvas-content { margin-bottom: 250px; } } @media print, screen and (min-width: 64em) { .position-left.reveal-for-large { -webkit-transform: none; -ms-transform: none; transform: none; z-index: 1; } .position-left.reveal-for-large ~ .off-canvas-content { margin-left: 250px; } .position-right.reveal-for-large { -webkit-transform: none; -ms-transform: none; transform: none; z-index: 1; } .position-right.reveal-for-large ~ .off-canvas-content { margin-right: 250px; } .position-top.reveal-for-large { -webkit-transform: none; -ms-transform: none; transform: none; z-index: 1; } .position-top.reveal-for-large ~ .off-canvas-content { margin-top: 250px; } .position-bottom.reveal-for-large { -webkit-transform: none; -ms-transform: none; transform: none; z-index: 1; } .position-bottom.reveal-for-large ~ .off-canvas-content { margin-bottom: 250px; } } .orbit { position: relative; } .orbit-container { position: relative; height: 0; margin: 0; list-style: none; overflow: hidden; } .orbit-slide { width: 100%; } .orbit-slide.no-motionui.is-active { top: 0; left: 0; } .orbit-figure { margin: 0; } .orbit-image { width: 100%; max-width: 100%; margin: 0; } .orbit-caption { position: absolute; bottom: 0; width: 100%; margin-bottom: 0; padding: 1rem; background-color: rgba(10, 10, 10, 0.5); color: #fefefe; } .orbit-previous, .orbit-next { position: absolute; top: 50%; -webkit-transform: translateY(-50%); -ms-transform: translateY(-50%); transform: translateY(-50%); z-index: 10; padding: 1rem; color: #fefefe; } [data-whatinput='mouse'] .orbit-previous, [data-whatinput='mouse'] .orbit-next { outline: 0; } .orbit-previous:hover, .orbit-next:hover, .orbit-previous:active, .orbit-next:active, .orbit-previous:focus, .orbit-next:focus { background-color: rgba(10, 10, 10, 0.5); } .orbit-previous { left: 0; } .orbit-next { left: auto; right: 0; } .orbit-bullets { position: relative; margin-top: 0.8rem; margin-bottom: 0.8rem; text-align: center; } [data-whatinput='mouse'] .orbit-bullets { outline: 0; } .orbit-bullets button { width: 1.2rem; height: 1.2rem; margin: 0.1rem; border-radius: 50%; background-color: #cacaca; } .orbit-bullets button:hover { background-color: #8a8a8a; } .orbit-bullets button.is-active { background-color: #8a8a8a; } .pagination { margin-left: 0; margin-bottom: 1rem; } .pagination::before, .pagination::after { display: table; content: ' '; } .pagination::after { clear: both; } .pagination li { margin-right: 0.0625rem; border-radius: 0; font-size: 0.875rem; display: none; } .pagination li:last-child, .pagination li:first-child { display: inline-block; } @media print, screen and (min-width: 40em) { .pagination li { display: inline-block; } } .pagination a, .pagination button { display: block; padding: 0.1875rem 0.625rem; border-radius: 0; color: #0a0a0a; } .pagination a:hover, .pagination button:hover { background: #e6e6e6; } .pagination .current { padding: 0.1875rem 0.625rem; background: #1779ba; color: #fefefe; cursor: default; } .pagination .disabled { padding: 0.1875rem 0.625rem; color: #cacaca; cursor: not-allowed; } .pagination .disabled:hover { background: transparent; } .pagination .ellipsis::after { padding: 0.1875rem 0.625rem; content: '\2026'; color: #0a0a0a; } .pagination-previous a::before, .pagination-previous.disabled::before { display: inline-block; margin-right: 0.5rem; content: '\00ab'; } .pagination-next a::after, .pagination-next.disabled::after { display: inline-block; margin-left: 0.5rem; content: '\00bb'; } .progress { height: 1rem; margin-bottom: 1rem; border-radius: 0; background-color: #cacaca; } .progress.primary .progress-meter { background-color: #1779ba; } .progress.secondary .progress-meter { background-color: #767676; } .progress.success .progress-meter { background-color: #3adb76; } .progress.warning .progress-meter { background-color: #ffae00; } .progress.alert .progress-meter { background-color: #cc4b37; } .progress-meter { position: relative; display: block; width: 0%; height: 100%; background-color: #1779ba; } .progress-meter-text { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); transform: translate(-50%, -50%); position: absolute; margin: 0; font-size: 0.75rem; font-weight: bold; color: #fefefe; white-space: nowrap; } .slider { position: relative; height: 0.5rem; margin-top: 1.25rem; margin-bottom: 2.25rem; background-color: #e6e6e6; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -ms-touch-action: none; touch-action: none; } .slider-fill { position: absolute; top: 0; left: 0; display: inline-block; max-width: 100%; height: 0.5rem; background-color: #cacaca; -webkit-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; } .slider-fill.is-dragging { -webkit-transition: all 0s linear; transition: all 0s linear; } .slider-handle { position: absolute; top: 50%; -webkit-transform: translateY(-50%); -ms-transform: translateY(-50%); transform: translateY(-50%); position: absolute; left: 0; z-index: 1; display: inline-block; width: 1.4rem; height: 1.4rem; border-radius: 0; background-color: #1779ba; -webkit-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; -ms-touch-action: manipulation; touch-action: manipulation; } [data-whatinput='mouse'] .slider-handle { outline: 0; } .slider-handle:hover { background-color: #14679e; } .slider-handle.is-dragging { -webkit-transition: all 0s linear; transition: all 0s linear; } .slider.disabled, .slider[disabled] { opacity: 0.25; cursor: not-allowed; } .slider.vertical { display: inline-block; width: 0.5rem; height: 12.5rem; margin: 0 1.25rem; -webkit-transform: scale(1, -1); -ms-transform: scale(1, -1); transform: scale(1, -1); } .slider.vertical .slider-fill { top: 0; width: 0.5rem; max-height: 100%; } .slider.vertical .slider-handle { position: absolute; top: 0; left: 50%; width: 1.4rem; height: 1.4rem; -webkit-transform: translateX(-50%); -ms-transform: translateX(-50%); transform: translateX(-50%); } .sticky-container { position: relative; } .sticky { position: relative; z-index: 0; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } .sticky.is-stuck { position: fixed; z-index: 5; } .sticky.is-stuck.is-at-top { top: 0; } .sticky.is-stuck.is-at-bottom { bottom: 0; } .sticky.is-anchored { position: relative; right: auto; left: auto; } .sticky.is-anchored.is-at-bottom { bottom: 0; } body.is-reveal-open { overflow: hidden; } html.is-reveal-open, html.is-reveal-open body { min-height: 100%; overflow: hidden; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .reveal-overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1005; display: none; background-color: rgba(10, 10, 10, 0.45); overflow-y: scroll; } .reveal { z-index: 1006; -webkit-backface-visibility: hidden; backface-visibility: hidden; display: none; padding: 1rem; border: 1px solid #cacaca; border-radius: 0; background-color: #fefefe; position: relative; top: 100px; margin-right: auto; margin-left: auto; overflow-y: auto; } [data-whatinput='mouse'] .reveal { outline: 0; } @media print, screen and (min-width: 40em) { .reveal { min-height: 0; } } .reveal .column, .reveal .columns, .reveal .columns { min-width: 0; } .reveal > :last-child { margin-bottom: 0; } @media print, screen and (min-width: 40em) { .reveal { width: 600px; max-width: 75rem; } } @media print, screen and (min-width: 40em) { .reveal .reveal { right: auto; left: auto; margin: 0 auto; } } .reveal.collapse { padding: 0; } @media print, screen and (min-width: 40em) { .reveal.tiny { width: 30%; max-width: 75rem; } } @media print, screen and (min-width: 40em) { .reveal.small { width: 50%; max-width: 75rem; } } @media print, screen and (min-width: 40em) { .reveal.large { width: 90%; max-width: 75rem; } } .reveal.full { top: 0; left: 0; width: 100%; max-width: none; height: 100%; height: 100vh; min-height: 100vh; margin-left: 0; border: 0; border-radius: 0; } @media screen and (max-width: 39.9375em) { .reveal { top: 0; left: 0; width: 100%; max-width: none; height: 100%; height: 100vh; min-height: 100vh; margin-left: 0; border: 0; border-radius: 0; } } .reveal.without-overlay { position: fixed; } .switch { height: 2rem; position: relative; margin-bottom: 1rem; outline: 0; font-size: 0.875rem; font-weight: bold; color: #fefefe; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .switch-input { position: absolute; margin-bottom: 0; opacity: 0; } .switch-paddle { position: relative; display: block; width: 4rem; height: 2rem; border-radius: 0; background: #cacaca; -webkit-transition: all 0.25s ease-out; transition: all 0.25s ease-out; font-weight: inherit; color: inherit; cursor: pointer; } input + .switch-paddle { margin: 0; } .switch-paddle::after { position: absolute; top: 0.25rem; left: 0.25rem; display: block; width: 1.5rem; height: 1.5rem; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); border-radius: 0; background: #fefefe; -webkit-transition: all 0.25s ease-out; transition: all 0.25s ease-out; content: ''; } input:checked ~ .switch-paddle { background: #1779ba; } input:checked ~ .switch-paddle::after { left: 2.25rem; } [data-whatinput='mouse'] input:focus ~ .switch-paddle { outline: 0; } .switch-active, .switch-inactive { position: absolute; top: 50%; -webkit-transform: translateY(-50%); -ms-transform: translateY(-50%); transform: translateY(-50%); } .switch-active { left: 8%; display: none; } input:checked + label > .switch-active { display: block; } .switch-inactive { right: 15%; } input:checked + label > .switch-inactive { display: none; } .switch.tiny { height: 1.5rem; } .switch.tiny .switch-paddle { width: 3rem; height: 1.5rem; font-size: 0.625rem; } .switch.tiny .switch-paddle::after { top: 0.25rem; left: 0.25rem; width: 1rem; height: 1rem; } .switch.tiny input:checked ~ .switch-paddle::after { left: 1.75rem; } .switch.small { height: 1.75rem; } .switch.small .switch-paddle { width: 3.5rem; height: 1.75rem; font-size: 0.75rem; } .switch.small .switch-paddle::after { top: 0.25rem; left: 0.25rem; width: 1.25rem; height: 1.25rem; } .switch.small input:checked ~ .switch-paddle::after { left: 2rem; } .switch.large { height: 2.5rem; } .switch.large .switch-paddle { width: 5rem; height: 2.5rem; font-size: 1rem; } .switch.large .switch-paddle::after { top: 0.25rem; left: 0.25rem; width: 2rem; height: 2rem; } .switch.large input:checked ~ .switch-paddle::after { left: 2.75rem; } table { width: 100%; margin-bottom: 1rem; border-radius: 0; } table thead, table tbody, table tfoot { border: 1px solid #f1f1f1; background-color: #fefefe; } table caption { padding: 0.5rem 0.625rem 0.625rem; font-weight: bold; } table thead { background: #f8f8f8; color: #0a0a0a; } table tfoot { background: #f1f1f1; color: #0a0a0a; } table thead tr, table tfoot tr { background: transparent; } table thead th, table thead td, table tfoot th, table tfoot td { padding: 0.5rem 0.625rem 0.625rem; font-weight: bold; text-align: left; } table tbody th, table tbody td { padding: 0.5rem 0.625rem 0.625rem; } table tbody tr:nth-child(even) { border-bottom: 0; background-color: #f1f1f1; } table.unstriped tbody { background-color: #fefefe; } table.unstriped tbody tr { border-bottom: 0; border-bottom: 1px solid #f1f1f1; background-color: #fefefe; } @media screen and (max-width: 63.9375em) { table.stack thead { display: none; } table.stack tfoot { display: none; } table.stack tr, table.stack th, table.stack td { display: block; } table.stack td { border-top: 0; } } table.scroll { display: block; width: 100%; overflow-x: auto; } table.hover thead tr:hover { background-color: #f3f3f3; } table.hover tfoot tr:hover { background-color: #ececec; } table.hover tbody tr:hover { background-color: #f9f9f9; } table.hover:not(.unstriped) tr:nth-of-type(even):hover { background-color: #ececec; } .table-scroll { overflow-x: auto; } .table-scroll table { width: auto; } .tabs { margin: 0; border: 1px solid #e6e6e6; background: #fefefe; list-style-type: none; } .tabs::before, .tabs::after { display: table; content: ' '; } .tabs::after { clear: both; } .tabs.vertical > li { display: block; float: none; width: auto; } .tabs.simple > li > a { padding: 0; } .tabs.simple > li > a:hover { background: transparent; } .tabs.primary { background: #1779ba; } .tabs.primary > li > a { color: #fefefe; } .tabs.primary > li > a:hover, .tabs.primary > li > a:focus { background: #1673b1; } .tabs-title { float: left; } .tabs-title > a { display: block; padding: 1.25rem 1.5rem; font-size: 0.75rem; line-height: 1; color: #1779ba; } .tabs-title > a:hover { background: #fefefe; color: #1468a0; } .tabs-title > a:focus, .tabs-title > a[aria-selected='true'] { background: #e6e6e6; color: #1779ba; } .tabs-content { border: 1px solid #e6e6e6; border-top: 0; background: #fefefe; color: #0a0a0a; -webkit-transition: all 0.5s ease; transition: all 0.5s ease; } .tabs-content.vertical { border: 1px solid #e6e6e6; border-left: 0; } .tabs-panel { display: none; padding: 1rem; } .tabs-panel[aria-hidden="false"] { display: block; } .thumbnail { display: inline-block; max-width: 100%; margin-bottom: 1rem; border: solid 4px #fefefe; border-radius: 0; -webkit-box-shadow: 0 0 0 1px rgba(10, 10, 10, 0.2); box-shadow: 0 0 0 1px rgba(10, 10, 10, 0.2); line-height: 0; } a.thumbnail { -webkit-transition: -webkit-box-shadow 200ms ease-out; transition: -webkit-box-shadow 200ms ease-out; transition: box-shadow 200ms ease-out; transition: box-shadow 200ms ease-out, -webkit-box-shadow 200ms ease-out; } a.thumbnail:hover, a.thumbnail:focus { -webkit-box-shadow: 0 0 6px 1px rgba(23, 121, 186, 0.5); box-shadow: 0 0 6px 1px rgba(23, 121, 186, 0.5); } a.thumbnail image { -webkit-box-shadow: none; box-shadow: none; } .title-bar { padding: 0.5rem; background: #0a0a0a; color: #fefefe; } .title-bar::before, .title-bar::after { display: table; content: ' '; } .title-bar::after { clear: both; } .title-bar .menu-icon { margin-left: 0.25rem; margin-right: 0.25rem; } .title-bar-left { float: left; } .title-bar-right { float: right; text-align: right; } .title-bar-title { display: inline-block; vertical-align: middle; font-weight: bold; } .has-tip { position: relative; display: inline-block; border-bottom: dotted 1px #8a8a8a; font-weight: bold; cursor: help; } .tooltip { position: absolute; top: calc(100% + 0.6495rem); z-index: 1200; max-width: 10rem; padding: 0.75rem; border-radius: 0; background-color: #0a0a0a; font-size: 80%; color: #fefefe; } .tooltip::before { display: block; width: 0; height: 0; border: inset 0.75rem; content: ''; border-top-width: 0; border-bottom-style: solid; border-color: transparent transparent #0a0a0a; position: absolute; bottom: 100%; left: 50%; -webkit-transform: translateX(-50%); -ms-transform: translateX(-50%); transform: translateX(-50%); } .tooltip.top::before { display: block; width: 0; height: 0; border: inset 0.75rem; content: ''; border-bottom-width: 0; border-top-style: solid; border-color: #0a0a0a transparent transparent; top: 100%; bottom: auto; } .tooltip.left::before { display: block; width: 0; height: 0; border: inset 0.75rem; content: ''; border-right-width: 0; border-left-style: solid; border-color: transparent transparent transparent #0a0a0a; top: 50%; bottom: auto; left: 100%; -webkit-transform: translateY(-50%); -ms-transform: translateY(-50%); transform: translateY(-50%); } .tooltip.right::before { display: block; width: 0; height: 0; border: inset 0.75rem; content: ''; border-left-width: 0; border-right-style: solid; border-color: transparent #0a0a0a transparent transparent; top: 50%; right: 100%; bottom: auto; left: auto; -webkit-transform: translateY(-50%); -ms-transform: translateY(-50%); transform: translateY(-50%); } .top-bar { padding: 0.5rem; } .top-bar::before, .top-bar::after { display: table; content: ' '; } .top-bar::after { clear: both; } .top-bar, .top-bar ul { background-color: #e6e6e6; } .top-bar input { max-width: 200px; margin-right: 1rem; } .top-bar .input-group-field { width: 100%; margin-right: 0; } .top-bar input.button { width: auto; } .top-bar .top-bar-left, .top-bar .top-bar-right { width: 100%; } @media print, screen and (min-width: 40em) { .top-bar .top-bar-left, .top-bar .top-bar-right { width: auto; } } @media screen and (max-width: 63.9375em) { .top-bar.stacked-for-medium .top-bar-left, .top-bar.stacked-for-medium .top-bar-right { width: 100%; } } @media screen and (max-width: 74.9375em) { .top-bar.stacked-for-large .top-bar-left, .top-bar.stacked-for-large .top-bar-right { width: 100%; } } .top-bar-title { display: inline-block; float: left; padding: 0.5rem 1rem 0.5rem 0; } .top-bar-title .menu-icon { bottom: 2px; } .top-bar-left { float: left; } .top-bar-right { float: right; } .hide { display: none !important; } .invisible { visibility: hidden; } @media screen and (max-width: 39.9375em) { .hide-for-small-only { display: none !important; } } @media screen and (max-width: 0em), screen and (min-width: 40em) { .show-for-small-only { display: none !important; } } @media print, screen and (min-width: 40em) { .hide-for-medium { display: none !important; } } @media screen and (max-width: 39.9375em) { .show-for-medium { display: none !important; } } @media screen and (min-width: 40em) and (max-width: 63.9375em) { .hide-for-medium-only { display: none !important; } } @media screen and (max-width: 39.9375em), screen and (min-width: 64em) { .show-for-medium-only { display: none !important; } } @media print, screen and (min-width: 64em) { .hide-for-large { display: none !important; } } @media screen and (max-width: 63.9375em) { .show-for-large { display: none !important; } } @media screen and (min-width: 64em) and (max-width: 74.9375em) { .hide-for-large-only { display: none !important; } } @media screen and (max-width: 63.9375em), screen and (min-width: 75em) { .show-for-large-only { display: none !important; } } .show-for-sr, .show-on-focus { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); } .show-on-focus:active, .show-on-focus:focus { position: static !important; width: auto; height: auto; overflow: visible; clip: auto; } .show-for-landscape, .hide-for-portrait { display: block !important; } @media screen and (orientation: landscape) { .show-for-landscape, .hide-for-portrait { display: block !important; } } @media screen and (orientation: portrait) { .show-for-landscape, .hide-for-portrait { display: none !important; } } .hide-for-landscape, .show-for-portrait { display: none !important; } @media screen and (orientation: landscape) { .hide-for-landscape, .show-for-portrait { display: none !important; } } @media screen and (orientation: portrait) { .hide-for-landscape, .show-for-portrait { display: block !important; } } .float-left { float: left !important; } .float-right { float: right !important; } .float-center { display: block; margin-right: auto; margin-left: auto; } .clearfix::before, .clearfix::after { display: table; content: ' '; } .clearfix::after { clear: both; } /*# sourceMappingURL=foundation.css.map */ diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 83186c2939..832159580a 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -2,15 +2,16 @@

    - Media Spotlight: <%= @top_work.title %> by <%= @top_work.creator%> + Media Spotlight: + <%= link_to @top_work.title, work_path(@top_work)%> by <%= @top_work.creator%>

    <%= @top_work_votes.count %> votes - <%= @top_work.description %>

    -
    -
    +
    +

    Top Albums

    @@ -30,7 +31,7 @@

-
+

Top Movies

    <% top_10('movie').each do |movie| %> @@ -48,7 +49,7 @@
-
+

Top Books

diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 03b0de92e5..590afae19d 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -1,6 +1,6 @@ -
+
-

+

<%= link_to 'Media Ranker', root_path %> Ranking the Best of Everything @@ -9,7 +9,7 @@ -

<% flash.each do |key, value|%> -
+

<%= value %>

<% end %> From 179377bb80ad13e724eda5e734ad3af5a676b59a Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Sat, 14 Oct 2017 23:26:16 -0700 Subject: [PATCH 26/40] adding css to works and user pages: --- app/assets/stylesheets/application.css | 6 +- app/views/albums/edit.html.erb | 42 ---- app/views/albums/index.html.erb | 6 - app/views/albums/show.html.erb | 74 ------ app/views/books/index.html.erb | 2 - app/views/books/show.html.erb | 2 - app/views/movies/index.html.erb | 2 - app/views/movies/show.html.erb | 2 - app/views/users/index.html.erb | 39 +-- app/views/works/index.html.erb | 323 +++++++++++++------------ app/views/works/new.html.erb | 2 +- 11 files changed, 188 insertions(+), 312 deletions(-) delete mode 100644 app/views/albums/edit.html.erb delete mode 100644 app/views/albums/index.html.erb delete mode 100644 app/views/albums/show.html.erb delete mode 100644 app/views/books/index.html.erb delete mode 100644 app/views/books/show.html.erb delete mode 100644 app/views/movies/index.html.erb delete mode 100644 app/views/movies/show.html.erb diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 6f50255c0a..4f0e282376 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -26,7 +26,7 @@ header { body{ font-family: 'Gudea', sans-serif; - font-size: 1.5rem; + font-size: 1rem; } @@ -77,6 +77,10 @@ main{ padding-bottom: 2rem; } +li{ + list-style: none; +} + .success{ border-radius: 5px; background-color: #e6e6e6; diff --git a/app/views/albums/edit.html.erb b/app/views/albums/edit.html.erb deleted file mode 100644 index 7a1ed75516..0000000000 --- a/app/views/albums/edit.html.erb +++ /dev/null @@ -1,42 +0,0 @@ -
- - - - - -
- -<%= form_for @album do |form| %> - <%= form.label :category %> - <%= form.select :category, options_for_select['book', 'movie', 'album'] %> -
- <%= form.label :title %> - <%= form.text_field :title %> -
- <%= form.label :creator %> - <%= form.date_field :creator %> -
- <%= form.label :published %> - <%= form.check_box :published %> -
- <%= form.label :description %> - <%= form.check_box :description %> -
- - <%= form.submit "Update work"%> -<% end %> diff --git a/app/views/albums/index.html.erb b/app/views/albums/index.html.erb deleted file mode 100644 index cfdcb7690f..0000000000 --- a/app/views/albums/index.html.erb +++ /dev/null @@ -1,6 +0,0 @@ - -<% @albums.each do |album| %> -

- <%= link_to "#{album.title}", album_path(album)%>

- -<%end%> diff --git a/app/views/albums/show.html.erb b/app/views/albums/show.html.erb deleted file mode 100644 index c6b931dd43..0000000000 --- a/app/views/albums/show.html.erb +++ /dev/null @@ -1,74 +0,0 @@ -
- - - - - -
- -
-

- <%= @album.title %> -

- -

- Created by <%= @album.creator %> -

- -

- Published: <%= @album.published %> -

- -

- <%= @album.description %> -

-
- -
-

- <%= @votes.count %> Votes for this Album -

- - - - - - - - - - <% @votes.each do |vote| %> - - - - - <% end %> - - -
UserDate
<%= find_user(vote.user_id)%> <%= vote.date %>
- - - -
- - diff --git a/app/views/books/index.html.erb b/app/views/books/index.html.erb deleted file mode 100644 index 7c71019039..0000000000 --- a/app/views/books/index.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

Book#index

-

Find me in app/views/book/index.html.erb

diff --git a/app/views/books/show.html.erb b/app/views/books/show.html.erb deleted file mode 100644 index 1522c39719..0000000000 --- a/app/views/books/show.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

Movie#index

-

Find me in app/views/movie/index.html.erb

diff --git a/app/views/movies/index.html.erb b/app/views/movies/index.html.erb deleted file mode 100644 index 1522c39719..0000000000 --- a/app/views/movies/index.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

Movie#index

-

Find me in app/views/movie/index.html.erb

diff --git a/app/views/movies/show.html.erb b/app/views/movies/show.html.erb deleted file mode 100644 index 1522c39719..0000000000 --- a/app/views/movies/show.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -

Movie#index

-

Find me in app/views/movie/index.html.erb

diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index e777bc7972..15ddda10e8 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1,22 +1,23 @@ <%= render partial: 'layouts/header' %> +
+

List of Users

+ + + + + + -

List of Users

-
Username Votes Joined
- - - - - + + <% @users.each do |user| %> + + + + + + <% end %> + +
Username Votes Joined
<%= link_to user.name, user_path(user) %> <%= votes_for_users(user) %> <%= user.joined_on %>
- - <% @users.each do |user| %> - - <%= link_to user.name, user_path(user) %> - <%= votes_for_users(user) %> - <%= user.joined_on %> - - <% end %> - - - -<%= link_to 'Back to Media List', root_path %> + <%= link_to 'Back to Media List', root_path, :class => 'button' %> +
diff --git a/app/views/works/index.html.erb b/app/views/works/index.html.erb index 33f876c8b1..78506467ef 100644 --- a/app/views/works/index.html.erb +++ b/app/views/works/index.html.erb @@ -1,164 +1,165 @@ <%= render partial: 'layouts/header' %> - -

List of works

- -
-

- Albums -

- - - - - - - - - - - - <% @albums.each do |album| %> - - - - - - - - - - - - <% end %> - -
- Votes - - Title - - Created By - - Published - - Upvote -
- <%= votes_for_work(album) %> - - <%= link_to album.title, work_path(album) %> - - <%= album.creator %> - - <%= album.published %> - - <%= link_to 'Upvote', upvote_work_path(album), method: :post %> -
-
- -
-

- books -

- - - - - - - - - - - - <% @books.each do |book| %> - - - - - - - - - - - - <% end %> - -
- Votes - - Title - - Created By - - Published - - Upvote -
- <%= votes_for_work(book) %> - - <%= link_to book.title, work_path(book) %> - - <%= book.creator %> - - <%= book.published %> - - <%= link_to 'Upvote', upvote_work_path(book), method: :post %> -
-
- -
-

- Movie -

- - - - - - - - - - - - <% @movies.each do |movie| %> - - - - - - - - - - - - <% end %> - -
- Votes - - Title - - Created By - - Published - - Upvote -
- <%= votes_for_work(movie) %> - - <%= link_to movie.title, work_path(movie) %> - - <%= movie.creator %> - - <%= movie.published %> - - <%= link_to 'Upvote', upvote_work_path(movie), method: :post %> -
-
- -<%= link_to 'View top media', root_path %> -<%= link_to 'Add a new work', new_work_path %> +
+

List of works

+ +
+

+ Albums +

+ + + + + + + + + + + + <% @albums.each do |album| %> + + + + + + + + + + + + <% end %> + +
+ Votes + + Title + + Created By + + Published + + Upvote +
+ <%= votes_for_work(album) %> + + <%= link_to album.title, work_path(album) %> + + <%= album.creator %> + + <%= album.published %> + + <%= link_to 'Upvote', upvote_work_path(album), method: :post, :class => 'button' %> +
+
+ +
+

+ Books +

+ + + + + + + + + + + + <% @books.each do |book| %> + + + + + + + + + + + + <% end %> + +
+ Votes + + Title + + Created By + + Published + + Upvote +
+ <%= votes_for_work(book) %> + + <%= link_to book.title, work_path(book) %> + + <%= book.creator %> + + <%= book.published %> + + <%= link_to 'Upvote', upvote_work_path(book), method: :post %> +
+
+ +
+

+ Movies +

+ + + + + + + + + + + + <% @movies.each do |movie| %> + + + + + + + + + + + + <% end %> + +
+ Votes + + Title + + Created By + + Published + + Upvote +
+ <%= votes_for_work(movie) %> + + <%= link_to movie.title, work_path(movie) %> + + <%= movie.creator %> + + <%= movie.published %> + + <%= link_to 'Upvote', upvote_work_path(movie), method: :post %> +
+
+ + <%= link_to 'View top media', root_path, :class => 'button' %> + <%= link_to 'Add a new work', new_work_path, :class => 'button'%> +
diff --git a/app/views/works/new.html.erb b/app/views/works/new.html.erb index 6c3e1b2cdf..273ccfc6f7 100644 --- a/app/views/works/new.html.erb +++ b/app/views/works/new.html.erb @@ -20,7 +20,7 @@ <%= f.text_area :description %>
- <%= f.submit %> + <%= f.submit :class => 'button'%> <% end %> From 5cb91da2f8bcceb66e622c7de25a1c56b58f83a0 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Sat, 14 Oct 2017 23:35:27 -0700 Subject: [PATCH 27/40] updating more CSS --- app/assets/stylesheets/application.css | 26 +++--------- app/views/layouts/_header.html.erb | 2 +- app/views/sessions/new.html.erb | 14 +++--- app/views/users/show.html.erb | 59 ++++++++++++++------------ 4 files changed, 46 insertions(+), 55 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 4f0e282376..2d0922b472 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -15,12 +15,12 @@ */ -header { - background-color: #B2DfDB; - max-width: 100%; - border-bottom: 1px solid #EEEEEE; - padding: 25px 20px 10px 20px; -} + .header { + background-color: #B2DfDB; + border-bottom: 1px solid #EEEEEE; + max-width: 100%; + padding: 25px 20px 25px 20px; + } @@ -31,13 +31,6 @@ body{ - header { - - background-color: #B2DfDB; - max-width: 100%; - border-bottom: 1px solid #EEEEEE; - padding: 25px 20px 10px 20px; - } header h2 { margin-left: 15%; @@ -69,13 +62,6 @@ a, h3{ color: #26a69a; } -main{ - max-width: 75rem; - margin-left: auto; - margin-right: auto; - padding-top: 2rem; - padding-bottom: 2rem; -} li{ list-style: none; diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 590afae19d..8c4146be07 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -1,4 +1,4 @@ -
+

<%= link_to 'Media Ranker', root_path %> diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index 9af44ee27c..11f7fd1b4c 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -1,9 +1,11 @@ <%= render partial: 'layouts/header' %> -

Log In

-<%= form_tag sessions_path do %> - <%= label_tag :name %> - <%= text_field_tag :name %> +
+

Log In

+ <%= form_tag sessions_path do %> + <%= label_tag :username %> + <%= text_field_tag :name %> - <%= submit_tag 'Log In' %> -<% end %> + <%= submit_tag 'Log In', :class => 'button' %> + <% end %> +
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 5d19cbc57f..02078d5b22 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,36 +1,39 @@ <%= render partial: 'layouts/header' %> -

User Summary: - <%= link_to @user.name, user_path(@user) %> -

+
+

User Summary: + <%= link_to @user.name, user_path(@user) %> +

-

- Joined site <%= @user.joined_on %> -

+

+ Joined site <%= @user.joined_on %> +

-

Votes

+

Votes

- - - - - - - - - - - - <% user_cast_votes(@user).each do |vote| %> +
Media Title Created By Published Category Voted On
+ - - - - - + + + + + - <% end %> - -
<%= link_to get_title(vote.work_id), work_path(vote.work_id) %> <%= get_creator(vote.work_id) %> <%- get_published(vote.work_id) %> <%= vote.category %> <%= vote.date %> Media Title Created By Published Category Voted On
+ + + <% user_cast_votes(@user).each do |vote| %> + + <%= link_to get_title(vote.work_id), work_path(vote.work_id) %> + <%= get_creator(vote.work_id) %> + <%- get_published(vote.work_id) %> + <%= vote.category %> + <%= vote.date %> + + <% end %> + + -<%= link_to 'Back to Media List', root_path %> + <%= link_to 'See all Users', users_path, :class => 'button'%> + <%= link_to 'Back to Media List', root_path, :class => 'button' %> +
From 825c414f4314daeb745a63706c4d78ae3a69c917 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Sat, 14 Oct 2017 23:43:10 -0700 Subject: [PATCH 28/40] final CSS updates to media viewer --- app/assets/stylesheets/application.css | 17 +++++ app/views/works/show.html.erb | 94 ++++++++++++++------------ 2 files changed, 66 insertions(+), 45 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 2d0922b472..8e8293c985 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -20,6 +20,7 @@ border-bottom: 1px solid #EEEEEE; max-width: 100%; padding: 25px 20px 25px 20px; + margin-bottom: 20px; } @@ -151,3 +152,19 @@ li{ .top_10 p{ font-size: 1rem; } + +.red_button { + background-color: #cc4b37; + display: inline-block; + vertical-align: middle; + margin: 1px; + padding: 0.85em 1em; + -webkit-appearance: none; + border: 1px solid transparent; + border-radius: 0; + font-size: 0.9rem; + line-height: 1; + text-align: center; + cursor: pointer; + color: #fefefe; +} diff --git a/app/views/works/show.html.erb b/app/views/works/show.html.erb index cd9f6b8f21..18006d9b29 100644 --- a/app/views/works/show.html.erb +++ b/app/views/works/show.html.erb @@ -1,52 +1,56 @@ <%= render partial: 'layouts/header' %> -
-

- <%= @work.title %> -

- -

- Created by <%= @work.creator %> -

- -

- Published: <%= @work.published %> -

- -

- <%= @work.description %> -

-
- -
-

- <%= @votes.count %> Votes for this work -

- - - - - - - - - - <% @votes.each do |vote| %> - - - +
+
+

+ <%= @work.title %> +

+ +

+ Created by <%= @work.creator %> +

+ +

+ Published: <%= @work.published %> +

+ +

+ <%= @work.description %> +

+ + +
+ +
+

+ <%= @votes.count %> Votes for this work +

+ +
UserDate
<%= link_to find_user(vote.user_id), user_path(vote.user_id)%> <%= vote.date %>
+ + + + - <% end %> - -
UserDate
-
+ + <% @votes.each do |vote| %> + + <%= link_to find_user(vote.user_id), user_path(vote.user_id)%> + <%= vote.date %> + + <% end %> + + +
- + + + From 8ca913353ebd1ccb686ce0d46e9b2ce4ab258a37 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Sat, 14 Oct 2017 23:45:31 -0700 Subject: [PATCH 29/40] minor CSS tweaks --- app/assets/stylesheets/application.css | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 8e8293c985..c314c5371d 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -73,6 +73,7 @@ li{ background-color: #e6e6e6; padding: 20px 25px; margin-top: 30px; + margin-bottom: 20px; } From 55ac40b1914854eaf157dc77856ead9b02ee59c7 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Sun, 15 Oct 2017 00:01:49 -0700 Subject: [PATCH 30/40] final flash updates on deletion --- app/assets/stylesheets/application.css | 16 ++++++++++++++++ app/controllers/works_controller.rb | 12 +++++++++--- app/views/layouts/_header.html.erb | 12 +++++++++--- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index c314c5371d..2259b0cee1 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -77,6 +77,22 @@ li{ } +.failure{ + border-radius: 5px; + background-color: #e6e6e6; + padding: 20px 25px; + margin-top: 30px; + margin-bottom: 20px; + +} + +.failure h3{ + font-weight: normal; + font-size: 1em; + color: #c70039; + +} + .success h3{ font-weight: normal; font-size: 1em; diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb index df6874aee7..cb262fc35a 100644 --- a/app/controllers/works_controller.rb +++ b/app/controllers/works_controller.rb @@ -9,9 +9,15 @@ def index def destroy @work = Work.find(params[:id]) - @work.destroy + @votes = Vote.where(work_id: @work.id) - redirect_to works_path + @votes.each do |vote| + vote.destory + end + + @work.destroy + flash[:deleted] = "Successfully destoryed #{@work.category} #{@work.id}" + redirect_to root_path end def show @@ -38,7 +44,7 @@ def upvote @work = Work.find(params[:id]) @user_id = session[:user_id] if session[:user_id] == nil - flash[:notice] = 'You must log in to do that' + flash[:failure] = 'You must log in to do that' else @check = Vote.where(user_id: session[:user_id], work_id: @work.id) if @check == nil diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 8c4146be07..c554a8f2a7 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -29,7 +29,13 @@ <% flash.each do |key, value|%> -
-

<%= value %>

-
+ <% if key == 'notice' || key == 'deleted' %> +
+

<%= value %>

+
+ <% elsif key == 'deleted' %> +
+

<%= value %>

+
+ <% end %> <% end %> From c0adc9ca0d8316b6d8e482fa03f9790dcb3d4ef0 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Mon, 16 Oct 2017 03:51:58 -0700 Subject: [PATCH 31/40] fixing issues with queries --- app/controllers/albums_controller.rb | 10 ---- app/controllers/books_controller.rb | 4 -- app/controllers/home_controller.rb | 2 +- app/controllers/logins_controller.rb | 5 -- app/controllers/movies_controller.rb | 4 -- app/controllers/sessions_controller.rb | 4 ++ app/helpers/album_helper.rb | 2 - app/helpers/application_helper.rb | 8 +-- app/helpers/book_helper.rb | 2 - app/helpers/movie_helper.rb | 2 - app/views/logins/index.html.erb | 10 ---- db/media_seeds.csv | 59 +++++++++++--------- db/seeds.rb | 33 ++++++++++- db/users_seed.csv | 11 ++++ db/vote_seed.csv | 37 ++++++++++++ test/application_system_test_case.rb | 2 +- test/controllers/album_controller_test.rb | 9 --- test/controllers/book_controller_test.rb | 9 --- test/controllers/movie_controller_test.rb | 9 --- test/controllers/sessions_controller_test.rb | 2 +- test/controllers/user_controller_test.rb | 7 ++- test/controllers/work_controller_test.rb | 15 +++++ test/models/album_test.rb | 7 --- test/models/book_test.rb | 7 --- test/models/movie_test.rb | 7 --- test/models/user_test.rb | 7 ++- 26 files changed, 146 insertions(+), 128 deletions(-) delete mode 100644 app/controllers/albums_controller.rb delete mode 100644 app/controllers/books_controller.rb delete mode 100644 app/controllers/logins_controller.rb delete mode 100644 app/controllers/movies_controller.rb delete mode 100644 app/helpers/album_helper.rb delete mode 100644 app/helpers/book_helper.rb delete mode 100644 app/helpers/movie_helper.rb delete mode 100644 app/views/logins/index.html.erb create mode 100644 db/users_seed.csv create mode 100644 db/vote_seed.csv delete mode 100644 test/controllers/album_controller_test.rb delete mode 100644 test/controllers/book_controller_test.rb delete mode 100644 test/controllers/movie_controller_test.rb create mode 100644 test/controllers/work_controller_test.rb delete mode 100644 test/models/album_test.rb delete mode 100644 test/models/book_test.rb delete mode 100644 test/models/movie_test.rb diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb deleted file mode 100644 index e9d70a9b92..0000000000 --- a/app/controllers/albums_controller.rb +++ /dev/null @@ -1,10 +0,0 @@ -class AlbumsController < ApplicationController - def show - @album = Album.find(params[:id]) - @votes = Vote.where(work_id: @album.id) - end - - def edit - @album = Album.find(params[:id]) - end -end diff --git a/app/controllers/books_controller.rb b/app/controllers/books_controller.rb deleted file mode 100644 index c14e900612..0000000000 --- a/app/controllers/books_controller.rb +++ /dev/null @@ -1,4 +0,0 @@ -class BooksController < ApplicationController - def index - end -end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 5e54203379..c11c7a635e 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,6 +1,6 @@ class HomeController < ApplicationController def index - @top_work_id = Vote.limit(1).group(:work_id).order('count_work_id DESC').count('work_id') + @top_work_id = Vote.limit(1).group(:work_id).count @top_work = Work.find(@top_work_id.keys[0]) @top_work_votes = Vote.where(work_id: @top_work_id.keys[0]) end diff --git a/app/controllers/logins_controller.rb b/app/controllers/logins_controller.rb deleted file mode 100644 index a76396785c..0000000000 --- a/app/controllers/logins_controller.rb +++ /dev/null @@ -1,5 +0,0 @@ -class LoginsController < ApplicationController - def index - - end -end diff --git a/app/controllers/movies_controller.rb b/app/controllers/movies_controller.rb deleted file mode 100644 index b5ecfec7ca..0000000000 --- a/app/controllers/movies_controller.rb +++ /dev/null @@ -1,4 +0,0 @@ -class MoviesController < ApplicationController - def index - end -end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 3482c32223..2d4c80414e 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -4,6 +4,10 @@ def new end def create + if params[:name] == "" + redirect_to :back + end + user = User.find_by(name: params[:name]) if user diff --git a/app/helpers/album_helper.rb b/app/helpers/album_helper.rb deleted file mode 100644 index 23ace66827..0000000000 --- a/app/helpers/album_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module AlbumHelper -end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 243aa822af..15d438f6db 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,6 +1,6 @@ module ApplicationHelper def find_user(id) - return User.find(id).name + return User.find(id.to_i).name end def votes_for_work(work) @@ -9,9 +9,9 @@ def votes_for_work(work) def top_10(category) result = [] - @top_works = Vote.limit(10).select('work_id, count(*) as count').where(category: category).group('work_id').order('count DESC') - @top_works.each do |work| - result << Work.find(work.work_id) + @top_works = Vote.limit(10).where("category= '#{category}'").group(:work_id).count + @top_works.keys.each do |work| + result << Work.find(work) end return result end diff --git a/app/helpers/book_helper.rb b/app/helpers/book_helper.rb deleted file mode 100644 index 2b0a0ca787..0000000000 --- a/app/helpers/book_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module BookHelper -end diff --git a/app/helpers/movie_helper.rb b/app/helpers/movie_helper.rb deleted file mode 100644 index abf580fa44..0000000000 --- a/app/helpers/movie_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module MovieHelper -end diff --git a/app/views/logins/index.html.erb b/app/views/logins/index.html.erb deleted file mode 100644 index 6a14935d9b..0000000000 --- a/app/views/logins/index.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -<%= render partial: 'layouts/header' %> - -

Log In

- - -<%= form_for :sessions, url:login_session_path do |f| %> - <%= f.label :name %> - <%= f.text_field :name %> - <%= f.submit 'Log In' %> -<% end %> diff --git a/db/media_seeds.csv b/db/media_seeds.csv index b5101408d0..fbe574b304 100644 --- a/db/media_seeds.csv +++ b/db/media_seeds.csv @@ -1,27 +1,32 @@ -category,title,creator,publication_year,description -album,Can't Buy a Thrill,Steely Dan,1972, -album,Countdown to Ecstasy,Steely Dan,1973, -album,Pretzel Logic,Steely Dan,1974, -album,Katy Lied,Steely Dan,1975, -album,The Royal Scam,Steely Dan,1976, -album,Aja,Steely Dan,1977, -album,Gaucho,Steely Dan,1980, -album,Silence Yourself,Savages,2013, -album,Adore Life,Savages,2016, -album,NVM,Tacocat,2014, -album,Lost Time,Tacocat,2016, -album,No Regrets,Chastity Belt,2013, -album,Time to Go Home,Chastity Belt,2015, -album,Sleater-Kinney,Sleater-Kinney,1995, -album,Call the Doctor,Sleater-Kinney,1996, -album,Dig Me Out,Sleater-Kinney,1997, -album,The Hot Rock,Sleater-Kinney,1999, -album,All Hands on the Bad One,Sleater-Kinney,2000, -album,One Beat,Sleater-Kinney,2002, -album,The Woods,Sleater-Kinney,2005, -album,No Cities to Love,Sleater-Kinney,2015, -book,Hidden Figures,Margot Lee Shetterly,2016,Good book that came before the movie -book,Practical Object-Oriented Design in Ruby,Sandi Metz,2012,Good programming book -book,Kindred,Octavia E. Butler,1979,Good sci-fi book -book,Parable of the Sower,Octavia E. Butler,1993, -book,A Wizard of Earthsea,Ursula K. Leguin,1968, \ No newline at end of file +id,category,title,creator,publication_year,description +1,album,Can't Buy a Thrill,Steely Dan,1972, +2,album,Countdown to Ecstasy,Steely Dan,1973, +3,album,Pretzel Logic,Steely Dan,1974, +4,album,Katy Lied,Steely Dan,1975, +5,album,The Royal Scam,Steely Dan,1976, +6,album,Aja,Steely Dan,1977, +7,album,Gaucho,Steely Dan,1980, +8,album,Silence Yourself,Savages,2013, +9,album,Adore Life,Savages,2016, +10,album,NVM,Tacocat,2014, +11,album,Lost Time,Tacocat,2016, +12,movie,No Regrets,Chastity Belt,2013, +13,movie,Time to Go Home,Chastity Belt,2015, +14,movie,Sleater-Kinney,Sleater-Kinney,1995, +15,movie,Call the Doctor,Sleater-Kinney,1996, +16,movie,Dig Me Out,Sleater-Kinney,1997, +17,movie,The Hot Rock,Sleater-Kinney,1999, +18,movie,All Hands on the Bad One,Sleater-Kinney,2000, +19,movie,One Beat,Sleater-Kinney,2002, +20,movie,The Woods,Sleater-Kinney,2005, +21,movie,No Cities to Love,Sleater-Kinney,2015, +22,book,Hidden Figures,Margot Lee Shetterly,2016,Good book that came before the movie +23,book,Practical Object-Oriented Design in Ruby,Sandi Metz,2012,Good programming book +24,book,Kindred,Octavia E. Butler,1979,Good sci-fi book +25,book,Parable of the Sower,Octavia E. Butler,1993, +26,book,book1,Ursula K. Leguin,1968, +27,book,book2,Ursula K. Leguin,1968, +28,book,book3,Ursula K. Leguin,1968, +29,book,book4,Ursula K. Leguin,1968, +30,book,book5,Ursula K. Leguin,1968, +31,book,book6,Ursula K. Leguin,1968, diff --git a/db/seeds.rb b/db/seeds.rb index a570a32874..b248d6c4ae 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,5 +1,6 @@ require 'csv' require 'rails' +require 'date' puts Rails.root @@ -21,5 +22,33 @@ end end -puts "Added #{Work.count} driver records" -puts "#{driver_failures.length} drivers failed to save" +VOTE_FILE = Rails.root.join('db', 'vote_seed.csv') +vote_failures = [] +CSV.foreach(VOTE_FILE, :headers => true) do |row| + vote = Vote.new + vote.id = row['id'] + vote.category = row['category'] + vote.work_id = row['work_id'] + vote.user_id = row['user_id'] + vote.date = Date.today + puts "Created Album: #{vote.inspect}" + successful = vote.save + if !successful + vote_failures << vote + end +end + + +USER_FILE = Rails.root.join('db', 'users_seed.csv') +user_failures = [] +CSV.foreach(USER_FILE, :headers => true) do |row| + user = User.new + user.id = row['id'] + user.name = row['name'] + user.joined_on = Date.today + puts "Created Album: #{user.inspect}" + successful = user.save + if !successful + user_failures << user + end +end diff --git a/db/users_seed.csv b/db/users_seed.csv new file mode 100644 index 0000000000..eea13f1b6a --- /dev/null +++ b/db/users_seed.csv @@ -0,0 +1,11 @@ +id,name,joined_on +1,josh,2017-10-01, +2,john,2017-10-01, +3,sue,2017-10-01, +4,lindsey,2017-10-01, +5,mary,2017-10-01, +6,suzzie,2017-10-01, +7,rachael,2017-10-01, +8,laura,2017-10-01, +9,jon,2017-10-01, +10,rachael,2017-10-01, diff --git a/db/vote_seed.csv b/db/vote_seed.csv new file mode 100644 index 0000000000..d81e6b22fb --- /dev/null +++ b/db/vote_seed.csv @@ -0,0 +1,37 @@ +category,work_id,user_id +album,1,1, +album,1,2, +album,1,3, +album,2,2, +album,3,3, +album,4,4, +album,5,1, +album,6,2, +album,7,3, +album,8,1, +album,9,1, +album,10,2, +book,11,1, +book,11,2, +book,11,3, +book,12,2, +book,13,3, +book,14,4, +book,15,1, +book,16,2, +book,17,3, +book,18,1, +book,19,1, +book,20,2, +movie,21,1, +movie,21,2, +movie,21,3, +movie,22,2, +movie,23,3, +movie,24,4, +movie,25,1, +movie,26,2, +movie,27,3, +movie,28,1, +movie,29,1, +movie,30,2, diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index d19212abd5..45331171d7 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -1,4 +1,4 @@ -require "test_helper" +require "./test/test_helper" class ApplicationSystemTestCase < ActionDispatch::SystemTestCase driven_by :selenium, using: :chrome, screen_size: [1400, 1400] diff --git a/test/controllers/album_controller_test.rb b/test/controllers/album_controller_test.rb deleted file mode 100644 index cd2a6daf45..0000000000 --- a/test/controllers/album_controller_test.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'test_helper' - -class AlbumControllerTest < ActionDispatch::IntegrationTest - test "should get index" do - get album_index_url - assert_response :success - end - -end diff --git a/test/controllers/book_controller_test.rb b/test/controllers/book_controller_test.rb deleted file mode 100644 index e4ef75f1fb..0000000000 --- a/test/controllers/book_controller_test.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'test_helper' - -class BookControllerTest < ActionDispatch::IntegrationTest - test "should get index" do - get book_index_url - assert_response :success - end - -end diff --git a/test/controllers/movie_controller_test.rb b/test/controllers/movie_controller_test.rb deleted file mode 100644 index 8399764748..0000000000 --- a/test/controllers/movie_controller_test.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'test_helper' - -class MovieControllerTest < ActionDispatch::IntegrationTest - test "should get index" do - get movie_index_url - assert_response :success - end - -end diff --git a/test/controllers/sessions_controller_test.rb b/test/controllers/sessions_controller_test.rb index 6135ce6afc..707e647cb3 100644 --- a/test/controllers/sessions_controller_test.rb +++ b/test/controllers/sessions_controller_test.rb @@ -1,4 +1,4 @@ -require 'test_helper' +require './test/test_helper' class SessionsControllerTest < ActionDispatch::IntegrationTest # test "the truth" do diff --git a/test/controllers/user_controller_test.rb b/test/controllers/user_controller_test.rb index 62207343f5..63c94285c5 100644 --- a/test/controllers/user_controller_test.rb +++ b/test/controllers/user_controller_test.rb @@ -1,9 +1,12 @@ -require 'test_helper' +require './test/test_helper' class UserControllerTest < ActionDispatch::IntegrationTest +=begin test "should get index" do - get user_index_url + get '/users' assert_response :success + end +=end end diff --git a/test/controllers/work_controller_test.rb b/test/controllers/work_controller_test.rb new file mode 100644 index 0000000000..763dee3106 --- /dev/null +++ b/test/controllers/work_controller_test.rb @@ -0,0 +1,15 @@ +require './test/test_helper' + +class WorkControllerTest < ActionDispatch::IntegrationTest + + test "should get work index" do + get works_url + assert_response :success + end + + test "can see welcome page" do + get '/' + assert_select + end + +end diff --git a/test/models/album_test.rb b/test/models/album_test.rb deleted file mode 100644 index 1efcda03fb..0000000000 --- a/test/models/album_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class AlbumTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/models/book_test.rb b/test/models/book_test.rb deleted file mode 100644 index e48079d4f7..0000000000 --- a/test/models/book_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class BookTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/models/movie_test.rb b/test/models/movie_test.rb deleted file mode 100644 index 22d7084689..0000000000 --- a/test/models/movie_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class MovieTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/models/user_test.rb b/test/models/user_test.rb index 82f61e0109..f87e70f9d0 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -1,7 +1,8 @@ require 'test_helper' class UserTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end + test "make new user" do + user = User.new + + end end From f397f299315b7b62605a9a79bfe985459efbc01a Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Mon, 16 Oct 2017 04:32:48 -0700 Subject: [PATCH 32/40] removing tables --- app/models/album.rb | 2 -- app/models/book.rb | 2 -- app/models/movie.rb | 2 -- app/models/user.rb | 1 + app/models/vote.rb | 1 + app/models/work.rb | 2 ++ db/migrate/20171011040258_create_users.rb | 4 +-- db/migrate/20171011040511_create_movies.rb | 12 -------- db/migrate/20171011040524_create_books.rb | 12 -------- db/migrate/20171011040535_create_albums.rb | 12 -------- db/migrate/20171013181157_create_works.rb | 8 ++--- .../20171016111722_change_column_to_user.rb | 18 ++++++++++++ db/migrate/20171016111733_drop_tables.rb | 8 +++++ .../20171016112948_drop_unused_tables.rb | 7 +++++ db/schema.rb | 29 +------------------ false | 2 ++ test/models/user_test.rb | 7 +++-- test/models/vote_test.rb | 2 +- test/models/work_test.rb | 8 ++--- 19 files changed, 56 insertions(+), 83 deletions(-) delete mode 100644 app/models/album.rb delete mode 100644 app/models/book.rb delete mode 100644 app/models/movie.rb delete mode 100644 db/migrate/20171011040511_create_movies.rb delete mode 100644 db/migrate/20171011040524_create_books.rb delete mode 100644 db/migrate/20171011040535_create_albums.rb create mode 100644 db/migrate/20171016111722_change_column_to_user.rb create mode 100644 db/migrate/20171016111733_drop_tables.rb create mode 100644 db/migrate/20171016112948_drop_unused_tables.rb create mode 100644 false diff --git a/app/models/album.rb b/app/models/album.rb deleted file mode 100644 index 9153b4079a..0000000000 --- a/app/models/album.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Album < ApplicationRecord -end diff --git a/app/models/book.rb b/app/models/book.rb deleted file mode 100644 index 03d56b43cc..0000000000 --- a/app/models/book.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Book < ApplicationRecord -end diff --git a/app/models/movie.rb b/app/models/movie.rb deleted file mode 100644 index dc614df15f..0000000000 --- a/app/models/movie.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Movie < ApplicationRecord -end diff --git a/app/models/user.rb b/app/models/user.rb index 379658a509..e69ba9ce3f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,2 +1,3 @@ class User < ApplicationRecord + validates :name, :joined_on, presence: true end diff --git a/app/models/vote.rb b/app/models/vote.rb index 4c58e4f3d5..cd77542c74 100644 --- a/app/models/vote.rb +++ b/app/models/vote.rb @@ -1,2 +1,3 @@ class Vote < ApplicationRecord + validates :user_id, :work_id, :category, presence: true end diff --git a/app/models/work.rb b/app/models/work.rb index 95322dd45e..5bd064d516 100644 --- a/app/models/work.rb +++ b/app/models/work.rb @@ -1,2 +1,4 @@ class Work < ApplicationRecord + validates :creator, :title, :published, :category, + :description, presence: true end diff --git a/db/migrate/20171011040258_create_users.rb b/db/migrate/20171011040258_create_users.rb index 4def90374b..a33600682b 100644 --- a/db/migrate/20171011040258_create_users.rb +++ b/db/migrate/20171011040258_create_users.rb @@ -1,8 +1,8 @@ class CreateUsers < ActiveRecord::Migration[5.1] def change create_table :users do |t| - t.string :name - t.date :joined_on + t.string :name, + t.date :joined_on, t.timestamps end diff --git a/db/migrate/20171011040511_create_movies.rb b/db/migrate/20171011040511_create_movies.rb deleted file mode 100644 index 351bca0f15..0000000000 --- a/db/migrate/20171011040511_create_movies.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateMovies < ActiveRecord::Migration[5.1] - def change - create_table :movies do |t| - t.string :title - t.string :creator - t.date :published - t.string :description - - t.timestamps - end - end -end diff --git a/db/migrate/20171011040524_create_books.rb b/db/migrate/20171011040524_create_books.rb deleted file mode 100644 index 057396d9b6..0000000000 --- a/db/migrate/20171011040524_create_books.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateBooks < ActiveRecord::Migration[5.1] - def change - create_table :books do |t| - t.string :title - t.string :creator - t.date :published - t.string :description - - t.timestamps - end - end -end diff --git a/db/migrate/20171011040535_create_albums.rb b/db/migrate/20171011040535_create_albums.rb deleted file mode 100644 index 74c2fa634b..0000000000 --- a/db/migrate/20171011040535_create_albums.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateAlbums < ActiveRecord::Migration[5.1] - def change - create_table :albums do |t| - t.string :title - t.string :creator - t.date :published - t.string :description - - t.timestamps - end - end -end diff --git a/db/migrate/20171013181157_create_works.rb b/db/migrate/20171013181157_create_works.rb index 64312307b7..319e014717 100644 --- a/db/migrate/20171013181157_create_works.rb +++ b/db/migrate/20171013181157_create_works.rb @@ -1,10 +1,10 @@ class CreateWorks < ActiveRecord::Migration[5.1] def change create_table :works do |t| - t.string :category - t.string :title - t.string :creator - t.string :published + t.string :category, null: false + t.string :title, null: false + t.string :creator, null: false + t.string :published, null: false t.text :description t.timestamps diff --git a/db/migrate/20171016111722_change_column_to_user.rb b/db/migrate/20171016111722_change_column_to_user.rb new file mode 100644 index 0000000000..ef03c9680c --- /dev/null +++ b/db/migrate/20171016111722_change_column_to_user.rb @@ -0,0 +1,18 @@ +class ChangeColumnToUser < ActiveRecord::Migration[5.1] + def change + change_column_null :users, :name, true + change_column_null :users, :joined_on, true + + change_column_null :votes, :category, true + change_column_null :votes, :work_id, true + change_column_null :votes, :user_id, true + change_column_null :votes, :date, true + + change_column_null :works, :title, true + change_column_null :works, :creator, true + change_column_null :works, :published, true + change_column_null :works, :category, true + + + end +end diff --git a/db/migrate/20171016111733_drop_tables.rb b/db/migrate/20171016111733_drop_tables.rb new file mode 100644 index 0000000000..2c8fc89506 --- /dev/null +++ b/db/migrate/20171016111733_drop_tables.rb @@ -0,0 +1,8 @@ +class DropTables < ActiveRecord::Migration[5.1] + def down + drop_table :albums + drop_table :books + drop_table :movies + + end +end diff --git a/db/migrate/20171016112948_drop_unused_tables.rb b/db/migrate/20171016112948_drop_unused_tables.rb new file mode 100644 index 0000000000..41cdc63877 --- /dev/null +++ b/db/migrate/20171016112948_drop_unused_tables.rb @@ -0,0 +1,7 @@ +class DropUnusedTables < ActiveRecord::Migration[5.1] + def change + drop_table :albums + drop_table :movies + drop_table :books + end +end diff --git a/db/schema.rb b/db/schema.rb index 6f76fa8973..989af5577d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,34 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20171013181157) do - - create_table "albums", force: :cascade do |t| - t.string "title" - t.string "creator" - t.date "published" - t.string "description" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "books", force: :cascade do |t| - t.string "title" - t.string "creator" - t.date "published" - t.string "description" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "movies", force: :cascade do |t| - t.string "title" - t.string "creator" - t.date "published" - t.string "description" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end +ActiveRecord::Schema.define(version: 20171016112948) do create_table "users", force: :cascade do |t| t.string "name" diff --git a/false b/false new file mode 100644 index 0000000000..92bdb38895 --- /dev/null +++ b/false @@ -0,0 +1,2 @@ + invoke active_record + create db/migrate/20171016111722_change_column_to_user.rb diff --git a/test/models/user_test.rb b/test/models/user_test.rb index f87e70f9d0..61492c5a8d 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -1,8 +1,11 @@ -require 'test_helper' +require './test/test_helper' class UserTest < ActiveSupport::TestCase + test "make new user" do user = User.new - + result = user.valid? + result.must_equal false end + end diff --git a/test/models/vote_test.rb b/test/models/vote_test.rb index f31f99299c..ff2c8489db 100644 --- a/test/models/vote_test.rb +++ b/test/models/vote_test.rb @@ -1,4 +1,4 @@ -require 'test_helper' +require './test/test_helper' class VoteTest < ActiveSupport::TestCase # test "the truth" do diff --git a/test/models/work_test.rb b/test/models/work_test.rb index b9047fab13..b87af78b8e 100644 --- a/test/models/work_test.rb +++ b/test/models/work_test.rb @@ -1,7 +1,7 @@ -require 'test_helper' +require './test/test_helper' class WorkTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end + test "the truth" do + assert true + end end From a5e9a7d1f7cd84a77c4024a409caae75f5ecf6f0 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Mon, 16 Oct 2017 05:57:06 -0700 Subject: [PATCH 33/40] saving tests for models --- Gemfile | 6 +++++ Gemfile.lock | 12 +++++++++ app/models/test.rb | 2 ++ config/application.rb | 4 ++- db/migrate/20171016124224_create_tests.rb | 8 ++++++ db/schema.rb | 7 ++++- test/controllers/user_controller_test.rb | 17 +++++++++++-- test/fixtures/albums.yml | 13 ---------- test/fixtures/books.yml | 13 ---------- test/fixtures/movies.yml | 13 ---------- test/fixtures/tests.yml | 11 ++++++++ test/models/test_test.rb | 9 +++++++ test/models/user_test.rb | 28 +++++++++++++++----- test/models/vote_test.rb | 29 ++++++++++++++++++--- test/models/work_test.rb | 31 ++++++++++++++++++++--- test/test_helper.rb | 14 +++++++--- 16 files changed, 157 insertions(+), 60 deletions(-) create mode 100644 app/models/test.rb create mode 100644 db/migrate/20171016124224_create_tests.rb delete mode 100644 test/fixtures/albums.yml delete mode 100644 test/fixtures/books.yml delete mode 100644 test/fixtures/movies.yml create mode 100644 test/fixtures/tests.yml create mode 100644 test/models/test_test.rb diff --git a/Gemfile b/Gemfile index d35de94c78..9fc5587bfc 100644 --- a/Gemfile +++ b/Gemfile @@ -25,6 +25,7 @@ gem 'coffee-rails', '~> 4.2' gem 'turbolinks', '~> 5' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.5' +gem "minitest-rails" # Use Redis adapter to run Action Cable in production # gem 'redis', '~> 3.0' # Use ActiveModel has_secure_password @@ -41,6 +42,11 @@ group :development, :test do gem 'selenium-webdriver' end +group :test do + gem 'minitest-rails' + gem 'minitest-reporters' +end + group :development do # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. gem 'web-console', '>= 3.3.0' diff --git a/Gemfile.lock b/Gemfile.lock index 86bfccda7b..4c5bed36c5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -40,6 +40,7 @@ GEM tzinfo (~> 1.1) addressable (2.5.2) public_suffix (>= 2.0.2, < 4.0) + ansi (1.5.0) arel (8.0.0) bindex (0.5.0) builder (3.2.3) @@ -83,6 +84,14 @@ GEM mini_mime (0.1.4) mini_portile2 (2.3.0) minitest (5.10.3) + minitest-rails (3.0.0) + minitest (~> 5.8) + railties (~> 5.0) + minitest-reporters (1.1.18) + ansi + builder + minitest (>= 5.0) + ruby-progressbar multi_json (1.12.2) nio4r (2.1.0) nokogiri (1.8.1-x86-mingw32) @@ -119,6 +128,7 @@ GEM rb-fsevent (0.10.2) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) + ruby-progressbar (1.9.0) rubyzip (1.2.1) sass (3.5.2) sass-listen (~> 4.0.0) @@ -173,6 +183,8 @@ DEPENDENCIES capybara (~> 2.13) coffee-rails (~> 4.2) jbuilder (~> 2.5) + minitest-rails + minitest-reporters puma (~> 3.7) rails (~> 5.1.4) sass-rails (~> 5.0) diff --git a/app/models/test.rb b/app/models/test.rb new file mode 100644 index 0000000000..fe0afa779b --- /dev/null +++ b/app/models/test.rb @@ -0,0 +1,2 @@ +class Test < ApplicationRecord +end diff --git a/config/application.rb b/config/application.rb index 610fb5d08c..27d7de0fa9 100644 --- a/config/application.rb +++ b/config/application.rb @@ -10,7 +10,9 @@ module MediaRanker class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 5.1 - + config.generators do |g| + g.test_framework :minitest, spec: true + end # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. diff --git a/db/migrate/20171016124224_create_tests.rb b/db/migrate/20171016124224_create_tests.rb new file mode 100644 index 0000000000..74c6e1888c --- /dev/null +++ b/db/migrate/20171016124224_create_tests.rb @@ -0,0 +1,8 @@ +class CreateTests < ActiveRecord::Migration[5.1] + def change + create_table :tests do |t| + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 989af5577d..f26a3a814c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,12 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20171016112948) do +ActiveRecord::Schema.define(version: 20171016124224) do + + create_table "tests", force: :cascade do |t| + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end create_table "users", force: :cascade do |t| t.string "name" diff --git a/test/controllers/user_controller_test.rb b/test/controllers/user_controller_test.rb index 63c94285c5..b05ada2229 100644 --- a/test/controllers/user_controller_test.rb +++ b/test/controllers/user_controller_test.rb @@ -1,12 +1,25 @@ require './test/test_helper' -class UserControllerTest < ActionDispatch::IntegrationTest + +describe UserController do + it 'should get index' do + get users_path + end +end + =begin +class UserControllerTest < ActionDispatch::IntegrationTest + test "should get index" do get '/users' assert_response :success end -=end + + test "get user data" do + get users_path(1) + must_respond_with :success + end end +=end diff --git a/test/fixtures/albums.yml b/test/fixtures/albums.yml deleted file mode 100644 index 214c6c5b4d..0000000000 --- a/test/fixtures/albums.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html - -one: - title: MyString - creator: MyString - published: 2017-10-10 - description: MyString - -two: - title: MyString - creator: MyString - published: 2017-10-10 - description: MyString diff --git a/test/fixtures/books.yml b/test/fixtures/books.yml deleted file mode 100644 index 214c6c5b4d..0000000000 --- a/test/fixtures/books.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html - -one: - title: MyString - creator: MyString - published: 2017-10-10 - description: MyString - -two: - title: MyString - creator: MyString - published: 2017-10-10 - description: MyString diff --git a/test/fixtures/movies.yml b/test/fixtures/movies.yml deleted file mode 100644 index 214c6c5b4d..0000000000 --- a/test/fixtures/movies.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html - -one: - title: MyString - creator: MyString - published: 2017-10-10 - description: MyString - -two: - title: MyString - creator: MyString - published: 2017-10-10 - description: MyString diff --git a/test/fixtures/tests.yml b/test/fixtures/tests.yml new file mode 100644 index 0000000000..dc3ee79b5d --- /dev/null +++ b/test/fixtures/tests.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the "{}" from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/models/test_test.rb b/test/models/test_test.rb new file mode 100644 index 0000000000..52272e1079 --- /dev/null +++ b/test/models/test_test.rb @@ -0,0 +1,9 @@ +require "./test/test_helper" + +describe Test do + let(:test) { Test.new } + + it "must be valid" do + value(test).must_be :valid? + end +end diff --git a/test/models/user_test.rb b/test/models/user_test.rb index 61492c5a8d..bcc6a3aa6b 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -1,11 +1,27 @@ require './test/test_helper' -class UserTest < ActiveSupport::TestCase +=begin +1 test for each custom model method +1 test for each relationship +2 tests for validation +2 tests on scope +=end + +describe User do + it "must be invalid" do + user = User.new + result = user.valid? + result.must_equal false + #value(user).must_be :valid? + end + + it "must be valid" do + user = User.new + user.name = 'John' + user.joined_on = 2017-10-01 + result = user.valid? + result.must_equal true + end - test "make new user" do - user = User.new - result = user.valid? - result.must_equal false - end end diff --git a/test/models/vote_test.rb b/test/models/vote_test.rb index ff2c8489db..509344f1c5 100644 --- a/test/models/vote_test.rb +++ b/test/models/vote_test.rb @@ -1,7 +1,28 @@ require './test/test_helper' -class VoteTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end +=begin +1 test for each custom model method +1 test for each relationship +2 tests for validation +2 tests on scope +=end + +describe Vote do + it "must be invalid" do + vote = Vote.new + result = vote.valid? + result.must_equal false + #value(user).must_be :valid? + end + + it "must be valid" do + vote = Vote.new + vote.work_id = 1 + vote.user_id = 1 + vote.category = 'album' + result = vote.valid? + result.must_equal true + end + + end diff --git a/test/models/work_test.rb b/test/models/work_test.rb index b87af78b8e..0595c98eae 100644 --- a/test/models/work_test.rb +++ b/test/models/work_test.rb @@ -1,7 +1,30 @@ require './test/test_helper' -class WorkTest < ActiveSupport::TestCase - test "the truth" do - assert true - end +=begin +1 test for each custom model method +1 test for each relationship +2 tests for validation +2 tests on scope +=end + +describe Work do + it "must be invalid" do + work = Work.new + result = work.valid? + result.must_equal false + #value(user).must_be :valid? + end + + it "must be valid" do + work = Work.new + work.title = 'Title 1' + work.creator = 'Creator 1' + work.published = 2000 + work.category = 'album' + work.description = 'hello my old friend' + result = work.valid? + result.must_equal true + end + + end diff --git a/test/test_helper.rb b/test/test_helper.rb index e3c4ff0b8e..7c0fbfd6f9 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,9 +1,17 @@ -require File.expand_path('../../config/environment', __FILE__) -require 'rails/test_help' +ENV["RAILS_ENV"] = "test" +require File.expand_path("../../config/environment", __FILE__) +require "rails/test_help" +require "minitest/rails" + +# To add Capybara feature tests add `gem "minitest-rails-capybara"` +# to the test group in the Gemfile and uncomment the following: +# require "minitest/rails/capybara" + +# Uncomment for awesome colorful output +# require "minitest/pride" class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. fixtures :all - # Add more helper methods to be used by all tests here... end From b5aa367bdee6ff728116cba49d4435827a15e43f Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Mon, 16 Oct 2017 11:25:51 -0700 Subject: [PATCH 34/40] pushing tests --- app/controllers/application_controller.rb | 10 ++- app/controllers/home_controller.rb | 4 + app/controllers/sessions_controller.rb | 35 ++++---- app/controllers/users_controller.rb | 4 + app/controllers/works_controller.rb | 22 +++-- app/helpers/application_helper.rb | 28 ++---- app/helpers/sessions_helper.rb | 16 ++++ app/views/home/index.html.erb | 12 +-- app/views/layouts/_header.html.erb | 9 +- app/views/users/show.html.erb | 8 +- app/views/works/edit.html.erb | 2 +- app/views/works/index.html.erb | 6 +- app/views/works/show.html.erb | 2 +- test/controllers/sessions_controller_test.rb | 55 ++++++++++-- test/controllers/user_controller_test.rb | 95 +++++++++++++++++--- test/controllers/work_controller_test.rb | 39 ++++++-- test/fixtures/users.yml | 6 +- test/fixtures/works.yml | 20 +++-- test/test_helper.rb | 1 + 19 files changed, 281 insertions(+), 93 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d512c034d8..d7ec31a363 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,7 +1,15 @@ class ApplicationController < ActionController::Base protect_from_forgery with: :exception + rescue_from ActiveRecord::RecordNotFound, :with => :render_404 + def index + @session = session end - + + + def render_404 + render :file => "#{Rails.root}/public/404.html", :status => 404 + end + end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index c11c7a635e..a2b3aa9b82 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -3,5 +3,9 @@ def index @top_work_id = Vote.limit(1).group(:work_id).count @top_work = Work.find(@top_work_id.keys[0]) @top_work_votes = Vote.where(work_id: @top_work_id.keys[0]) + end + + + end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 2d4c80414e..7cdbe728c1 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -3,26 +3,31 @@ class SessionsController < ApplicationController def new end + + def create if params[:name] == "" - redirect_to :back - end - - user = User.find_by(name: params[:name]) + flash[:login] = "Username: can't be blank" + redirect_to login_path - if user - flash[:notice] = 'Logged in as existing user' - session[:user_id] = user.id - redirect_to root_path, notice: "Successfully logged in as existing user #{user.name}" else - @new_user = User.new - @new_user.joined_on = Date.today - @new_user.name = params[:name] - @new_user.save - session[:user_id] = @new_user.id - flash[:notice] = "Successfully created new user #{@new_user.name} with ID #{@new_user.id}" - redirect_to root_path + user = User.find_by(name: params[:name]) + + if user + flash[:notice] = 'Logged in as existing user' + session[:user_id] = user.id + redirect_to root_path, notice: "Successfully logged in as existing user #{user.name}" + else + @new_user = User.new + @new_user.joined_on = Date.today + @new_user.name = params[:name] + @new_user.save + session[:user_id] = @new_user.id + flash[:notice] = "Successfully created new user #{@new_user.name} with ID #{@new_user.id}" + redirect_to root_path + end end + end def destory diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index bd6806f98b..534f97db54 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,4 +1,6 @@ class UsersController < ApplicationController + + def index @users = User.all end @@ -19,10 +21,12 @@ def create def show @user = User.find(params[:id]) + end private def user_params params.require(:user).permit(:name, :joined_on) end + end diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb index cb262fc35a..bde5eb6a1a 100644 --- a/app/controllers/works_controller.rb +++ b/app/controllers/works_controller.rb @@ -21,6 +21,7 @@ def destroy end def show + @work = Work.find(params[:id]) @votes = Vote.where(work_id: @work.id) end @@ -30,14 +31,21 @@ def new end def create - @work = Work.new(title: params[:work][:title], - description: params[:work][:description], - category: params[:work][:category], - creator: params[:work][:creator], - published: params[:work][:published]) - @work.save + if params[:work][:title] == "" + flash[:failed] = "title can't be blank" + redirect_to new_work_path + else - redirect_to works_path + @work = Work.new(title: params[:work][:title], + description: params[:work][:description], + category: params[:work][:category], + creator: params[:work][:creator], + published: params[:work][:published]) + @work.save + + flash[:success] = "Successfully created #{@work.category} #{@work.id}" + redirect_to work_path(@work.id) + end end def upvote diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 15d438f6db..b7282ba479 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,13 +1,13 @@ module ApplicationHelper - def find_user(id) + def self.find_user(id) return User.find(id.to_i).name end - def votes_for_work(work) + def self.votes_for_work(work) return Vote.where(work_id: work.id).count end - def top_10(category) + def self.top_10(category) result = [] @top_works = Vote.limit(10).where("category= '#{category}'").group(:work_id).count @top_works.keys.each do |work| @@ -16,35 +16,25 @@ def top_10(category) return result end - def votes_for_users(user) - return Vote.where(user_id: user.id).count - end - def user_signed_in - return session[:user_id] != nil - end - def get_user_id - return session[:user_id] - end - def get_user_name - return User.find(session[:user_id]).name - end - def user_cast_votes(user) + + + def self.user_cast_votes(user) return Vote.where(user_id: user.id) end - def get_title(id) + def self.get_title(id) return Work.find(id).title end - def get_published(id) + def self.get_published(id) return Work.find(id).published end - def get_creator(id) + def self.get_creator(id) return Work.find(id).creator end end diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb index 309f8b2eb3..fe3fd41918 100644 --- a/app/helpers/sessions_helper.rb +++ b/app/helpers/sessions_helper.rb @@ -1,2 +1,18 @@ module SessionsHelper + + def votes_for_users(user) + return Vote.where(user_id: user.id).count + end + + def user_signed_in + return session[:user_id] != nil + end + + def get_user_name + return User.find(session[:user_id]).name + end + + def get_user_id + return session[:user_id] + end end diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 832159580a..2b3eb633f4 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -17,14 +17,14 @@
    - <% top_10('album').each do |album| %> + <% ApplicationHelper.top_10('album').each do |album| %>
  • <%= link_to album.title, work_path(album) %> by <%= album.creator %>

    - <%= votes_for_work(album) %> votes + <%= ApplicationHelper.votes_for_work(album) %> votes

  • <% end %> @@ -34,14 +34,14 @@

    Top Movies

      - <% top_10('movie').each do |movie| %> + <% ApplicationHelper.top_10('movie').each do |movie| %>
    • <%= link_to movie.title, work_path(movie) %> by <%= movie.creator %>

      - <%= votes_for_work(movie) %> votes + <%= ApplicationHelper.votes_for_work(movie) %> votes

    • <% end %> @@ -55,14 +55,14 @@
        - <% top_10('book').each do |book| %> + <% ApplicationHelper.top_10('book').each do |book| %>
      • <%= link_to book.title, work_path(book) %> by <%= book.creator %>

        - <%= votes_for_work(book) %> votes + <%= ApplicationHelper.votes_for_work(book) %> votes

      • <% end %> diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index c554a8f2a7..6c339bd22d 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -33,9 +33,16 @@

        <%= value %>

        - <% elsif key == 'deleted' %> + <% elsif key == 'login' %>

        <%= value %>

        +
          +
        • username: can't be blank
        • +
        + <% else %> +
        +

        <%= value %>

        +
        <% end %> <% end %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 02078d5b22..e44f3f2fce 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -22,11 +22,11 @@ - <% user_cast_votes(@user).each do |vote| %> + <% ApplicationHelper.user_cast_votes(@user).each do |vote| %> - <%= link_to get_title(vote.work_id), work_path(vote.work_id) %> - <%= get_creator(vote.work_id) %> - <%- get_published(vote.work_id) %> + <%= link_to ApplicationHelper.get_title(vote.work_id), work_path(vote.work_id) %> + <%= ApplicationHelper.get_creator(vote.work_id) %> + <%- ApplicationHelper.get_published(vote.work_id) %> <%= vote.category %> <%= vote.date %> diff --git a/app/views/works/edit.html.erb b/app/views/works/edit.html.erb index 95bf4e166b..61242cb98e 100644 --- a/app/views/works/edit.html.erb +++ b/app/views/works/edit.html.erb @@ -19,6 +19,6 @@ <%= f.text_area :description %>
        - <%= f.submit %> + <%= f.submit :class => 'button'%> <% end %> diff --git a/app/views/works/index.html.erb b/app/views/works/index.html.erb index 78506467ef..231325d46b 100644 --- a/app/views/works/index.html.erb +++ b/app/views/works/index.html.erb @@ -32,7 +32,7 @@ <% @albums.each do |album| %> - <%= votes_for_work(album) %> + <%= ApplicationHelper.votes_for_work(album) %> @@ -84,7 +84,7 @@ <% @books.each do |book| %> - <%= votes_for_work(book) %> + <%= ApplicationHelper.votes_for_work(book) %> @@ -136,7 +136,7 @@ <% @movies.each do |movie| %> - <%= votes_for_work(movie) %> + <%= ApplicationHelper.votes_for_work(movie) %> diff --git a/app/views/works/show.html.erb b/app/views/works/show.html.erb index 18006d9b29..c72a47cb86 100644 --- a/app/views/works/show.html.erb +++ b/app/views/works/show.html.erb @@ -41,7 +41,7 @@ <% @votes.each do |vote| %> - <%= link_to find_user(vote.user_id), user_path(vote.user_id)%> + <%= link_to ApplicationHelper.find_user(vote.user_id), user_path(vote.user_id)%> <%= vote.date %> <% end %> diff --git a/test/controllers/sessions_controller_test.rb b/test/controllers/sessions_controller_test.rb index 707e647cb3..b9feb2d4d6 100644 --- a/test/controllers/sessions_controller_test.rb +++ b/test/controllers/sessions_controller_test.rb @@ -1,7 +1,52 @@ -require './test/test_helper' +require "./test/test_helper" +require 'date' + +=begin +Read model ID from URL - 2 cases +-valid ID +-invalid ID + +controller reads data and adds to DB - 2 +-data was valid +-data failed validations + +reads data from session - 2 cases +-user logged in +-user not logged in + +=end + +describe SessionsController do + + describe 'validations' do + it "user is logged in" do + get login_path, params:{ + user: { + name: 'john' + } + } + must_respond_with :success + end + + it "user is logged out" do + get login_path, params:{ + user: { + name: 'john' + } + } + + get logout_path, params:{ + user:{ + name: 'john' + } + } + must_redirect_to root_path + end + + + end + + + -class SessionsControllerTest < ActionDispatch::IntegrationTest - # test "the truth" do - # assert true - # end end diff --git a/test/controllers/user_controller_test.rb b/test/controllers/user_controller_test.rb index b05ada2229..734c942597 100644 --- a/test/controllers/user_controller_test.rb +++ b/test/controllers/user_controller_test.rb @@ -1,25 +1,94 @@ -require './test/test_helper' +require "./test/test_helper" +require 'date' +require './app/helpers/application_helper' +=begin +Read model ID from URL - 2 cases +-valid ID +-invalid ID + +controller reads data and adds to DB - 2 +-data was valid +-data failed validations + +reads data from session - 2 cases +-user logged in +-user not logged in + +=end -describe UserController do - it 'should get index' do +describe UsersController do + it "must get index page" do get users_path + must_respond_with :success end -end -=begin -class UserControllerTest < ActionDispatch::IntegrationTest + describe 'user id validations' do + it "get specified valid user" do + get users_path(users(:one).id) + must_respond_with :success + end - test "should get index" do - get '/users' - assert_response :success + it "get specified invalid user" do + get user_path(-1) + must_respond_with :missing + end + end + describe 'Make new user' do + it 'will create a valid new user' do + post users_path, params: { + user: { + name: 'john', + joined_on: Date.today + } + } + must_respond_with :redirect + must_redirect_to root_path + end end - test "get user data" do - get users_path(1) - must_respond_with :success + describe 'testing custom functions' do + it 'test find_user' do + t = ApplicationHelper.find_user(users(:one).id) + t.must_equal 'john' + end + + it 'test votes_for_work' do + work = Work.find(1) + t = ApplicationHelper.votes_for_work(work) + t.must_be_kind_of Integer + end + + it 'tests top_10' do + result = ApplicationHelper.top_10('album') + result.must_be_kind_of Array + end + + it 'tests user_cast_votes' do + user = User.find(1) + result = ApplicationHelper.user_cast_votes(user) + result[0].must_be_kind_of Vote + end + + it 'test get_title from ID' do + work = Work.find(1) + result = ApplicationHelper.get_title(1) + result.must_equal work.title + + end + + it 'test get_published ' do + work = Work.find(1) + result = ApplicationHelper.get_published(1) + result.must_equal work.published + end + + it 'test get_creator' do + work = Work.find(1) + result = ApplicationHelper.get_creator(1) + result.must_equal work.creator + end end end -=end diff --git a/test/controllers/work_controller_test.rb b/test/controllers/work_controller_test.rb index 763dee3106..7243d9e000 100644 --- a/test/controllers/work_controller_test.rb +++ b/test/controllers/work_controller_test.rb @@ -1,15 +1,42 @@ require './test/test_helper' -class WorkControllerTest < ActionDispatch::IntegrationTest - test "should get work index" do - get works_url +describe WorksController do + it "should get work home page" do + get works_path assert_response :success end - test "can see welcome page" do - get '/' - assert_select + describe 'works validations' do + it "get specified valid work id" do + get works_path(works(:one).id) + must_respond_with :success + end + + it "get specified invalid work" do + get work_path(1321321) + must_respond_with :missing + end + end + + describe 'new works validation' do + it 'adds a new valid work' do + post works_path, params: { + work: { + title: 'john', + creator: 'creator 1', + published: 2010, + category: 'album', + description: 'some description' + } + } + must_respond_with :redirect + + end + end + + it 'should call custom function' do + t = find_user() end end diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index 5d63da82b6..d06108a2a4 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -1,9 +1,11 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html one: - name: + id: 1 + name: 'john' joined_on: 2017-10-10 two: - name: + id: 2 + name: 'sue' joined_on: 2017-10-10 diff --git a/test/fixtures/works.yml b/test/fixtures/works.yml index b92d19bc01..553da6cf1b 100644 --- a/test/fixtures/works.yml +++ b/test/fixtures/works.yml @@ -1,15 +1,17 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html one: - category: MyString - title: MyString - creator: MyString - published: MyString + id: 1 + category: album + title: title + creator: creator + published: 2000 description: MyText two: - category: MyString - title: MyString - creator: MyString - published: MyString - description: MyText + id: 2 + category: book + title: title2 + creator: creator2 + published: 2001 + description: MyText2 diff --git a/test/test_helper.rb b/test/test_helper.rb index 7c0fbfd6f9..045ac4b324 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -2,6 +2,7 @@ require File.expand_path("../../config/environment", __FILE__) require "rails/test_help" require "minitest/rails" +require "./app/helpers/application_helper" # To add Capybara feature tests add `gem "minitest-rails-capybara"` # to the test group in the Gemfile and uncomment the following: From 6a04b47bf46f141d755a9b111ffe4f492f1da235 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Mon, 16 Oct 2017 11:28:52 -0700 Subject: [PATCH 35/40] fixing check query --- app/controllers/works_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb index bde5eb6a1a..d1405b7c33 100644 --- a/app/controllers/works_controller.rb +++ b/app/controllers/works_controller.rb @@ -55,7 +55,7 @@ def upvote flash[:failure] = 'You must log in to do that' else @check = Vote.where(user_id: session[:user_id], work_id: @work.id) - if @check == nil + if @check[0] == nil @vote = Vote.new(category: @work.category, work_id: @work.id, date: Date.today, From 37f5aa49dc8d06e95cb3b514161052b783240626 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Mon, 16 Oct 2017 11:35:17 -0700 Subject: [PATCH 36/40] update for heroku --- Gemfile | 8 +++++++- Gemfile.lock | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 9fc5587bfc..c2f54ca8a5 100644 --- a/Gemfile +++ b/Gemfile @@ -9,7 +9,13 @@ end # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.1.4' # Use sqlite3 as the database for Active Record -gem 'sqlite3' +group :development, :test do + gem 'sqlite3' +end + +group :production do + gem 'pg' +end # Use Puma as the app server gem 'puma', '~> 3.7' # Use SCSS for stylesheets diff --git a/Gemfile.lock b/Gemfile.lock index 4c5bed36c5..909abe1fb0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -96,6 +96,7 @@ GEM nio4r (2.1.0) nokogiri (1.8.1-x86-mingw32) mini_portile2 (~> 2.3.0) + pg (0.21.0-x86-mingw32) public_suffix (3.0.0) puma (3.10.0) rack (2.0.3) @@ -185,6 +186,7 @@ DEPENDENCIES jbuilder (~> 2.5) minitest-rails minitest-reporters + pg puma (~> 3.7) rails (~> 5.1.4) sass-rails (~> 5.0) From 8997a334ce5ad373a8a1441025d6a9233df10d40 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Thu, 19 Oct 2017 02:17:25 -0700 Subject: [PATCH 37/40] fixes for feedback --- app/controllers/home_controller.rb | 11 +- app/controllers/sessions_controller.rb | 12 +- app/controllers/works_controller.rb | 29 ++--- app/views/home/index.html.erb | 6 +- app/views/layouts/_header.html.erb | 48 ------- app/views/layouts/_top_10.html.erb | 49 ++++++++ app/views/layouts/application.html.erb | 51 +++++++- app/views/sessions/new.html.erb | 2 +- app/views/users/index.html.erb | 2 +- app/views/users/show.html.erb | 2 +- app/views/works/edit.html.erb | 2 +- app/views/works/index.html.erb | 152 +---------------------- app/views/works/new.html.erb | 2 +- app/views/works/show.html.erb | 2 +- config/routes.rb | 13 +- test/controllers/user_controller_test.rb | 41 ------ test/helpers/helper_functions.rb | 44 +++++++ 17 files changed, 191 insertions(+), 277 deletions(-) delete mode 100644 app/views/layouts/_header.html.erb create mode 100644 app/views/layouts/_top_10.html.erb create mode 100644 test/helpers/helper_functions.rb diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index a2b3aa9b82..dc947ca872 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,9 +1,14 @@ class HomeController < ApplicationController def index @top_work_id = Vote.limit(1).group(:work_id).count - @top_work = Work.find(@top_work_id.keys[0]) - @top_work_votes = Vote.where(work_id: @top_work_id.keys[0]) - + if @top_work_id == {} + @top_work = nil + @top_work_votes = nil + else + @top_work = Work.find(@top_work_id.keys[0]) + @top_work_votes = Vote.where(work_id: @top_work_id.keys[0]) + end + end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 7cdbe728c1..1b3aa5320a 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -3,7 +3,7 @@ class SessionsController < ApplicationController def new end - + def create if params[:name] == "" @@ -21,10 +21,12 @@ def create @new_user = User.new @new_user.joined_on = Date.today @new_user.name = params[:name] - @new_user.save - session[:user_id] = @new_user.id - flash[:notice] = "Successfully created new user #{@new_user.name} with ID #{@new_user.id}" - redirect_to root_path + if @new_user.save + session[:user_id] = @new_user.id + flash[:notice] = "Successfully created new user #{@new_user.name} with ID #{@new_user.id}" + redirect_to root_path + else + session[:failure] = "Failed to create new user #{@new_user.name}" end end diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb index d1405b7c33..0af6eded97 100644 --- a/app/controllers/works_controller.rb +++ b/app/controllers/works_controller.rb @@ -31,21 +31,16 @@ def new end def create - if params[:work][:title] == "" - flash[:failed] = "title can't be blank" - redirect_to new_work_path - else - - @work = Work.new(title: params[:work][:title], - description: params[:work][:description], - category: params[:work][:category], - creator: params[:work][:creator], - published: params[:work][:published]) - @work.save - flash[:success] = "Successfully created #{@work.category} #{@work.id}" - redirect_to work_path(@work.id) - end + @work = Work.new(work_params) + if @work.save + flash[:success] = "Successfully created #{@work.category} #{@work.id}" + redirect_to work_path(@work.id) + else + flash[:failure] = 'Could not create work' + flash.now[:details] = @work.errors.messages + render :new + end end def upvote @@ -92,4 +87,10 @@ def edit def show_all @works = Work.all end + + private + + def work_params + params.require(:title).permit(:category, :description, :creator, :published) + end end diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 2b3eb633f4..15c01580d3 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,6 +1,9 @@ -<%= render partial: 'layouts/header' %> +
        + <% if @top_work_id == {} %> +

        There's currently no top work. Vote away!

        + <% else %>

        Media Spotlight: <%= link_to @top_work.title, work_path(@top_work)%> by <%= @top_work.creator%> @@ -8,6 +11,7 @@

        <%= @top_work_votes.count %> votes - <%= @top_work.description %>

        + <% end %>

        diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb deleted file mode 100644 index 6c339bd22d..0000000000 --- a/app/views/layouts/_header.html.erb +++ /dev/null @@ -1,48 +0,0 @@ -
        - -

        - <%= link_to 'Media Ranker', root_path %> - - Ranking the Best of Everything - -

        - - - - - -
        - - - <% flash.each do |key, value|%> - <% if key == 'notice' || key == 'deleted' %> -
        -

        <%= value %>

        -
        - <% elsif key == 'login' %> -
        -

        <%= value %>

        -
          -
        • username: can't be blank
        • -
        -
        - <% else %> -
        -

        <%= value %>

        -
        - <% end %> - <% end %> diff --git a/app/views/layouts/_top_10.html.erb b/app/views/layouts/_top_10.html.erb new file mode 100644 index 0000000000..c443728ac1 --- /dev/null +++ b/app/views/layouts/_top_10.html.erb @@ -0,0 +1,49 @@ +

        + <%= @category %> +

        + + + + + + + + + + + + <% @works.each do |work| %> + + + + + + + + + + + + <% end %> + +
        + Votes + + Title + + Created By + + Published + + Upvote +
        + <%= ApplicationHelper.votes_for_work(work) %> + + <%= link_to work.title, work_path(work) %> + + <%= work.creator %> + + <%= work.published %> + + <%= link_to 'Upvote', upvote_work_path(work), method: :post, :class => 'button' %> +
        diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index c4e3157ca0..3f50771112 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,10 +5,59 @@ <%= csrf_meta_tags %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> - <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> + <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> +
        + +

        + <%= link_to 'Media Ranker', root_path %> + + Ranking the Best of Everything + +

        + + + + + +
        + + + <% flash.each do |key, value|%> + <% if key == 'notice' || key == 'deleted' %> +
        +

        <%= value %>

        +
        + <% elsif key == 'login' %> +
        +

        <%= value %>

        +
          +
        • username: can't be blank
        • +
        +
        + <% else %> +
        +

        <%= value %>

        +
        + <% end %> + <% end %> + <%= yield %> diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index 11f7fd1b4c..e9d18ef8db 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -1,4 +1,4 @@ -<%= render partial: 'layouts/header' %> +

        Log In

        diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 15ddda10e8..00e9bbb32b 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1,4 +1,4 @@ -<%= render partial: 'layouts/header' %> +

        List of Users

        diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index e44f3f2fce..c0dc1a4703 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,4 +1,4 @@ -<%= render partial: 'layouts/header' %> +

        User Summary: diff --git a/app/views/works/edit.html.erb b/app/views/works/edit.html.erb index 61242cb98e..7e81db0a81 100644 --- a/app/views/works/edit.html.erb +++ b/app/views/works/edit.html.erb @@ -1,4 +1,4 @@ -<%= render partial: 'layouts/header' %> +

        Edit this

        diff --git a/app/views/works/index.html.erb b/app/views/works/index.html.erb index 231325d46b..332915f783 100644 --- a/app/views/works/index.html.erb +++ b/app/views/works/index.html.erb @@ -1,163 +1,19 @@ -<%= render partial: 'layouts/header' %> +

        List of works

        -

        - Albums -

        -
        - - - - - - - - - - - <% @albums.each do |album| %> - - - - - - - - - - - - <% end %> - -
        - Votes - - Title - - Created By - - Published - - Upvote -
        - <%= ApplicationHelper.votes_for_work(album) %> - - <%= link_to album.title, work_path(album) %> - - <%= album.creator %> - - <%= album.published %> - - <%= link_to 'Upvote', upvote_work_path(album), method: :post, :class => 'button' %> -
        + <%= render partial: 'top_10', locals: {category: 'Albums', works: @albums} %>
    -

    - Books -

    - - - - - - - - - - - - <% @books.each do |book| %> - - - - - - - - - - - - <% end %> - -
    - Votes - - Title - - Created By - - Published - - Upvote -
    - <%= ApplicationHelper.votes_for_work(book) %> - - <%= link_to book.title, work_path(book) %> - - <%= book.creator %> - - <%= book.published %> - - <%= link_to 'Upvote', upvote_work_path(book), method: :post %> -
    + <%= render partial: 'top_10', locals: {category: 'Movies', works: @movies} %>
    -

    - Movies -

    - - - - - - - - - - - - <% @movies.each do |movie| %> - - - - - - - - - - - - <% end %> - -
    - Votes - - Title - - Created By - - Published - - Upvote -
    - <%= ApplicationHelper.votes_for_work(movie) %> - - <%= link_to movie.title, work_path(movie) %> - - <%= movie.creator %> - - <%= movie.published %> - - <%= link_to 'Upvote', upvote_work_path(movie), method: :post %> -
    + <%= render partial: 'top_10', locals: {category: 'Books', works: @books} %>
    <%= link_to 'View top media', root_path, :class => 'button' %> diff --git a/app/views/works/new.html.erb b/app/views/works/new.html.erb index 273ccfc6f7..40c6bc1b92 100644 --- a/app/views/works/new.html.erb +++ b/app/views/works/new.html.erb @@ -1,4 +1,4 @@ -<%= render partial: 'layouts/header' %> +

    Create new work

    diff --git a/app/views/works/show.html.erb b/app/views/works/show.html.erb index c72a47cb86..a983497838 100644 --- a/app/views/works/show.html.erb +++ b/app/views/works/show.html.erb @@ -1,4 +1,4 @@ -<%= render partial: 'layouts/header' %> +
    diff --git a/config/routes.rb b/config/routes.rb index c8d069b730..bc2fd7162f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,19 +1,12 @@ Rails.application.routes.draw do - #root 'home#index' - get '/works', to: 'works#index', as: 'works' get 'login', to: 'sessions#new', as: 'login' get 'logout', to: 'sessions#destory', as: 'logout' get 'signup', to: 'users#new', as: 'signup' - get '/works/new', to: 'works#new', as: 'new_work' - post '/works', to: 'works#create' post '/works/:id/upvote', to: 'works#upvote', as: 'upvote_work' - get '/works/:id', to: 'works#show', as: 'work' - get '/works/:id/edit', to: 'works#edit', as: 'edit_work' - patch '/works/:id', to: 'works#update' - delete '/works/:id', to: 'works#destroy' root 'home#index' -# root 'works#index' - resources :users, :books, :movies, :albums, :sessions + + resources :users, only: [:index, :show, :new, :create] + resources :sessions, :works # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end diff --git a/test/controllers/user_controller_test.rb b/test/controllers/user_controller_test.rb index 734c942597..db2aaf1cf8 100644 --- a/test/controllers/user_controller_test.rb +++ b/test/controllers/user_controller_test.rb @@ -48,47 +48,6 @@ end end - describe 'testing custom functions' do - it 'test find_user' do - t = ApplicationHelper.find_user(users(:one).id) - t.must_equal 'john' - end - - it 'test votes_for_work' do - work = Work.find(1) - t = ApplicationHelper.votes_for_work(work) - t.must_be_kind_of Integer - end - - it 'tests top_10' do - result = ApplicationHelper.top_10('album') - result.must_be_kind_of Array - end - - it 'tests user_cast_votes' do - user = User.find(1) - result = ApplicationHelper.user_cast_votes(user) - result[0].must_be_kind_of Vote - end - it 'test get_title from ID' do - work = Work.find(1) - result = ApplicationHelper.get_title(1) - result.must_equal work.title - - end - - it 'test get_published ' do - work = Work.find(1) - result = ApplicationHelper.get_published(1) - result.must_equal work.published - end - - it 'test get_creator' do - work = Work.find(1) - result = ApplicationHelper.get_creator(1) - result.must_equal work.creator - end - end end diff --git a/test/helpers/helper_functions.rb b/test/helpers/helper_functions.rb new file mode 100644 index 0000000000..b5eb10875a --- /dev/null +++ b/test/helpers/helper_functions.rb @@ -0,0 +1,44 @@ +require './test/test_helper' + +describe 'testing custom functions' do + it 'test find_user' do + t = ApplicationHelper.find_user(users(:one).id) + t.must_equal 'john' + end + + it 'test votes_for_work' do + work = Work.find(1) + t = ApplicationHelper.votes_for_work(work) + t.must_be_kind_of Integer + end + + it 'tests top_10' do + result = ApplicationHelper.top_10('album') + result.must_be_kind_of Array + end + + it 'tests user_cast_votes' do + user = User.find(1) + result = ApplicationHelper.user_cast_votes(user) + result[0].must_be_kind_of Vote + end + + it 'test get_title from ID' do + work = Work.find(1) + result = ApplicationHelper.get_title(1) + result.must_equal work.title + + end + + it 'test get_published ' do + work = Work.find(1) + result = ApplicationHelper.get_published(1) + result.must_equal work.published + end + + it 'test get_creator' do + work = Work.find(1) + result = ApplicationHelper.get_creator(1) + result.must_equal work.creator + end +end From e86c20e6290e4205315a095cb2c2e6dbeefa0bd5 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Thu, 19 Oct 2017 04:15:22 -0700 Subject: [PATCH 38/40] fixes for feedback --- app/controllers/sessions_controller.rb | 2 + app/controllers/works_controller.rb | 24 ++++++- app/helpers/application_helper.rb | 6 -- .../{_top_10.html.erb => _category.html.erb} | 4 +- app/views/works/index.html.erb | 6 +- db/media_seeds.csv | 62 +++++++++---------- db/seeds.rb | 33 +++++----- test/controllers/user_controller_test.rb | 3 - test/helpers/helper_functions.rb | 7 ++- 9 files changed, 82 insertions(+), 65 deletions(-) rename app/views/layouts/{_top_10.html.erb => _category.html.erb} (93%) diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 1b3aa5320a..bffb03af70 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -27,6 +27,7 @@ def create redirect_to root_path else session[:failure] = "Failed to create new user #{@new_user.name}" + end end end @@ -37,4 +38,5 @@ def destory flash[:notice] = 'Successfully logged out' redirect_to root_path end + end diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb index 0af6eded97..88d6122059 100644 --- a/app/controllers/works_controller.rb +++ b/app/controllers/works_controller.rb @@ -2,9 +2,27 @@ class WorksController < ApplicationController def index - @albums = Work.where(category: 'album') - @books = Work.where(category: 'book') - @movies = Work.where(category: 'movie') + @albums = Work.all.select('works.id, works.title, works.creator, + works.published, votes.count(*) as vote_count') + .joins("LEFT JOIN Votes on Votes.work_id") + .where("Works.category = 'album'") + .group('works.id') + .order('vote_count DESC') + + @books = Work.all.select('works.id, works.title, works.creator, + works.published, count(*) as vote_count') + .joins("LEFT JOIN Votes on Votes.work_id") + .where("Works.category = 'book'") + .group('works.id') + .order('vote_count DESC') + + @movies = Work.all.select('works.id, works.title, works.creator, + works.published, count(*) as vote_count') + .joins("LEFT JOIN Votes on Votes.work_id") + .where("Works.category = 'movie'"). + group('works.id') + .order('vote_count DESC') + end def destroy diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b7282ba479..a8a28b18f4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -16,12 +16,6 @@ def self.top_10(category) return result end - - - - - - def self.user_cast_votes(user) return Vote.where(user_id: user.id) end diff --git a/app/views/layouts/_top_10.html.erb b/app/views/layouts/_category.html.erb similarity index 93% rename from app/views/layouts/_top_10.html.erb rename to app/views/layouts/_category.html.erb index c443728ac1..eae7add4f3 100644 --- a/app/views/layouts/_top_10.html.erb +++ b/app/views/layouts/_category.html.erb @@ -1,5 +1,5 @@

    - <%= @category %> + <%= title %>

    @@ -22,7 +22,7 @@ - <% @works.each do |work| %> + <% category.each do |work| %> - <% ApplicationHelper.user_cast_votes(@user).each do |vote| %> + <% Work.user_cast_votes(@user).each do |vote| %> - - - + + + diff --git a/app/views/works/show.html.erb b/app/views/works/show.html.erb index a983497838..76304c2689 100644 --- a/app/views/works/show.html.erb +++ b/app/views/works/show.html.erb @@ -41,7 +41,7 @@ <% @votes.each do |vote| %> - + <% end %> diff --git a/test/helpers/helper_functions.rb b/test/helpers/helper_functions.rb index 96a2850751..3f6efdb3a0 100644 --- a/test/helpers/helper_functions.rb +++ b/test/helpers/helper_functions.rb @@ -12,15 +12,6 @@ t.must_be_kind_of Integer end - it 'tests top_10' do - category = 'album' - result = ApplicationHelper.top_10(category) - result.must_be_kind_of Array - result.each do |work| - work.category.must_equal category - end - result.length.must_be :<=, 10 - end it 'tests user_cast_votes' do user = User.find(1) From 09d8840934f0ec35634424bb5ad61828e4c90028 Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Thu, 19 Oct 2017 09:46:31 -0700 Subject: [PATCH 40/40] fixing work_test --- test/models/work_test.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/models/work_test.rb b/test/models/work_test.rb index 0595c98eae..cb1e0bea55 100644 --- a/test/models/work_test.rb +++ b/test/models/work_test.rb @@ -12,7 +12,11 @@ work = Work.new result = work.valid? result.must_equal false - #value(user).must_be :valid? + work.errors.keys.must_include :creator + work.errors.keys.must_include :title + work.errors.keys.must_include :published + work.errors.keys.must_include :category + work.errors.keys.must_include :description end it "must be valid" do @@ -23,7 +27,6 @@ work.category = 'album' work.description = 'hello my old friend' result = work.valid? - result.must_equal true end
    <%= ApplicationHelper.votes_for_work(work) %> diff --git a/app/views/works/index.html.erb b/app/views/works/index.html.erb index 332915f783..88255db6b0 100644 --- a/app/views/works/index.html.erb +++ b/app/views/works/index.html.erb @@ -5,15 +5,15 @@

    List of works

    - <%= render partial: 'top_10', locals: {category: 'Albums', works: @albums} %> + <%= render partial: 'layouts/category', locals: {title: 'Albums', category: @albums} %>
    - <%= render partial: 'top_10', locals: {category: 'Movies', works: @movies} %> + <%= render partial: 'layouts/category', locals: {title: 'Movies', category: @movies} %>
    - <%= render partial: 'top_10', locals: {category: 'Books', works: @books} %> + <%= render partial: 'layouts/category', locals: {title: 'Books', category: @books} %>
    <%= link_to 'View top media', root_path, :class => 'button' %> diff --git a/db/media_seeds.csv b/db/media_seeds.csv index fbe574b304..92b7c6ac0d 100644 --- a/db/media_seeds.csv +++ b/db/media_seeds.csv @@ -1,32 +1,32 @@ id,category,title,creator,publication_year,description -1,album,Can't Buy a Thrill,Steely Dan,1972, -2,album,Countdown to Ecstasy,Steely Dan,1973, -3,album,Pretzel Logic,Steely Dan,1974, -4,album,Katy Lied,Steely Dan,1975, -5,album,The Royal Scam,Steely Dan,1976, -6,album,Aja,Steely Dan,1977, -7,album,Gaucho,Steely Dan,1980, -8,album,Silence Yourself,Savages,2013, -9,album,Adore Life,Savages,2016, -10,album,NVM,Tacocat,2014, -11,album,Lost Time,Tacocat,2016, -12,movie,No Regrets,Chastity Belt,2013, -13,movie,Time to Go Home,Chastity Belt,2015, -14,movie,Sleater-Kinney,Sleater-Kinney,1995, -15,movie,Call the Doctor,Sleater-Kinney,1996, -16,movie,Dig Me Out,Sleater-Kinney,1997, -17,movie,The Hot Rock,Sleater-Kinney,1999, -18,movie,All Hands on the Bad One,Sleater-Kinney,2000, -19,movie,One Beat,Sleater-Kinney,2002, -20,movie,The Woods,Sleater-Kinney,2005, -21,movie,No Cities to Love,Sleater-Kinney,2015, -22,book,Hidden Figures,Margot Lee Shetterly,2016,Good book that came before the movie -23,book,Practical Object-Oriented Design in Ruby,Sandi Metz,2012,Good programming book -24,book,Kindred,Octavia E. Butler,1979,Good sci-fi book -25,book,Parable of the Sower,Octavia E. Butler,1993, -26,book,book1,Ursula K. Leguin,1968, -27,book,book2,Ursula K. Leguin,1968, -28,book,book3,Ursula K. Leguin,1968, -29,book,book4,Ursula K. Leguin,1968, -30,book,book5,Ursula K. Leguin,1968, -31,book,book6,Ursula K. Leguin,1968, +1,album,Can't Buy a Thrill,Steely Dan,1972, asdf, +2,album,Countdown to Ecstasy,Steely Dan,1973,asdf, +3,album,Pretzel Logic,Steely Dan,1974,asdf, +4,album,Katy Lied,Steely Dan,1975,asdf, +5,album,The Royal Scam,Steely Dan,1976,asdf, +6,album,Aja,Steely Dan,1977,asdf, +7,album,Gaucho,Steely Dan,1980,asdf, +8,album,Silence Yourself,Savages,2013,asdf, +9,album,Adore Life,Savages,2016,asdf, +10,album,NVM,Tacocat,2014,asdf, +11,album,Lost Time,Tacocat,2016,asdf, +12,movie,No Regrets,Chastity Belt,2013,asdf, +13,movie,Time to Go Home,Chastity Belt,2015,asdf, +14,movie,Sleater-Kinney,Sleater-Kinney,1995,asdf, +15,movie,Call the Doctor,Sleater-Kinney,1996,asdf, +16,movie,Dig Me Out,Sleater-Kinney,1997,asdf, +17,movie,The Hot Rock,Sleater-Kinney,1999,asdf, +18,movie,All Hands on the Bad One,Sleater-Kinney,2000,asdf, +19,movie,One Beat,Sleater-Kinney,2002,asdf, +20,movie,The Woods,Sleater-Kinney,2005,asdf, +21,movie,No Cities to Love,Sleater-Kinney,2015,asdf, +22,book,Hidden Figures,Margot Lee Shetterly,2016,Good book that came before the movie,asdf, +23,book,Practical Object-Oriented Design in Ruby,Sandi Metz,2012,Good programming book,asdf, +24,book,Kindred,Octavia E. Butler,1979,Good sci-fi book,asdf, +25,book,Parable of the Sower,Octavia E. Butler,1993,asdf, +26,book,book1,Ursula K. Leguin,1968,asdf, +27,book,book2,Ursula K. Leguin,1968,asdf, +28,book,book3,Ursula K. Leguin,1968,asdf, +29,book,book4,Ursula K. Leguin,1968,asdf, +30,book,book5,Ursula K. Leguin,1968,asdf, +31,book,book6,Ursula K. Leguin,1968,asdf, diff --git a/db/seeds.rb b/db/seeds.rb index b248d6c4ae..008d7b8a16 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -4,6 +4,20 @@ puts Rails.root +USER_FILE = Rails.root.join('db', 'users_seed.csv') +user_failures = [] +CSV.foreach(USER_FILE, :headers => true) do |row| + user = User.new + user.id = row['id'] + user.name = row['name'] + user.joined_on = Date.today + puts "Created Album: #{user.inspect}" + successful = user.save + if !successful + user_failures << user + end +end + DRIVER_FILE = Rails.root.join('db', 'media_seeds.csv') puts "Loading raw driver data from #{DRIVER_FILE}" @@ -14,7 +28,8 @@ record.category = row['category'] record.title = row['title'] record.creator = row['creator'] - record.published = row['published'] + record.published = row['publication_year'] + record.description = row['description'] puts "Created Album: #{record.inspect}" successful = record.save if !successful @@ -22,6 +37,7 @@ end end + VOTE_FILE = Rails.root.join('db', 'vote_seed.csv') vote_failures = [] CSV.foreach(VOTE_FILE, :headers => true) do |row| @@ -37,18 +53,3 @@ vote_failures << vote end end - - -USER_FILE = Rails.root.join('db', 'users_seed.csv') -user_failures = [] -CSV.foreach(USER_FILE, :headers => true) do |row| - user = User.new - user.id = row['id'] - user.name = row['name'] - user.joined_on = Date.today - puts "Created Album: #{user.inspect}" - successful = user.save - if !successful - user_failures << user - end -end diff --git a/test/controllers/user_controller_test.rb b/test/controllers/user_controller_test.rb index db2aaf1cf8..dd29e8c35d 100644 --- a/test/controllers/user_controller_test.rb +++ b/test/controllers/user_controller_test.rb @@ -47,7 +47,4 @@ must_redirect_to root_path end end - - - end diff --git a/test/helpers/helper_functions.rb b/test/helpers/helper_functions.rb index b5eb10875a..96a2850751 100644 --- a/test/helpers/helper_functions.rb +++ b/test/helpers/helper_functions.rb @@ -13,8 +13,13 @@ end it 'tests top_10' do - result = ApplicationHelper.top_10('album') + category = 'album' + result = ApplicationHelper.top_10(category) result.must_be_kind_of Array + result.each do |work| + work.category.must_equal category + end + result.length.must_be :<=, 10 end it 'tests user_cast_votes' do From cacedc2cf1d9b425e75ae5fd28bf46adc95fd20c Mon Sep 17 00:00:00 2001 From: VirtualLindsey Date: Thu, 19 Oct 2017 09:05:06 -0700 Subject: [PATCH 39/40] more fixes for feedback --- app/helpers/application_helper.rb | 33 +-------------------------- app/models/user.rb | 1 + app/models/vote.rb | 2 ++ app/models/work.rb | 37 +++++++++++++++++++++++++++++++ app/views/home/index.html.erb | 12 +++++----- app/views/users/show.html.erb | 8 +++---- app/views/works/show.html.erb | 2 +- test/helpers/helper_functions.rb | 9 -------- 8 files changed, 52 insertions(+), 52 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a8a28b18f4..a01ee1ed4f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,34 +1,3 @@ module ApplicationHelper - def self.find_user(id) - return User.find(id.to_i).name - end - - def self.votes_for_work(work) - return Vote.where(work_id: work.id).count - end - - def self.top_10(category) - result = [] - @top_works = Vote.limit(10).where("category= '#{category}'").group(:work_id).count - @top_works.keys.each do |work| - result << Work.find(work) - end - return result - end - - def self.user_cast_votes(user) - return Vote.where(user_id: user.id) - end - - def self.get_title(id) - return Work.find(id).title - end - - def self.get_published(id) - return Work.find(id).published - end - - def self.get_creator(id) - return Work.find(id).creator - end + end diff --git a/app/models/user.rb b/app/models/user.rb index e69ba9ce3f..984acb9be2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,3 +1,4 @@ class User < ApplicationRecord + has_many :votes, dependent: :destroy validates :name, :joined_on, presence: true end diff --git a/app/models/vote.rb b/app/models/vote.rb index cd77542c74..bf9f948fe1 100644 --- a/app/models/vote.rb +++ b/app/models/vote.rb @@ -1,3 +1,5 @@ class Vote < ApplicationRecord + belongs_to :work + belongs_to :user validates :user_id, :work_id, :category, presence: true end diff --git a/app/models/work.rb b/app/models/work.rb index 5bd064d516..7a813a5dc5 100644 --- a/app/models/work.rb +++ b/app/models/work.rb @@ -1,4 +1,41 @@ class Work < ApplicationRecord + has_many :votes, dependent: :destroy + validates :creator, :title, :published, :category, :description, presence: true + + def self.top_10(category) + result = [] + @top_works = Vote.limit(10).where("category= '#{category}'").group(:work_id).count + @top_works.keys.each do |work| + result << Work.find(work) + end + return result + end + + def self.votes_for_work(work) + return Vote.where(work_id: work.id).count + end + + def self.find_user(id) + return User.find(id.to_i).name + end + + + + def self.user_cast_votes(user) + return Vote.where(user_id: user.id) + end + + def self.get_title(id) + return Work.find(id).title + end + + def self.get_published(id) + return Work.find(id).published + end + + def self.get_creator(id) + return Work.find(id).creator + end end diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 15c01580d3..b371a4078d 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -21,14 +21,14 @@
      - <% ApplicationHelper.top_10('album').each do |album| %> + <% Work.top_10('album').each do |album| %>
    • <%= link_to album.title, work_path(album) %> by <%= album.creator %>

      - <%= ApplicationHelper.votes_for_work(album) %> votes + <%= Work.votes_for_work(album) %> votes

    • <% end %> @@ -38,14 +38,14 @@

      Top Movies

        - <% ApplicationHelper.top_10('movie').each do |movie| %> + <% Work.top_10('movie').each do |movie| %>
      • <%= link_to movie.title, work_path(movie) %> by <%= movie.creator %>

        - <%= ApplicationHelper.votes_for_work(movie) %> votes + <%= Work.votes_for_work(movie) %> votes

      • <% end %> @@ -59,14 +59,14 @@
          - <% ApplicationHelper.top_10('book').each do |book| %> + <% Work.top_10('book').each do |book| %>
        • <%= link_to book.title, work_path(book) %> by <%= book.creator %>

          - <%= ApplicationHelper.votes_for_work(book) %> votes + <%= Work.votes_for_work(book) %> votes

        • <% end %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index c0dc1a4703..938ca0ef00 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -22,11 +22,11 @@
    <%= link_to ApplicationHelper.get_title(vote.work_id), work_path(vote.work_id) %> <%= ApplicationHelper.get_creator(vote.work_id) %> <%- ApplicationHelper.get_published(vote.work_id) %> <%= link_to vote.work.title, work_path(vote.work_id) %> <%= vote.work.creator %> <%- vote.work.published %> <%= vote.category %> <%= vote.date %>
    <%= link_to ApplicationHelper.find_user(vote.user_id), user_path(vote.user_id)%> <%= link_to vote.user.name, user_path(vote.user_id)%> <%= vote.date %>