From 6e57104ebecd664166b324e48deae0d5a657fecc Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Tue, 11 Oct 2016 10:57:00 -0700 Subject: [PATCH 01/49] Rails generated controllers for album, book, and movie --- app/assets/javascripts/album.coffee | 3 +++ app/assets/javascripts/book.coffee | 3 +++ app/assets/javascripts/movie.coffee | 3 +++ app/assets/stylesheets/album.scss | 3 +++ app/assets/stylesheets/book.scss | 3 +++ app/assets/stylesheets/movie.scss | 3 +++ app/controllers/album_controller.rb | 2 ++ app/controllers/book_controller.rb | 2 ++ app/controllers/movie_controller.rb | 2 ++ app/helpers/album_helper.rb | 2 ++ app/helpers/book_helper.rb | 2 ++ app/helpers/movie_helper.rb | 2 ++ test/controllers/album_controller_test.rb | 7 +++++++ test/controllers/book_controller_test.rb | 7 +++++++ test/controllers/movie_controller_test.rb | 7 +++++++ 15 files changed, 51 insertions(+) create mode 100644 app/assets/javascripts/album.coffee create mode 100644 app/assets/javascripts/book.coffee create mode 100644 app/assets/javascripts/movie.coffee create mode 100644 app/assets/stylesheets/album.scss create mode 100644 app/assets/stylesheets/book.scss create mode 100644 app/assets/stylesheets/movie.scss create mode 100644 app/controllers/album_controller.rb create mode 100644 app/controllers/book_controller.rb create mode 100644 app/controllers/movie_controller.rb create mode 100644 app/helpers/album_helper.rb create mode 100644 app/helpers/book_helper.rb create mode 100644 app/helpers/movie_helper.rb 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 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/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/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/stylesheets/album.scss b/app/assets/stylesheets/album.scss new file mode 100644 index 0000000000..2bb51d310f --- /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/book.scss b/app/assets/stylesheets/book.scss new file mode 100644 index 0000000000..67653c0889 --- /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..c23bc3e33f --- /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/controllers/album_controller.rb b/app/controllers/album_controller.rb new file mode 100644 index 0000000000..954eeb990d --- /dev/null +++ b/app/controllers/album_controller.rb @@ -0,0 +1,2 @@ +class AlbumController < ApplicationController +end diff --git a/app/controllers/book_controller.rb b/app/controllers/book_controller.rb new file mode 100644 index 0000000000..9a5a1f8287 --- /dev/null +++ b/app/controllers/book_controller.rb @@ -0,0 +1,2 @@ +class BookController < ApplicationController +end diff --git a/app/controllers/movie_controller.rb b/app/controllers/movie_controller.rb new file mode 100644 index 0000000000..d68e28fb19 --- /dev/null +++ b/app/controllers/movie_controller.rb @@ -0,0 +1,2 @@ +class MovieController < ApplicationController +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/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/test/controllers/album_controller_test.rb b/test/controllers/album_controller_test.rb new file mode 100644 index 0000000000..5aaaa830a6 --- /dev/null +++ b/test/controllers/album_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class AlbumControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/book_controller_test.rb b/test/controllers/book_controller_test.rb new file mode 100644 index 0000000000..2f3a090be2 --- /dev/null +++ b/test/controllers/book_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class BookControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/movie_controller_test.rb b/test/controllers/movie_controller_test.rb new file mode 100644 index 0000000000..a12f1e576f --- /dev/null +++ b/test/controllers/movie_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class MovieControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end From 651b522ada6224d4155a46ff90c10c5d6f9ad0da Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Tue, 11 Oct 2016 10:59:22 -0700 Subject: [PATCH 02/49] Rails generated models for book, album, and movie --- app/models/album.rb | 2 ++ app/models/book.rb | 2 ++ app/models/movie.rb | 2 ++ db/migrate/20161011175758_create_albums.rb | 12 ++++++++++++ db/migrate/20161011175831_create_books.rb | 12 ++++++++++++ db/migrate/20161011175903_create_movies.rb | 12 ++++++++++++ test/fixtures/albums.yml | 13 +++++++++++++ test/fixtures/books.yml | 13 +++++++++++++ test/fixtures/movies.yml | 13 +++++++++++++ test/models/album_test.rb | 7 +++++++ test/models/book_test.rb | 7 +++++++ test/models/movie_test.rb | 7 +++++++ 12 files changed, 102 insertions(+) create mode 100644 app/models/album.rb create mode 100644 app/models/book.rb create mode 100644 app/models/movie.rb create mode 100644 db/migrate/20161011175758_create_albums.rb create mode 100644 db/migrate/20161011175831_create_books.rb create mode 100644 db/migrate/20161011175903_create_movies.rb create mode 100644 test/fixtures/albums.yml create mode 100644 test/fixtures/books.yml create mode 100644 test/fixtures/movies.yml create mode 100644 test/models/album_test.rb create mode 100644 test/models/book_test.rb create mode 100644 test/models/movie_test.rb diff --git a/app/models/album.rb b/app/models/album.rb new file mode 100644 index 0000000000..46fa309e4e --- /dev/null +++ b/app/models/album.rb @@ -0,0 +1,2 @@ +class Album < ActiveRecord::Base +end diff --git a/app/models/book.rb b/app/models/book.rb new file mode 100644 index 0000000000..6f68b44465 --- /dev/null +++ b/app/models/book.rb @@ -0,0 +1,2 @@ +class Book < ActiveRecord::Base +end diff --git a/app/models/movie.rb b/app/models/movie.rb new file mode 100644 index 0000000000..49198a7d97 --- /dev/null +++ b/app/models/movie.rb @@ -0,0 +1,2 @@ +class Movie < ActiveRecord::Base +end diff --git a/db/migrate/20161011175758_create_albums.rb b/db/migrate/20161011175758_create_albums.rb new file mode 100644 index 0000000000..9f04354899 --- /dev/null +++ b/db/migrate/20161011175758_create_albums.rb @@ -0,0 +1,12 @@ +class CreateAlbums < ActiveRecord::Migration + def change + create_table :albums do |t| + t.string :name + t.string :artist + t.string :description + t.integer :rank + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20161011175831_create_books.rb b/db/migrate/20161011175831_create_books.rb new file mode 100644 index 0000000000..12eb4ee8b2 --- /dev/null +++ b/db/migrate/20161011175831_create_books.rb @@ -0,0 +1,12 @@ +class CreateBooks < ActiveRecord::Migration + def change + create_table :books do |t| + t.string :name + t.string :author + t.string :description + t.integer :rank + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20161011175903_create_movies.rb b/db/migrate/20161011175903_create_movies.rb new file mode 100644 index 0000000000..1c40a5f879 --- /dev/null +++ b/db/migrate/20161011175903_create_movies.rb @@ -0,0 +1,12 @@ +class CreateMovies < ActiveRecord::Migration + def change + create_table :movies do |t| + t.string :name + t.string :director + t.string :description + t.integer :rank + + t.timestamps null: false + end + end +end diff --git a/test/fixtures/albums.yml b/test/fixtures/albums.yml new file mode 100644 index 0000000000..8f3dac63cc --- /dev/null +++ b/test/fixtures/albums.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyString + artist: MyString + description: MyString + rank: 1 + +two: + name: MyString + artist: MyString + description: MyString + rank: 1 diff --git a/test/fixtures/books.yml b/test/fixtures/books.yml new file mode 100644 index 0000000000..3c3770bd30 --- /dev/null +++ b/test/fixtures/books.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyString + author: MyString + description: MyString + rank: 1 + +two: + name: MyString + author: MyString + description: MyString + rank: 1 diff --git a/test/fixtures/movies.yml b/test/fixtures/movies.yml new file mode 100644 index 0000000000..b6385086e0 --- /dev/null +++ b/test/fixtures/movies.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyString + director: MyString + description: MyString + rank: 1 + +two: + name: MyString + director: MyString + description: MyString + rank: 1 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 From 33bdc9d067083b8b15ca0769357e419500c2e48d Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Tue, 11 Oct 2016 11:29:30 -0700 Subject: [PATCH 03/49] Changed column name from rank to rank_points for clarity, and ssketched out random seed data. No migration yet --- db/migrate/20161011175758_create_albums.rb | 2 +- db/migrate/20161011175831_create_books.rb | 2 +- db/migrate/20161011175903_create_movies.rb | 2 +- db/seeds.rb | 39 ++++++++++++++++++++++ 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/db/migrate/20161011175758_create_albums.rb b/db/migrate/20161011175758_create_albums.rb index 9f04354899..e5e949c613 100644 --- a/db/migrate/20161011175758_create_albums.rb +++ b/db/migrate/20161011175758_create_albums.rb @@ -4,7 +4,7 @@ def change t.string :name t.string :artist t.string :description - t.integer :rank + t.integer :rank_points t.timestamps null: false end diff --git a/db/migrate/20161011175831_create_books.rb b/db/migrate/20161011175831_create_books.rb index 12eb4ee8b2..9bac269fba 100644 --- a/db/migrate/20161011175831_create_books.rb +++ b/db/migrate/20161011175831_create_books.rb @@ -4,7 +4,7 @@ def change t.string :name t.string :author t.string :description - t.integer :rank + t.integer :rank_points t.timestamps null: false end diff --git a/db/migrate/20161011175903_create_movies.rb b/db/migrate/20161011175903_create_movies.rb index 1c40a5f879..5dbb75ef60 100644 --- a/db/migrate/20161011175903_create_movies.rb +++ b/db/migrate/20161011175903_create_movies.rb @@ -4,7 +4,7 @@ def change t.string :name t.string :director t.string :description - t.integer :rank + t.integer :rank_points t.timestamps null: false end diff --git a/db/seeds.rb b/db/seeds.rb index 4edb1e857e..09726c9219 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -5,3 +5,42 @@ # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel', city: cities.first) +adjectives = %w(hot cold sizzling spicy wonderful fantabulous glorious splendiferous shocking groovy) +first_names = %w(Sally Polly John Jacob Betty Holly Trolly Folly Lolly) +last_names = %w(Jingleheimer Schmidt Johnson Davidson Scottson Mottson Smith Jones Etcetera) +colors = %w(white black blue grey teal red pink purple fuschia clear yellow orange brown) +nouns = %w(car grain waffle screw cup tea coffee plate phone chair street building brick bop-it marker) +gerunds = %w(running leaping jumping falling crying pouring underscoring boring singing gaming) + + +albums = [ + {name: "The #{colors.sample.capitalize} Album", artist: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}" , description: "This album is #{adjectives.sample}!", rank_points: 0 }, + {name: "The #{colors.sample.capitalize} Album", artist: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This album is #{adjectives.sample}!", rank_points: 0 }, + {name: "The #{colors.sample.capitalize} Album", artist: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This album is #{adjectives.sample}!", rank_points: 0 }, + {name: "The #{colors.sample.capitalize} Album", artist: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This album is #{adjectives.sample}!", rank_points: 0 }, + {name: "The #{colors.sample.capitalize} Album", artist: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}" , description: "This album is #{adjectives.sample}!", rank_points: 0 }, + {name: "The #{colors.sample.capitalize} Album", artist: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}" , description: "This album is #{adjectives.sample}!", rank_points: 0 } +] + +books = [ + {name: "The Chronicle of a #{nouns.sample.capitalize}", author: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This book was really #{adjectives.sample}!", rank_points: 0 }, + {name: "The Chronicle of a #{nouns.sample.capitalize}", author: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This book was really #{adjectives.sample}!" , rank_points: 0 }, + {name: "The Chronicle of a #{nouns.sample.capitalize}", author: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This book was really #{adjectives.sample}!" , rank_points: 0 }, + {name: "The Chronicle of a #{nouns.sample.capitalize}", author: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This book was really #{adjectives.sample}!" , rank_points: 0 }, + {name: "The Chronicle of a #{nouns.sample.capitalize}", author: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This book was really #{adjectives.sample}!" , rank_points: 0 }, + {name: "The Chronicle of a #{nouns.sample.capitalize}", author: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This book was really #{adjectives.sample}!" , rank_points: 0 } +] + +movies = [ + {name: "The #{gerunds.sample.capitalize} #{nouns.sample.capitalize}", director: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This movie was #{adjectives.sample}", rank_points: 0 }, + {name: "The #{gerunds.sample.capitalize} #{nouns.sample.capitalize}", director: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This movie was #{adjectives.sample}", rank_points: 0 }, + {name: "The #{gerunds.sample.capitalize} #{nouns.sample.capitalize}", director: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This movie was #{adjectives.sample}", rank_points: 0 }, + {name: "The #{gerunds.sample.capitalize} #{nouns.sample.capitalize}", director: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This movie was #{adjectives.sample}", rank_points: 0 }, + {name: "The #{gerunds.sample.capitalize} #{nouns.sample.capitalize}", director: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This movie was #{adjectives.sample}", rank_points: 0 } + +] + + +Album.create(albums) +Book.create(books) +Movie.create(movie) From e0fafee387cc371a24118ceb03d52142f76e5838 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Tue, 11 Oct 2016 11:39:45 -0700 Subject: [PATCH 04/49] Added better_errors gem --- Gemfile | 4 +--- Gemfile.lock | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index e87fad5fc1..ce761eeb96 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,5 @@ source 'https://rubygems.org' - # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.7' # Use sqlite3 as the database for Active Record @@ -40,8 +39,7 @@ end group :development do # Access an IRB console on exception pages or by using <%= console %> in views gem 'web-console', '~> 2.0' - # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' + gem 'better_errors' end - diff --git a/Gemfile.lock b/Gemfile.lock index 2516d4acd5..ec5dd5817b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,10 +37,15 @@ GEM thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) arel (6.0.3) + better_errors (2.1.1) + coderay (>= 1.0.0) + erubis (>= 2.6.6) + rack (>= 0.9.0) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) builder (3.2.2) byebug (9.0.6) + coderay (1.1.1) coffee-rails (4.1.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.1.x) @@ -145,6 +150,7 @@ PLATFORMS ruby DEPENDENCIES + better_errors byebug coffee-rails (~> 4.1.0) jbuilder (~> 2.0) From b26acd6b81224a6cb3a6a68408ff910bef8a70e2 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Tue, 11 Oct 2016 11:41:36 -0700 Subject: [PATCH 05/49] Succesfully migrated databases and seeded data --- db/schema.rb | 43 +++++++++++++++++++++++++++++++++++++++++++ db/seeds.rb | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 db/schema.rb diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000000..eced93a8f5 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,43 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20161011175903) do + + create_table "albums", force: :cascade do |t| + t.string "name" + t.string "artist" + t.string "description" + t.integer "rank_points" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "books", force: :cascade do |t| + t.string "name" + t.string "author" + t.string "description" + t.integer "rank_points" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "movies", force: :cascade do |t| + t.string "name" + t.string "director" + t.string "description" + t.integer "rank_points" + 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 09726c9219..caf2e0ca65 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -43,4 +43,4 @@ Album.create(albums) Book.create(books) -Movie.create(movie) +Movie.create(movies) From 2ec3ab53cae6de05ac2474c156b8267341b3bbbc Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Tue, 11 Oct 2016 11:45:52 -0700 Subject: [PATCH 06/49] Generated basic routes for all three models --- config/routes.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/routes.rb b/config/routes.rb index 3f66539d54..63095a42ad 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,8 @@ Rails.application.routes.draw do + resources :albums + resources :books + resources :movies + # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". From 1b63166d7bf580b49f6c92db69e0072ff961617c Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Tue, 11 Oct 2016 11:52:59 -0700 Subject: [PATCH 07/49] Added basic methods to controller by straight up pasting from FarMar and changing names of everything --- app/controllers/album_controller.rb | 46 +++++++++++++++++++++++++++++ app/controllers/book_controller.rb | 46 +++++++++++++++++++++++++++++ app/controllers/movie_controller.rb | 45 ++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+) diff --git a/app/controllers/album_controller.rb b/app/controllers/album_controller.rb index 954eeb990d..5ae8856e18 100644 --- a/app/controllers/album_controller.rb +++ b/app/controllers/album_controller.rb @@ -1,2 +1,48 @@ class AlbumController < ApplicationController + def index + @albums = Album.all + end + + def create + @market = Album.create(album_params) + + redirect_to albums_path + end + + def new + @market = Album.new + end + + def edit + @market = Album.find(params[:id]) + end + + def show + @market = Album.find(params[:id]) + end + + def update + @market = Album.find(params[:id]) + + if @market.update(album_params) + redirect_to album_path + else + render :edit + end + end + + def destroy + @market = Album.find(params[:id]).destroy + + redirect_to albums_path + end + + ####### STRONG PARAMS ######### + + private + + def album_params + params.require(:album).permit(:name, :artist, :description, :rank_points) + end + end diff --git a/app/controllers/book_controller.rb b/app/controllers/book_controller.rb index 9a5a1f8287..b07a0366e0 100644 --- a/app/controllers/book_controller.rb +++ b/app/controllers/book_controller.rb @@ -1,2 +1,48 @@ class BookController < ApplicationController + def index + @books = Book.all + end + + def create + @book = Book.create(book_params) + + redirect_to books_path + end + + def new + @book = Book.new + end + + def edit + @book = Book.find(params[:id]) + end + + def show + @book = Book.find(params[:id]) + end + + def update + @book = Book.find(params[:id]) + + if @book.update(book_params) + redirect_to book_path + else + render :edit + end + end + + def destroy + @book = Book.find(params[:id]).destroy + + redirect_to books_path + end + + ####### STRONG PARAMS ######### + + private + + def book_params + params.require(:book).permit(:name, :author, :description, :rank_points) + end + end diff --git a/app/controllers/movie_controller.rb b/app/controllers/movie_controller.rb index d68e28fb19..22be94e633 100644 --- a/app/controllers/movie_controller.rb +++ b/app/controllers/movie_controller.rb @@ -1,2 +1,47 @@ class MovieController < ApplicationController + def index + @movies = Movie.all + end + + def create + @movie = Movie.create(movie_params) + + redirect_to movies_path + end + + def new + @movie = Movie.new + end + + def edit + @movie = Movie.find(params[:id]) + end + + def show + @movie = Movie.find(params[:id]) + end + + def update + @movie = Movie.find(params[:id]) + + if @movie.update(movie_params) + redirect_to movie_path + else + render :edit + end + end + + def destroy + @movie = Movie.find(params[:id]).destroy + + redirect_to movies_path + end + + ####### STRONG PARAMS ######### + + private + + def movie_params + params.require(:movie).permit(:name, :director, :description, :rank_points) + end end From 04adc1bb4339b03f89980359a1cc277f6df99f7c Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Tue, 11 Oct 2016 11:57:54 -0700 Subject: [PATCH 08/49] Added index views with headers --- app/views/album/index.html.erb | 1 + app/views/book/index.html.erb | 1 + app/views/movie/index.html.erb | 1 + 3 files changed, 3 insertions(+) create mode 100644 app/views/album/index.html.erb create mode 100644 app/views/book/index.html.erb create mode 100644 app/views/movie/index.html.erb diff --git a/app/views/album/index.html.erb b/app/views/album/index.html.erb new file mode 100644 index 0000000000..d727a61dcb --- /dev/null +++ b/app/views/album/index.html.erb @@ -0,0 +1 @@ +

All Albums

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

All Books

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

All Movies

From 7664814d87e116ac9249dfa40a034d5713e1f916 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Tue, 11 Oct 2016 12:03:40 -0700 Subject: [PATCH 09/49] Added sorting mixin, have no idea if it works yet --- app/controllers/album_controller.rb | 3 +++ app/controllers/book_controller.rb | 3 +++ app/controllers/movie_controller.rb | 3 +++ lib/sort_by_rank.rb | 5 +++++ 4 files changed, 14 insertions(+) create mode 100644 lib/sort_by_rank.rb diff --git a/app/controllers/album_controller.rb b/app/controllers/album_controller.rb index 5ae8856e18..36ac4d7765 100644 --- a/app/controllers/album_controller.rb +++ b/app/controllers/album_controller.rb @@ -1,6 +1,9 @@ class AlbumController < ApplicationController + include SortByRank + def index @albums = Album.all + @albums = sort_by_rank(@albums) end def create diff --git a/app/controllers/book_controller.rb b/app/controllers/book_controller.rb index b07a0366e0..de0165b5ec 100644 --- a/app/controllers/book_controller.rb +++ b/app/controllers/book_controller.rb @@ -1,6 +1,9 @@ class BookController < ApplicationController + include SortByRank + def index @books = Book.all + @books = sort_by_rank(@books) end def create diff --git a/app/controllers/movie_controller.rb b/app/controllers/movie_controller.rb index 22be94e633..4623463be6 100644 --- a/app/controllers/movie_controller.rb +++ b/app/controllers/movie_controller.rb @@ -1,6 +1,9 @@ class MovieController < ApplicationController + include SortByRank + def index @movies = Movie.all + @movies = sort_by_rank(@movies) end def create diff --git a/lib/sort_by_rank.rb b/lib/sort_by_rank.rb new file mode 100644 index 0000000000..f11867a2f9 --- /dev/null +++ b/lib/sort_by_rank.rb @@ -0,0 +1,5 @@ +module SortByRank + def sort_by_rank(array) + array.order(rank_points: :desc) + end +end From a994f724d8000e2b29b11e76bf7a0060ac9ccdfd Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Tue, 11 Oct 2016 13:58:12 -0700 Subject: [PATCH 10/49] Turns out I had wrong pluralizations on controllers and view folders. --- .../{album_controller.rb => albums_controller.rb} | 3 ++- .../{book_controller.rb => books_controller.rb} | 3 +-- .../{movie_controller.rb => movies_controller.rb} | 3 +-- app/models/album.rb | 2 ++ app/models/book.rb | 2 ++ app/models/movie.rb | 2 ++ app/views/album/index.html.erb | 14 ++++++++++++++ app/views/albums/index.html.erb | 15 +++++++++++++++ app/views/books/index.html.erb | 1 + app/views/movies/index.html.erb | 1 + config/routes.rb | 4 +--- 11 files changed, 42 insertions(+), 8 deletions(-) rename app/controllers/{album_controller.rb => albums_controller.rb} (90%) rename app/controllers/{book_controller.rb => books_controller.rb} (91%) rename app/controllers/{movie_controller.rb => movies_controller.rb} (91%) create mode 100644 app/views/albums/index.html.erb create mode 100644 app/views/books/index.html.erb create mode 100644 app/views/movies/index.html.erb diff --git a/app/controllers/album_controller.rb b/app/controllers/albums_controller.rb similarity index 90% rename from app/controllers/album_controller.rb rename to app/controllers/albums_controller.rb index 36ac4d7765..8c870ff368 100644 --- a/app/controllers/album_controller.rb +++ b/app/controllers/albums_controller.rb @@ -1,4 +1,5 @@ -class AlbumController < ApplicationController +class AlbumsController < ApplicationController + require 'sort_by_rank.rb' include SortByRank def index diff --git a/app/controllers/book_controller.rb b/app/controllers/books_controller.rb similarity index 91% rename from app/controllers/book_controller.rb rename to app/controllers/books_controller.rb index de0165b5ec..ccf64b1928 100644 --- a/app/controllers/book_controller.rb +++ b/app/controllers/books_controller.rb @@ -1,5 +1,4 @@ -class BookController < ApplicationController - include SortByRank +class BooksController < ApplicationController def index @books = Book.all diff --git a/app/controllers/movie_controller.rb b/app/controllers/movies_controller.rb similarity index 91% rename from app/controllers/movie_controller.rb rename to app/controllers/movies_controller.rb index 4623463be6..6166b1bf6a 100644 --- a/app/controllers/movie_controller.rb +++ b/app/controllers/movies_controller.rb @@ -1,5 +1,4 @@ -class MovieController < ApplicationController - include SortByRank +class MoviesController < ApplicationController def index @movies = Movie.all diff --git a/app/models/album.rb b/app/models/album.rb index 46fa309e4e..dc9f868dca 100644 --- a/app/models/album.rb +++ b/app/models/album.rb @@ -1,2 +1,4 @@ class Album < ActiveRecord::Base + require 'sort_by_rank.rb' + include SortByRank end diff --git a/app/models/book.rb b/app/models/book.rb index 6f68b44465..d7f4f26843 100644 --- a/app/models/book.rb +++ b/app/models/book.rb @@ -1,2 +1,4 @@ class Book < ActiveRecord::Base + require 'sort_by_rank.rb' + include SortByRank end diff --git a/app/models/movie.rb b/app/models/movie.rb index 49198a7d97..a5f369533d 100644 --- a/app/models/movie.rb +++ b/app/models/movie.rb @@ -1,2 +1,4 @@ class Movie < ActiveRecord::Base + require 'sort_by_rank.rb' + include SortByRank end diff --git a/app/views/album/index.html.erb b/app/views/album/index.html.erb index d727a61dcb..311fa6f6dd 100644 --- a/app/views/album/index.html.erb +++ b/app/views/album/index.html.erb @@ -1 +1,15 @@

All Albums

+ + + + + + <% @albums.each do |album| %> + + + + + <% end %> +
Album NameActions
<%= link_to "#{album.name}", album_path(album) %> + <%= link_to "[Edit]", edit_album_path(album) %> + <%= link_to "[Delete]", album_path(album), method: :delete, data: { confirm: "Really, now?" } %>
diff --git a/app/views/albums/index.html.erb b/app/views/albums/index.html.erb new file mode 100644 index 0000000000..311fa6f6dd --- /dev/null +++ b/app/views/albums/index.html.erb @@ -0,0 +1,15 @@ +

All Albums

+ + + + + + <% @albums.each do |album| %> + + + + + <% end %> +
Album NameActions
<%= link_to "#{album.name}", album_path(album) %> + <%= link_to "[Edit]", edit_album_path(album) %> + <%= link_to "[Delete]", album_path(album), method: :delete, data: { confirm: "Really, now?" } %>
diff --git a/app/views/books/index.html.erb b/app/views/books/index.html.erb new file mode 100644 index 0000000000..9d5643723f --- /dev/null +++ b/app/views/books/index.html.erb @@ -0,0 +1 @@ +

All Books

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

All Movies

diff --git a/config/routes.rb b/config/routes.rb index 63095a42ad..7adf654b95 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,5 @@ Rails.application.routes.draw do - resources :albums - resources :books - resources :movies + resources :albums, :books, :movies # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". From b3af3919ff92d948708478330c881c949aec4cff Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Tue, 11 Oct 2016 14:09:37 -0700 Subject: [PATCH 11/49] Fixed the index method in all controllers because it was pulling in double data because i had two instance variables --- app/controllers/albums_controller.rb | 3 +-- app/controllers/books_controller.rb | 3 +-- app/controllers/movies_controller.rb | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index 8c870ff368..42379af22d 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -3,8 +3,7 @@ class AlbumsController < ApplicationController include SortByRank def index - @albums = Album.all - @albums = sort_by_rank(@albums) + @albums = sort_by_rank(Album.all) end def create diff --git a/app/controllers/books_controller.rb b/app/controllers/books_controller.rb index ccf64b1928..e6fb0eeca0 100644 --- a/app/controllers/books_controller.rb +++ b/app/controllers/books_controller.rb @@ -1,8 +1,7 @@ class BooksController < ApplicationController def index - @books = Book.all - @books = sort_by_rank(@books) + @books = sort_by_rank(Book.all) end def create diff --git a/app/controllers/movies_controller.rb b/app/controllers/movies_controller.rb index 6166b1bf6a..e1e38e768f 100644 --- a/app/controllers/movies_controller.rb +++ b/app/controllers/movies_controller.rb @@ -1,8 +1,7 @@ class MoviesController < ApplicationController def index - @movies = Movie.all - @movies = sort_by_rank(@movies) + @movies = sort_by_rank(Movie.all) end def create From d9092edcc1f5b5e1951f94b3b3e45ef645575088 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Tue, 11 Oct 2016 14:12:29 -0700 Subject: [PATCH 12/49] Named my view folders all wrong. Added simple list to index page for all three models --- app/views/album/index.html.erb | 15 --------------- app/views/albums/index.html.erb | 3 +++ app/views/book/index.html.erb | 1 - app/views/books/index.html.erb | 17 +++++++++++++++++ app/views/movie/index.html.erb | 1 - app/views/movies/index.html.erb | 17 +++++++++++++++++ 6 files changed, 37 insertions(+), 17 deletions(-) delete mode 100644 app/views/album/index.html.erb delete mode 100644 app/views/book/index.html.erb delete mode 100644 app/views/movie/index.html.erb diff --git a/app/views/album/index.html.erb b/app/views/album/index.html.erb deleted file mode 100644 index 311fa6f6dd..0000000000 --- a/app/views/album/index.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -

All Albums

- - - - - - <% @albums.each do |album| %> - - - - - <% end %> -
Album NameActions
<%= link_to "#{album.name}", album_path(album) %> - <%= link_to "[Edit]", edit_album_path(album) %> - <%= link_to "[Delete]", album_path(album), method: :delete, data: { confirm: "Really, now?" } %>
diff --git a/app/views/albums/index.html.erb b/app/views/albums/index.html.erb index 311fa6f6dd..d98b8e7bd4 100644 --- a/app/views/albums/index.html.erb +++ b/app/views/albums/index.html.erb @@ -1,11 +1,14 @@

All Albums

+ + <% @albums.each do |album| %> + - + <% @books.each do |book| %> - + + <%= link_to "[Details]", book_path(book) %> <% end %>
Points Album Name Actions
<%= "#{album.rank_points}" %> <%= link_to "#{album.name}", album_path(album) %> <%= link_to "[Edit]", edit_album_path(album) %> diff --git a/app/views/book/index.html.erb b/app/views/book/index.html.erb deleted file mode 100644 index 9d5643723f..0000000000 --- a/app/views/book/index.html.erb +++ /dev/null @@ -1 +0,0 @@ -

All Books

diff --git a/app/views/books/index.html.erb b/app/views/books/index.html.erb index 9d5643723f..de5903bb0a 100644 --- a/app/views/books/index.html.erb +++ b/app/views/books/index.html.erb @@ -1 +1,18 @@

All Books

+ + + + + + + + <% @books.each do |book| %> + + + + + + <% end %> +
PointsBook NameActions
<%= "#{book.rank_points}" %><%= link_to "#{book.name}", book_path(book) %> + <%= link_to "[Edit]", edit_book_path(book) %> + <%= link_to "[Delete]", book_path(book), method: :delete, data: { confirm: "Really, now?" } %>
diff --git a/app/views/movie/index.html.erb b/app/views/movie/index.html.erb deleted file mode 100644 index 49f410818e..0000000000 --- a/app/views/movie/index.html.erb +++ /dev/null @@ -1 +0,0 @@ -

All Movies

diff --git a/app/views/movies/index.html.erb b/app/views/movies/index.html.erb index 49f410818e..0d6b49b925 100644 --- a/app/views/movies/index.html.erb +++ b/app/views/movies/index.html.erb @@ -1 +1,18 @@

All Movies

+ + + + + + + + <% @movies.each do |movie| %> + + + + + + <% end %> +
PointsMovie NameActions
<%= "#{movie.rank_points}" %><%= link_to "#{movie.name}", movie_path(movie) %> + <%= link_to "[Edit]", edit_movie_path(movie) %> + <%= link_to "[Delete]", movie_path(movie), method: :delete, data: { confirm: "Really, now?" } %>
From de297da5e29c71f6a955de581099ac19fb244bb0 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Tue, 11 Oct 2016 15:58:26 -0700 Subject: [PATCH 13/49] Got all basic views for Albums functioning. Adding new album works and sets the rank_points to 1 --- app/controllers/albums_controller.rb | 14 ++++++------ app/controllers/books_controller.rb | 4 +++- app/controllers/movies_controller.rb | 4 +++- app/views/albums/_form.html.erb | 32 ++++++++++++++++++++++++++ app/views/albums/edit.html.erb | 3 +++ app/views/albums/index.html.erb | 9 ++++---- app/views/albums/new.html.erb | 3 +++ app/views/albums/show.html.erb | 20 ++++++++++++++++ app/views/books/_form.html.erb | 0 app/views/books/index.html.erb | 7 +++--- app/views/movies/_form.html.erb | 0 app/views/movies/index.html.erb | 7 +++--- db/seeds.rb | 34 ++++++++++++++-------------- 13 files changed, 98 insertions(+), 39 deletions(-) create mode 100644 app/views/albums/_form.html.erb create mode 100644 app/views/albums/edit.html.erb create mode 100644 app/views/albums/new.html.erb create mode 100644 app/views/albums/show.html.erb create mode 100644 app/views/books/_form.html.erb create mode 100644 app/views/movies/_form.html.erb diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index 42379af22d..5d8a747f96 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -7,27 +7,27 @@ def index end def create - @market = Album.create(album_params) + @album = Album.create(album_params) redirect_to albums_path end def new - @market = Album.new + @album = Album.new end def edit - @market = Album.find(params[:id]) + @album = Album.find(params[:id]) end def show - @market = Album.find(params[:id]) + @album = Album.find(params[:id]) end def update - @market = Album.find(params[:id]) + @album = Album.find(params[:id]) - if @market.update(album_params) + if @album.update(album_params) redirect_to album_path else render :edit @@ -35,7 +35,7 @@ def update end def destroy - @market = Album.find(params[:id]).destroy + @album = Album.find(params[:id]).destroy redirect_to albums_path end diff --git a/app/controllers/books_controller.rb b/app/controllers/books_controller.rb index e6fb0eeca0..bcb5fdb6d6 100644 --- a/app/controllers/books_controller.rb +++ b/app/controllers/books_controller.rb @@ -1,5 +1,7 @@ class BooksController < ApplicationController - + require 'sort_by_rank.rb' + include SortByRank + def index @books = sort_by_rank(Book.all) end diff --git a/app/controllers/movies_controller.rb b/app/controllers/movies_controller.rb index e1e38e768f..23d0d87e5f 100644 --- a/app/controllers/movies_controller.rb +++ b/app/controllers/movies_controller.rb @@ -1,5 +1,7 @@ class MoviesController < ApplicationController - + require 'sort_by_rank.rb' + include SortByRank + def index @movies = sort_by_rank(Movie.all) end diff --git a/app/views/albums/_form.html.erb b/app/views/albums/_form.html.erb new file mode 100644 index 0000000000..6459e65780 --- /dev/null +++ b/app/views/albums/_form.html.erb @@ -0,0 +1,32 @@ +<% if @album.errors.any? %> +
    + <% @album.errors.each do |error, message| %> +
  • <%= error.upcase %><%= message %>
  • + <% end %> +
+<% end %> + +<%= form_for @album, url: path, method: http_method do |f| %> + + + + + + + + + + + + + + + + + <%= f.hidden_field :rank_points, value: 0 %> + + + + +
<%= f.label :name, "Album Name: " %> <%= f.text_field :name, :size => 50 %>
<%= f.label :artist, "Album Artist: " %> <%= f.text_field :artist, :size => 50 %>
<%= f.label :description, "Album Description: " %><%= f.text_field :description, :size => 75 %>
<%= f.submit "Submit Album Info" %>
+<% end %> diff --git a/app/views/albums/edit.html.erb b/app/views/albums/edit.html.erb new file mode 100644 index 0000000000..d75bb52df4 --- /dev/null +++ b/app/views/albums/edit.html.erb @@ -0,0 +1,3 @@ +

Edit Album

+ +<%= render partial: "form", locals: {path: album_path, http_method: :patch} %> diff --git a/app/views/albums/index.html.erb b/app/views/albums/index.html.erb index d98b8e7bd4..33c2636ea0 100644 --- a/app/views/albums/index.html.erb +++ b/app/views/albums/index.html.erb @@ -1,18 +1,17 @@

All Albums

- +
<%= link_to "Submit a new album for voting", new_album_path %>
- + <% @albums.each do |album| %> - + + <%= link_to "[Details]", album_path(album) %> <% end %>
Points Album NameActionsMore...
<%= "#{album.rank_points}" %><%= link_to "#{album.name}", album_path(album) %><%= "#{album.name}" %> - <%= link_to "[Edit]", edit_album_path(album) %> - <%= link_to "[Delete]", album_path(album), method: :delete, data: { confirm: "Really, now?" } %>
diff --git a/app/views/albums/new.html.erb b/app/views/albums/new.html.erb new file mode 100644 index 0000000000..5bbb339f41 --- /dev/null +++ b/app/views/albums/new.html.erb @@ -0,0 +1,3 @@ +

Create New Album

+ +<%= render partial: "form", locals: {path: albums_path, http_method: :post} %> diff --git a/app/views/albums/show.html.erb b/app/views/albums/show.html.erb new file mode 100644 index 0000000000..a53225eca5 --- /dev/null +++ b/app/views/albums/show.html.erb @@ -0,0 +1,20 @@ +

Detailed Album Info

+ + + + + + + + + + + + + + + + +
PointsAlbum NameAlbum ArtistAlbum DescriptionActions
<%= "#{@album.rank_points}" %><%= "#{@album.name}" %><%= "#{@album.artist}" %><%= "#{@album.description}" %> + <%= link_to "[Edit]", edit_album_path(@album) %> + <%= link_to "[Delete]", album_path(@album), method: :delete, data: { confirm: "Really, now?" } %>
diff --git a/app/views/books/_form.html.erb b/app/views/books/_form.html.erb new file mode 100644 index 0000000000..e69de29bb2 diff --git a/app/views/books/index.html.erb b/app/views/books/index.html.erb index de5903bb0a..e1135a45b6 100644 --- a/app/views/books/index.html.erb +++ b/app/views/books/index.html.erb @@ -4,15 +4,14 @@
Points Book NameActionsMore...
<%= "#{book.rank_points}" %><%= link_to "#{book.name}", book_path(book) %><%= "#{book.name}" %> - <%= link_to "[Edit]", edit_book_path(book) %> - <%= link_to "[Delete]", book_path(book), method: :delete, data: { confirm: "Really, now?" } %>
diff --git a/app/views/movies/_form.html.erb b/app/views/movies/_form.html.erb new file mode 100644 index 0000000000..e69de29bb2 diff --git a/app/views/movies/index.html.erb b/app/views/movies/index.html.erb index 0d6b49b925..ec0dd53a20 100644 --- a/app/views/movies/index.html.erb +++ b/app/views/movies/index.html.erb @@ -4,15 +4,14 @@ Points Movie Name - Actions + More... <% @movies.each do |movie| %> <%= "#{movie.rank_points}" %> - <%= link_to "#{movie.name}", movie_path(movie) %> + <%= "#{movie.name}" %> - <%= link_to "[Edit]", edit_movie_path(movie) %> - <%= link_to "[Delete]", movie_path(movie), method: :delete, data: { confirm: "Really, now?" } %> + <%= link_to "[Details]", movie_path(movie) %> <% end %> diff --git a/db/seeds.rb b/db/seeds.rb index caf2e0ca65..2f92d52c86 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -14,29 +14,29 @@ albums = [ - {name: "The #{colors.sample.capitalize} Album", artist: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}" , description: "This album is #{adjectives.sample}!", rank_points: 0 }, - {name: "The #{colors.sample.capitalize} Album", artist: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This album is #{adjectives.sample}!", rank_points: 0 }, - {name: "The #{colors.sample.capitalize} Album", artist: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This album is #{adjectives.sample}!", rank_points: 0 }, - {name: "The #{colors.sample.capitalize} Album", artist: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This album is #{adjectives.sample}!", rank_points: 0 }, - {name: "The #{colors.sample.capitalize} Album", artist: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}" , description: "This album is #{adjectives.sample}!", rank_points: 0 }, - {name: "The #{colors.sample.capitalize} Album", artist: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}" , description: "This album is #{adjectives.sample}!", rank_points: 0 } + {name: "The #{colors.sample.capitalize} Album", artist: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}" , description: "This album is #{adjectives.sample}!", rank_points: rand(0..40) }, + {name: "The #{colors.sample.capitalize} Album", artist: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This album is #{adjectives.sample}!", rank_points: rand(0..40) }, + {name: "The #{colors.sample.capitalize} Album", artist: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This album is #{adjectives.sample}!", rank_points: rand(0..40) }, + {name: "The #{colors.sample.capitalize} Album", artist: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This album is #{adjectives.sample}!", rank_points: rand(0..40) }, + {name: "The #{colors.sample.capitalize} Album", artist: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}" , description: "This album is #{adjectives.sample}!", rank_points: rand(0..40) }, + {name: "The #{colors.sample.capitalize} Album", artist: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}" , description: "This album is #{adjectives.sample}!", rank_points: rand(0..40) } ] books = [ - {name: "The Chronicle of a #{nouns.sample.capitalize}", author: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This book was really #{adjectives.sample}!", rank_points: 0 }, - {name: "The Chronicle of a #{nouns.sample.capitalize}", author: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This book was really #{adjectives.sample}!" , rank_points: 0 }, - {name: "The Chronicle of a #{nouns.sample.capitalize}", author: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This book was really #{adjectives.sample}!" , rank_points: 0 }, - {name: "The Chronicle of a #{nouns.sample.capitalize}", author: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This book was really #{adjectives.sample}!" , rank_points: 0 }, - {name: "The Chronicle of a #{nouns.sample.capitalize}", author: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This book was really #{adjectives.sample}!" , rank_points: 0 }, - {name: "The Chronicle of a #{nouns.sample.capitalize}", author: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This book was really #{adjectives.sample}!" , rank_points: 0 } + {name: "The Chronicle of a #{nouns.sample.capitalize}", author: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This book was really #{adjectives.sample}!", rank_points: rand(0..40) }, + {name: "The Chronicle of a #{nouns.sample.capitalize}", author: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This book was really #{adjectives.sample}!" , rank_points: rand(0..40) }, + {name: "The Chronicle of a #{nouns.sample.capitalize}", author: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This book was really #{adjectives.sample}!" , rank_points: rand(0..40) }, + {name: "The Chronicle of a #{nouns.sample.capitalize}", author: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This book was really #{adjectives.sample}!" , rank_points: rand(0..40) }, + {name: "The Chronicle of a #{nouns.sample.capitalize}", author: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This book was really #{adjectives.sample}!" , rank_points: rand(0..40) }, + {name: "The Chronicle of a #{nouns.sample.capitalize}", author: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This book was really #{adjectives.sample}!" , rank_points: rand(0..40) } ] movies = [ - {name: "The #{gerunds.sample.capitalize} #{nouns.sample.capitalize}", director: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This movie was #{adjectives.sample}", rank_points: 0 }, - {name: "The #{gerunds.sample.capitalize} #{nouns.sample.capitalize}", director: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This movie was #{adjectives.sample}", rank_points: 0 }, - {name: "The #{gerunds.sample.capitalize} #{nouns.sample.capitalize}", director: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This movie was #{adjectives.sample}", rank_points: 0 }, - {name: "The #{gerunds.sample.capitalize} #{nouns.sample.capitalize}", director: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This movie was #{adjectives.sample}", rank_points: 0 }, - {name: "The #{gerunds.sample.capitalize} #{nouns.sample.capitalize}", director: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This movie was #{adjectives.sample}", rank_points: 0 } + {name: "The #{gerunds.sample.capitalize} #{nouns.sample.capitalize}", director: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This movie was #{adjectives.sample}", rank_points: rand(0..40) }, + {name: "The #{gerunds.sample.capitalize} #{nouns.sample.capitalize}", director: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This movie was #{adjectives.sample}", rank_points: rand(0..40) }, + {name: "The #{gerunds.sample.capitalize} #{nouns.sample.capitalize}", director: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This movie was #{adjectives.sample}", rank_points: rand(0..40) }, + {name: "The #{gerunds.sample.capitalize} #{nouns.sample.capitalize}", director: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This movie was #{adjectives.sample}", rank_points: rand(0..40) }, + {name: "The #{gerunds.sample.capitalize} #{nouns.sample.capitalize}", director: "#{first_names.sample.capitalize} #{last_names.sample.capitalize}", description: "This movie was #{adjectives.sample}", rank_points: rand(0..40) } ] From 54e95908086216187c4a7283c2b43d1e3100ad9e Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Tue, 11 Oct 2016 16:00:13 -0700 Subject: [PATCH 14/49] Changing default value of rank_points when creating a new album to 1 instead of 0 --- app/views/albums/_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/albums/_form.html.erb b/app/views/albums/_form.html.erb index 6459e65780..53f4fdf396 100644 --- a/app/views/albums/_form.html.erb +++ b/app/views/albums/_form.html.erb @@ -23,7 +23,7 @@ <%= f.text_field :description, :size => 75 %> - <%= f.hidden_field :rank_points, value: 0 %> + <%= f.hidden_field :rank_points, value: 1 %> <%= f.submit "Submit Album Info" %> From bcb151a85536bb13bdb836c2b0703089c1df5f1e Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Tue, 11 Oct 2016 16:10:39 -0700 Subject: [PATCH 15/49] Book views completed with basic functionality and fanciness --- app/views/books/_form.html.erb | 32 ++++++++++++++++++++++++++++++++ app/views/books/edit.html.erb | 3 +++ app/views/books/new.html.erb | 3 +++ app/views/books/show.html.erb | 20 ++++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 app/views/books/edit.html.erb create mode 100644 app/views/books/new.html.erb create mode 100644 app/views/books/show.html.erb diff --git a/app/views/books/_form.html.erb b/app/views/books/_form.html.erb index e69de29bb2..6461da9e12 100644 --- a/app/views/books/_form.html.erb +++ b/app/views/books/_form.html.erb @@ -0,0 +1,32 @@ +<% if @book.errors.any? %> +
    + <% @book.errors.each do |error, message| %> +
  • <%= error.upcase %><%= message %>
  • + <% end %> +
+<% end %> + +<%= form_for @book, url: path, method: http_method do |f| %> + + + + + + + + + + + + + + + + + <%= f.hidden_field :rank_points, value: 1 %> + + + + +
<%= f.label :name, "Book Name: " %> <%= f.text_field :name, :size => 50 %>
<%= f.label :author, "Book Author: " %> <%= f.text_field :author, :size => 50 %>
<%= f.label :description, "Book Description: " %><%= f.text_field :description, :size => 75 %>
<%= f.submit "Submit Book Info" %>
+<% end %> diff --git a/app/views/books/edit.html.erb b/app/views/books/edit.html.erb new file mode 100644 index 0000000000..e0a338e6b0 --- /dev/null +++ b/app/views/books/edit.html.erb @@ -0,0 +1,3 @@ +

Edit Book

+ +<%= render partial: "form", locals: {path: book_path, http_method: :patch} %> diff --git a/app/views/books/new.html.erb b/app/views/books/new.html.erb new file mode 100644 index 0000000000..81dd111e42 --- /dev/null +++ b/app/views/books/new.html.erb @@ -0,0 +1,3 @@ +

Create New Book

+ +<%= render partial: "form", locals: {path: bookss_path, http_method: :post} %> diff --git a/app/views/books/show.html.erb b/app/views/books/show.html.erb new file mode 100644 index 0000000000..f9ac0e961a --- /dev/null +++ b/app/views/books/show.html.erb @@ -0,0 +1,20 @@ +

Detailed Book Info

+ + + + + + + + + + + + + + + + +
PointsBook NameBook AuthorBook DescriptionActions
<%= "#{@book.rank_points}" %><%= "#{@book.name}" %><%= "#{@book.author}" %><%= "#{@book.description}" %> + <%= link_to "[Edit]", edit_book_path(@book) %> + <%= link_to "[Delete]", book_path(@book), method: :delete, data: { confirm: "Really, now?" } %>
From 0d5680e8fabc4a82a16bff80edd6c898475be2cc Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Tue, 11 Oct 2016 16:12:20 -0700 Subject: [PATCH 16/49] Added 'create new book' option with a default single upvote --- app/views/books/index.html.erb | 2 +- app/views/books/new.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/books/index.html.erb b/app/views/books/index.html.erb index e1135a45b6..817cc5f404 100644 --- a/app/views/books/index.html.erb +++ b/app/views/books/index.html.erb @@ -1,5 +1,5 @@

All Books

- +
<%= link_to "Submit a new book for voting", new_book_path %>
diff --git a/app/views/books/new.html.erb b/app/views/books/new.html.erb index 81dd111e42..cf26cd8030 100644 --- a/app/views/books/new.html.erb +++ b/app/views/books/new.html.erb @@ -1,3 +1,3 @@

Create New Book

-<%= render partial: "form", locals: {path: bookss_path, http_method: :post} %> +<%= render partial: "form", locals: {path: books_path, http_method: :post} %> From 31324a7982c9239ed231d68ae5d93cd2c797b3a8 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Tue, 11 Oct 2016 16:19:43 -0700 Subject: [PATCH 17/49] Did all the basic views for movies. --- app/views/movies/_form.html.erb | 32 ++++++++++++++++++++++++++++++++ app/views/movies/edit.html.erb | 3 +++ app/views/movies/index.html.erb | 2 +- app/views/movies/new.html.erb | 3 +++ app/views/movies/show.html.erb | 20 ++++++++++++++++++++ 5 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 app/views/movies/edit.html.erb create mode 100644 app/views/movies/new.html.erb create mode 100644 app/views/movies/show.html.erb diff --git a/app/views/movies/_form.html.erb b/app/views/movies/_form.html.erb index e69de29bb2..46e9abbeef 100644 --- a/app/views/movies/_form.html.erb +++ b/app/views/movies/_form.html.erb @@ -0,0 +1,32 @@ +<% if @movie.errors.any? %> +
    + <% @movie.errors.each do |error, message| %> +
  • <%= error.upcase %><%= message %>
  • + <% end %> +
+<% end %> + +<%= form_for @movie, url: path, method: http_method do |f| %> +
Points
+ + + + + + + + + + + + + + + + <%= f.hidden_field :rank_points, value: 1 %> + + + + +
<%= f.label :name, "Movie Name: " %> <%= f.text_field :name, :size => 50 %>
<%= f.label :director, "Movie Director: " %> <%= f.text_field :director, :size => 50 %>
<%= f.label :description, "Movie Description: " %><%= f.text_field :description, :size => 75 %>
<%= f.submit "Submit Movie Info" %>
+<% end %> diff --git a/app/views/movies/edit.html.erb b/app/views/movies/edit.html.erb new file mode 100644 index 0000000000..7e3da682ad --- /dev/null +++ b/app/views/movies/edit.html.erb @@ -0,0 +1,3 @@ +

Edit Movie

+ +<%= render partial: "form", locals: {path: movie_path, http_method: :patch} %> diff --git a/app/views/movies/index.html.erb b/app/views/movies/index.html.erb index ec0dd53a20..4d3b8ffbb6 100644 --- a/app/views/movies/index.html.erb +++ b/app/views/movies/index.html.erb @@ -1,5 +1,5 @@

All Movies

- +
<%= link_to "Submit a new movie for voting", new_movie_path %>
diff --git a/app/views/movies/new.html.erb b/app/views/movies/new.html.erb new file mode 100644 index 0000000000..b0bdd85185 --- /dev/null +++ b/app/views/movies/new.html.erb @@ -0,0 +1,3 @@ +

Create New Movie

+ +<%= render partial: "form", locals: {path: movies_path, http_method: :post} %> diff --git a/app/views/movies/show.html.erb b/app/views/movies/show.html.erb new file mode 100644 index 0000000000..a170bee02d --- /dev/null +++ b/app/views/movies/show.html.erb @@ -0,0 +1,20 @@ +

Detailed Movie Info

+ +
Points
+ + + + + + + + + + + + + + +
PointsMovie NameMovie DirectorMovie DescriptionActions
<%= "#{@movie.rank_points}" %><%= "#{@movie.name}" %><%= "#{@movie.director}" %><%= "#{@movie.description}" %> + <%= link_to "[Edit]", edit_movie_path(@movie) %> + <%= link_to "[Delete]", movie_path(@movie), method: :delete, data: { confirm: "Really, now?" } %>
From 4d5cc2effb5791338dc9b4ae5b9a0afe2305cc11 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Tue, 11 Oct 2016 16:50:05 -0700 Subject: [PATCH 18/49] Configured homepage to display top 5 in all categories --- app/controllers/homepage_controller.rb | 13 +++++++++++ app/views/albums/index.html.erb | 5 ++-- app/views/homepage/index.html.erb | 32 ++++++++++++++++++++++++++ config/routes.rb | 1 + 4 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 app/controllers/homepage_controller.rb create mode 100644 app/views/homepage/index.html.erb diff --git a/app/controllers/homepage_controller.rb b/app/controllers/homepage_controller.rb new file mode 100644 index 0000000000..601762853c --- /dev/null +++ b/app/controllers/homepage_controller.rb @@ -0,0 +1,13 @@ +class HomepageController < ApplicationController + require 'sort_by_rank.rb' + include SortByRank + + def index + albums = sort_by_rank(Album.all) + @albums = albums.first(5) + books = sort_by_rank(Book.all) + @books = books.first(5) + movies = sort_by_rank(Movie.all) + @movies = movies.first(5) + end +end diff --git a/app/views/albums/index.html.erb b/app/views/albums/index.html.erb index 33c2636ea0..aff1df21e5 100644 --- a/app/views/albums/index.html.erb +++ b/app/views/albums/index.html.erb @@ -6,12 +6,11 @@ Album Name More... + <% @albums.each do |album| %> <%= "#{album.rank_points}" %> <%= "#{album.name}" %> - - <%= link_to "[Details]", album_path(album) %> - + <%= link_to "[Details]", album_path(album) %> <% end %> diff --git a/app/views/homepage/index.html.erb b/app/views/homepage/index.html.erb new file mode 100644 index 0000000000..5e4132fb38 --- /dev/null +++ b/app/views/homepage/index.html.erb @@ -0,0 +1,32 @@ +

Top Five For All Categories

+ +
<%= link_to "Submit a new album for voting", new_album_path %>
+
<%= link_to "Submit a new book for voting", new_book_path %>
+
<%= link_to "Submit a new movie for voting", new_movie_path %>
+ + + + + + + + + <% 5.times do |i| %> + + + + + + + + + + + <% end %> + + + + + + +
AlbumsBooksMovies
<%= "#{@albums[i].rank_points}" %><%= "#{@albums[i].name}" %><%= "#{@books[i].rank_points}" %><%= "#{@books[i].name}" %><%= "#{@movies[i].rank_points}" %><%= "#{@movies[i].name}" %>
<%= link_to "More Albums...", albums_path %><%= link_to "More Books...", books_path %><%= link_to "More Movies...", movies_path %>
diff --git a/config/routes.rb b/config/routes.rb index 7adf654b95..d6e456b85b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,5 @@ Rails.application.routes.draw do + root 'homepage#index' resources :albums, :books, :movies # The priority is based upon order of creation: first created -> highest priority. From 8692a3e511216b1904e8542090570d999b82e8bb Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Tue, 11 Oct 2016 16:52:38 -0700 Subject: [PATCH 19/49] Decided to just do a times loop to pull first five, versus .find-ing the five in the controller --- app/controllers/homepage_controller.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/controllers/homepage_controller.rb b/app/controllers/homepage_controller.rb index 601762853c..a97053d9b0 100644 --- a/app/controllers/homepage_controller.rb +++ b/app/controllers/homepage_controller.rb @@ -3,11 +3,8 @@ class HomepageController < ApplicationController include SortByRank def index - albums = sort_by_rank(Album.all) - @albums = albums.first(5) - books = sort_by_rank(Book.all) - @books = books.first(5) - movies = sort_by_rank(Movie.all) - @movies = movies.first(5) + @albums = sort_by_rank(Album.all) + @books = sort_by_rank(Book.all) + @movies = sort_by_rank(Movie.all) end end From 3cee8751b74cfa9f07297b09622f207987c63757 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Wed, 12 Oct 2016 16:30:49 -0700 Subject: [PATCH 20/49] Added vote mixin (not sure if it should be a mixin or not), added upvote methods to albums and button to homepage and it works --- app/assets/images/up_arrow.png | Bin 0 -> 2633 bytes app/controllers/albums_controller.rb | 9 +++++++++ app/views/homepage/index.html.erb | 15 ++++++++------- config/routes.rb | 1 + lib/vote.rb | 13 +++++++++++++ 5 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 app/assets/images/up_arrow.png create mode 100644 lib/vote.rb diff --git a/app/assets/images/up_arrow.png b/app/assets/images/up_arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..e0da850f5c7e6f346fd7ed3c9f486cedc4f4ab58 GIT binary patch literal 2633 zcmdT`do)yQAD$UA*prOfT@Z%UOrj{aVQA1)iWx$sLZlNSm*ZB+IA@xo6CoYNn1&c2qX-V2xSF$3Vz_}0S5-I&K^79kV>^%eBf|#{7({%R`_QQ3WZv| zdeuJ}xRru}f~Ka%A_<3zii(Tje**weMx)XC`g#})2DvcQ)NnAfY?<0mV{kbNg~Vb3 zxE0L9DXOYV7d`(3uoHMJtd4@y763deAdzxEux+>se#7O9nK1LSWMR#P&00W9RoOWvrVmZ+$zpm3_F zWv$w+;#}(qa#(7CZ_pM|xRZ;JB)ndVKqz0@O||zp)iuuX4g+_suoJUrLszlegQi_C zt+xxkxyqoxvFsiyeheQ5+GE__I-cI(i4mc84E|1fc+sDnwe7*UcTvsM+3vW2{oOV` zo4Rbz`EzX#1uU17(t-tE26lYXwSlLi2p4w(D zB8P=qc({v^M{YJgd4=C@8GJ_)vg0IlSJ7*vsYwy5`yE@At|K){Q0aM)m!02v&uyaV z?fcs{usDOY3s_QoLr1y}7L5jq3^2Lv_%^Z@EM36bah(~M&^s#;1yhra-L2VynG!Co z=wVzO@i6i+Y_L8ZT-Panp-~VcZ49|Nf7ut-ou+ZfM=NvXj@0_rcB~p@& zo!;s@<9&8(^_rXk@_ZcHVeXg) zW%LtokdroNyCti7*Udp*&DA6LVNROJR1X<{W(7#81PLZRFY2UHYrhhpp;j=)dQMPR zqHw`gY+obDi|!f1luSrTa`Bl!1dFE(H!{u;bAp)Z5_hsF1WZohwgDsN{0`Y}PTE6Y zW&$MZIe}jXh|vz2gwfY7qbws@3zyprSY_)fQnJ9UX7*Z)wZvnAOi$<;-LVZVkp*$m z?g2+9GpzOYg3pF-M>%8@lA2sbSY|XeF837>l&y=Qq=2nv_L>YV@n#Uy1Cr4l-=fE4 zC7iTdfZODNwH^(;In*dGbZknM7pC37Hvzk|b(JW8fqz-r>oClS)G%hsW*p@T9P=;q z_cum3d?s|b(kvJ&h}2N#6G)k!)Qzs5UdB-?04AjaR(d-@6@Kb4OPOY(LdgVYEcvbw zi9RYs*Gv3Kc?qD(OR<8?v70JaGh_N6_XXRq@@4_D72isQ*DwMPSqS#1>d4f8Q zmjRx!@v3xm}{i`{e;k~!}&4mbck3M%=`j{@<7eU!N$$*)_LCG;P3&&M_CUeqZt^_ z_Elz-FG<;-@k)+$8G$bQ5g+6bF}IhiUWBNCJMz__Gf|tyu({;CeV|GmC98Z5l^)oQ zuAfvWTeD7%wo5^)ya-T5z{@kpX(@y6l}kVC0?kB~fg+lPFiFswUWi4nDhAd{g3*kv zM6Y+~5}7#)z8#wbnGq6qE5Fn7d({BEX8VpC*7hGDK`ZEx@3DpW!5Xg!%vI0X%F z+{`2NS4P!ULy_!0J+Hfpyg$L_5v~wDKi+nu`so9cXP%F)Kk7$;@9_+t(Pvq|>WRKa*^T9UppCUWQ3+ zE7sFJ>v&(S_`Ord&1Kg}egKaj$*l3ISqojtDP{>rt@zuct<-r#LJPy_y5)@e5j3vP zZ3E-vv?X$nJV9o~zg&oczmB@C4Cx5E(p3Ksc0wVzdDt?J9)6TsA{9i`J%?@ywZHs` zDLDwtX%M}hg-Lrv^V?3E8}g5Y*PVy<3$;Tn4>j$XaIq5Ye|T=HM--DE-FPnHTnc4` zm3ldK8IRokbRHtqKK*r|JsE28iH}{4=*9OlVr6zbuTMI&(9#10#&7&SiKbR`3!EHZ zw2_ZPa8#)kViRND`{V$jC~5lil=kIJZm`g=i{N=aJ~4>x3(cxVn(57I2%pwROiIVe zT0{yAZD=hq4V7Y(17KNB2~76iAl-^j%pVTuh$Wq1T!>H99}eh@B^_s6{txR4mT}VI z%zHpr^PMT}LT7MoS8SCv%{e>Q%szU@WMGeZ z7Dw&KYiCfaxfk>koG=I$1jg)%+hj@$C&jt2Y!A~8DjhG~Hdfxf!Gb^c*>>4f$ogMw z&2wz?pJcu<3T7&pN5Wa|(U@FZ+3V!dnMVYYhv|1}N9m=pxEc%2xSEd>BNI{EHTW$p zcHOhiHruMJzt%M2E5j@1ej7gYM=2UHGd3%Fhx_;$RXv2bv&9O;^1*BQLple7a|0C{}{GVs{4m!2a!I$}O)Y^6p literal 0 HcmV?d00001 diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index 5d8a747f96..3ec0dc53e2 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -1,6 +1,8 @@ class AlbumsController < ApplicationController require 'sort_by_rank.rb' + require 'vote.rb' include SortByRank + include Vote def index @albums = sort_by_rank(Album.all) @@ -34,6 +36,13 @@ def update end end + def upvote + album = Album.find(params[:id]) + add_vote(album).save + + redirect_to albums_path + end + def destroy @album = Album.find(params[:id]).destroy diff --git a/app/views/homepage/index.html.erb b/app/views/homepage/index.html.erb index 5e4132fb38..0b59890dee 100644 --- a/app/views/homepage/index.html.erb +++ b/app/views/homepage/index.html.erb @@ -6,13 +6,14 @@ - - - + + + <% 5.times do |i| %> + @@ -23,10 +24,10 @@ <% end %> - + - - - + + +
AlbumsBooksMoviesAlbumsBooksMovies
<%= button_to "Upvote", upvote_album_path(@albums[i]), contoller: :albums, action: :upvote, method: :patch %> <%= "#{@albums[i].rank_points}" %> <%= "#{@albums[i].name}" %><%= "#{@movies[i].name}" %>
<%= link_to "More Albums...", albums_path %><%= link_to "More Books...", books_path %><%= link_to "More Movies...", movies_path %><%= link_to "More Albums...", albums_path %><%= link_to "More Books...", books_path %><%= link_to "More Movies...", movies_path %>
diff --git a/config/routes.rb b/config/routes.rb index d6e456b85b..8fec2e87b5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,6 @@ Rails.application.routes.draw do root 'homepage#index' + patch '/albums/:id', to: "albums#upvote", as: 'upvote_album' resources :albums, :books, :movies # The priority is based upon order of creation: first created -> highest priority. diff --git a/lib/vote.rb b/lib/vote.rb new file mode 100644 index 0000000000..16555875cb --- /dev/null +++ b/lib/vote.rb @@ -0,0 +1,13 @@ +module Vote + def add_vote(record) + record.rank_points += 1 + record.save + return record + end + + def subtract_vote(record) + record.rank_points -= 1 + record.save + return record + end +end From 4215b4187f0f0f28a7293ac3545bf8ef75309649 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Wed, 12 Oct 2016 16:50:29 -0700 Subject: [PATCH 21/49] Added upvote buttons and logic to books and movies --- app/controllers/books_controller.rb | 11 ++++++++++- app/controllers/movies_controller.rb | 11 ++++++++++- app/views/homepage/index.html.erb | 2 ++ config/routes.rb | 4 ++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/controllers/books_controller.rb b/app/controllers/books_controller.rb index bcb5fdb6d6..6288e41726 100644 --- a/app/controllers/books_controller.rb +++ b/app/controllers/books_controller.rb @@ -1,7 +1,9 @@ class BooksController < ApplicationController require 'sort_by_rank.rb' + require 'vote.rb' include SortByRank - + include Vote + def index @books = sort_by_rank(Book.all) end @@ -40,6 +42,13 @@ def destroy redirect_to books_path end + def upvote + book = Book.find(params[:id]) + add_vote(book).save + + redirect_to books_path + end + ####### STRONG PARAMS ######### private diff --git a/app/controllers/movies_controller.rb b/app/controllers/movies_controller.rb index 23d0d87e5f..12f3dc80ba 100644 --- a/app/controllers/movies_controller.rb +++ b/app/controllers/movies_controller.rb @@ -1,7 +1,9 @@ class MoviesController < ApplicationController require 'sort_by_rank.rb' + require 'vote.rb' include SortByRank - + include Vote + def index @movies = sort_by_rank(Movie.all) end @@ -34,6 +36,13 @@ def update end end + def upvote + movie = Movie.find(params[:id]) + add_vote(movie).save + + redirect_to movies_path + end + def destroy @movie = Movie.find(params[:id]).destroy diff --git a/app/views/homepage/index.html.erb b/app/views/homepage/index.html.erb index 0b59890dee..aa1fcdc2aa 100644 --- a/app/views/homepage/index.html.erb +++ b/app/views/homepage/index.html.erb @@ -17,9 +17,11 @@ <%= "#{@albums[i].rank_points}" %> <%= "#{@albums[i].name}" %> + <%= button_to "Upvote", upvote_book_path(@books[i]), contoller: :books, action: :upvote, method: :patch %> <%= "#{@books[i].rank_points}" %> <%= "#{@books[i].name}" %> + <%= button_to "Upvote", upvote_movie_path(@movies[i]), contoller: :movies, action: :upvote, method: :patch %> <%= "#{@movies[i].rank_points}" %> <%= "#{@movies[i].name}" %> diff --git a/config/routes.rb b/config/routes.rb index 8fec2e87b5..4f8fa22eee 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,10 @@ Rails.application.routes.draw do root 'homepage#index' + patch '/albums/:id', to: "albums#upvote", as: 'upvote_album' + patch '/books/:id', to: "books#upvote", as: 'upvote_book' + patch '/movies/:id', to: "movies#upvote", as: 'upvote_movie' + resources :albums, :books, :movies # The priority is based upon order of creation: first created -> highest priority. From 73435447c5cadeaa8d98856a21a3508be28cff5a Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Thu, 13 Oct 2016 14:14:51 -0700 Subject: [PATCH 22/49] Added Foundation CSS styling file --- app/assets/stylesheets/application.css | 2 + app/assets/stylesheets/foundation.css | 4194 ++++++++++++++++++++++++ 2 files changed, 4196 insertions(+) create mode 100644 app/assets/stylesheets/foundation.css diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index f9cd5b3483..0fa2fb3301 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -13,3 +13,5 @@ *= require_tree . *= require_self */ + + @import url('foundation.css') diff --git a/app/assets/stylesheets/foundation.css b/app/assets/stylesheets/foundation.css new file mode 100644 index 0000000000..66aca962de --- /dev/null +++ b/app/assets/stylesheets/foundation.css @@ -0,0 +1,4194 @@ +@charset "UTF-8"; +/** + * Foundation for Sites by ZURB + * Version 6.2.3 + * foundation.zurb.com + * Licensed under MIT Open Source + */ +/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS and IE text size adjust after device orientation change, + * without disabling user zoom. + */ +html { + font-family: sans-serif; + /* 1 */ + -ms-text-size-adjust: 100%; + /* 2 */ + -webkit-text-size-adjust: 100%; + /* 2 */ } + +/** + * Remove default margin. + */ +body { + margin: 0; } + +/* HTML5 display definitions + ========================================================================== */ +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; } + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ +audio, +canvas, +progress, +video { + display: inline-block; + /* 1 */ + vertical-align: baseline; + /* 2 */ } + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ +audio:not([controls]) { + display: none; + height: 0; } + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/10/11, Safari, and Firefox < 22. + */ +[hidden], +template { + display: none; } + +/* Links + ========================================================================== */ +/** + * Remove the gray background color from active links in IE 10. + */ +a { + background-color: transparent; } + +/** + * Improve readability of focused elements when they are also in an + * active/hover state. + */ +a:active, +a:hover { + outline: 0; } + +/* Text-level semantics + ========================================================================== */ +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ +abbr[title] { + border-bottom: 1px dotted; } + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ +b, +strong { + font-weight: bold; } + +/** + * Address styling not present in Safari and Chrome. + */ +dfn { + font-style: italic; } + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ +h1 { + font-size: 2em; + margin: 0.67em 0; } + +/** + * Address styling not present in IE 8/9. + */ +mark { + background: #ff0; + color: #000; } + +/** + * Address inconsistent and variable font size in all browsers. + */ +small { + font-size: 80%; } + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; } + +sup { + top: -0.5em; } + +sub { + bottom: -0.25em; } + +/* Embedded content + ========================================================================== */ +/** + * Remove border when inside `a` element in IE 8/9/10. + */ +img { + border: 0; } + +/** + * Correct overflow not hidden in IE 9/10/11. + */ +svg:not(:root) { + overflow: hidden; } + +/* Grouping content + ========================================================================== */ +/** + * Address margin not present in IE 8/9 and Safari. + */ +figure { + margin: 1em 40px; } + +/** + * Address differences between Firefox and other browsers. + */ +hr { + box-sizing: content-box; + height: 0; } + +/** + * Contain overflow in all browsers. + */ +pre { + overflow: auto; } + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; } + +/* Forms + ========================================================================== */ +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ +button, +input, +optgroup, +select, +textarea { + color: inherit; + /* 1 */ + font: inherit; + /* 2 */ + margin: 0; + /* 3 */ } + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ +button { + overflow: visible; } + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ +button, +select { + text-transform: none; } + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ +button, +html input[type="button"], +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; + /* 2 */ + cursor: pointer; + /* 3 */ } + +/** + * Re-set default cursor for disabled elements. + */ +button[disabled], +html input[disabled] { + cursor: not-allowed; } + +/** + * Remove inner padding and border in Firefox 4+. + */ +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; } + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ +input { + line-height: normal; } + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; + /* 1 */ + padding: 0; + /* 2 */ } + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; } + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome. + */ +input[type="search"] { + -webkit-appearance: textfield; + /* 1 */ + box-sizing: content-box; + /* 2 */ } + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; } + +/** + * Define consistent border, margin, and padding. + * [NOTE] We don't enable this ruleset in Foundation, because we want the
element to have plain styling. + */ +/* fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; + } */ +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ +legend { + border: 0; + /* 1 */ + padding: 0; + /* 2 */ } + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ +textarea { + overflow: auto; } + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ +optgroup { + font-weight: bold; } + +/* Tables + ========================================================================== */ +/** + * Remove most spacing between table cells. + */ +table { + border-collapse: collapse; + border-spacing: 0; } + +td, +th { + padding: 0; } + +.foundation-mq { + font-family: "small=0em&medium=40em&large=64em&xlarge=75em&xxlarge=90em"; } + +html { + font-size: 100%; + box-sizing: border-box; } + +*, +*::before, +*::after { + box-sizing: inherit; } + +body { + padding: 0; + margin: 0; + font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; + font-weight: normal; + line-height: 1.5; + color: #0a0a0a; + background: #fefefe; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; } + +img { + max-width: 100%; + height: auto; + -ms-interpolation-mode: bicubic; + display: inline-block; + vertical-align: middle; } + +textarea { + height: auto; + min-height: 50px; + border-radius: 0; } + +select { + width: 100%; + border-radius: 0; } + +#map_canvas img, +#map_canvas embed, +#map_canvas object, +.map_canvas img, +.map_canvas embed, +.map_canvas object, +.mqa-display img, +.mqa-display embed, +.mqa-display object { + max-width: none !important; } + +button { + -webkit-appearance: none; + -moz-appearance: none; + background: transparent; + padding: 0; + border: 0; + border-radius: 0; + line-height: 1; } + [data-whatinput='mouse'] button { + outline: 0; } + +.is-visible { + display: block !important; } + +.is-hidden { + display: none !important; } + +.row { + max-width: 75rem; + margin-left: auto; + margin-right: auto; } + .row::before, .row::after { + content: ' '; + display: table; } + .row::after { + clear: both; } + .row.collapse > .column, .row.collapse > .columns { + padding-left: 0; + padding-right: 0; } + .row .row { + max-width: none; + margin-left: -0.625rem; + margin-right: -0.625rem; } + @media screen and (min-width: 40em) { + .row .row { + margin-left: -0.9375rem; + margin-right: -0.9375rem; } } + .row .row.collapse { + margin-left: 0; + margin-right: 0; } + .row.expanded { + max-width: none; } + .row.expanded .row { + margin-left: auto; + margin-right: auto; } + +.column, .columns { + width: 100%; + float: left; + padding-left: 0.625rem; + padding-right: 0.625rem; } + @media screen and (min-width: 40em) { + .column, .columns { + padding-left: 0.9375rem; + padding-right: 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 { + padding-left: 0; + padding-right: 0; + margin-left: 0; + margin-right: 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 { + width: 100%; + float: left; } + .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 { + width: 50%; + float: left; } + .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 { + width: 33.33333%; + float: left; } + .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 { + width: 25%; + float: left; } + .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 { + width: 20%; + float: left; } + .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 { + width: 16.66667%; + float: left; } + .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 { + width: 14.28571%; + float: left; } + .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 { + width: 12.5%; + float: left; } + .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-left: 0; + padding-right: 0; } + +.small-collapse .row, +.expanded.row .small-collapse.row { + margin-left: 0; + margin-right: 0; } + +.small-uncollapse > .column, .small-uncollapse > .columns { + padding-left: 0.625rem; + padding-right: 0.625rem; } + +.small-centered { + float: none; + margin-left: auto; + margin-right: auto; } + +.small-uncentered, +.small-push-0, +.small-pull-0 { + position: static; + margin-left: 0; + margin-right: 0; + float: left; } + +@media 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 { + width: 100%; + float: left; } + .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 { + width: 50%; + float: left; } + .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 { + width: 33.33333%; + float: left; } + .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 { + width: 25%; + float: left; } + .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 { + width: 20%; + float: left; } + .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 { + width: 16.66667%; + float: left; } + .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 { + width: 14.28571%; + float: left; } + .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 { + width: 12.5%; + float: left; } + .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-left: 0; + padding-right: 0; } + .medium-collapse .row, + .expanded.row .medium-collapse.row { + margin-left: 0; + margin-right: 0; } + .medium-uncollapse > .column, .medium-uncollapse > .columns { + padding-left: 0.9375rem; + padding-right: 0.9375rem; } + .medium-centered { + float: none; + margin-left: auto; + margin-right: auto; } + .medium-uncentered, + .medium-push-0, + .medium-pull-0 { + position: static; + margin-left: 0; + margin-right: 0; + float: left; } } + +@media 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 { + width: 100%; + float: left; } + .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 { + width: 50%; + float: left; } + .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 { + width: 33.33333%; + float: left; } + .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 { + width: 25%; + float: left; } + .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 { + width: 20%; + float: left; } + .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 { + width: 16.66667%; + float: left; } + .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 { + width: 14.28571%; + float: left; } + .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 { + width: 12.5%; + float: left; } + .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-left: 0; + padding-right: 0; } + .large-collapse .row, + .expanded.row .large-collapse.row { + margin-left: 0; + margin-right: 0; } + .large-uncollapse > .column, .large-uncollapse > .columns { + padding-left: 0.9375rem; + padding-right: 0.9375rem; } + .large-centered { + float: none; + margin-left: auto; + margin-right: auto; } + .large-uncentered, + .large-push-0, + .large-pull-0 { + position: static; + margin-left: 0; + margin-right: 0; + float: left; } } + +div, +dl, +dt, +dd, +ul, +ol, +li, +h1, +h2, +h3, +h4, +h5, +h6, +pre, +form, +p, +blockquote, +th, +td { + margin: 0; + padding: 0; } + +p { + font-size: inherit; + line-height: 1.6; + margin-bottom: 1rem; + 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-weight: normal; + font-style: normal; + color: inherit; + text-rendering: optimizeLegibility; + margin-top: 0; + margin-bottom: 0.5rem; + line-height: 1.4; } + h1 small, + h2 small, + h3 small, + h4 small, + h5 small, + h6 small { + color: #cacaca; + line-height: 0; } + +h1 { + font-size: 1.5rem; } + +h2 { + font-size: 1.25rem; } + +h3 { + font-size: 1.1875rem; } + +h4 { + font-size: 1.125rem; } + +h5 { + font-size: 1.0625rem; } + +h6 { + font-size: 1rem; } + +@media 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 { + color: #2199e8; + text-decoration: none; + line-height: inherit; + cursor: pointer; } + a:hover, a:focus { + color: #1585cf; } + a img { + border: 0; } + +hr { + max-width: 75rem; + height: 0; + border-right: 0; + border-top: 0; + border-bottom: 1px solid #cacaca; + border-left: 0; + margin: 1.25rem auto; + clear: both; } + +ul, +ol, +dl { + line-height: 1.6; + margin-bottom: 1rem; + list-style-position: outside; } + +li { + font-size: inherit; } + +ul { + list-style-type: disc; + margin-left: 1.25rem; } + +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: '\2014 \0020'; } + +abbr { + color: #0a0a0a; + cursor: help; + border-bottom: 1px dotted #0a0a0a; } + +code { + font-family: Consolas, "Liberation Mono", Courier, monospace; + font-weight: normal; + color: #0a0a0a; + background-color: #e6e6e6; + border: 1px solid #cacaca; + padding: 0.125rem 0.3125rem 0.0625rem; } + +kbd { + padding: 0.125rem 0.25rem 0; + margin: 0; + background-color: #e6e6e6; + color: #0a0a0a; + font-family: Consolas, "Liberation Mono", Courier, monospace; } + +.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 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 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; + color: black !important; + box-shadow: none !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; } } + +.button { + display: inline-block; + text-align: center; + line-height: 1; + cursor: pointer; + -webkit-appearance: none; + transition: background-color 0.25s ease-out, color 0.25s ease-out; + vertical-align: middle; + border: 1px solid transparent; + border-radius: 0; + padding: 0.85em 1em; + margin: 0 0 1rem 0; + font-size: 0.9rem; + background-color: #2199e8; + color: #fefefe; } + [data-whatinput='mouse'] .button { + outline: 0; } + .button:hover, .button:focus { + background-color: #1583cc; + 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-left: 0; + margin-right: 0; } + .button.primary { + background-color: #2199e8; + color: #fefefe; } + .button.primary:hover, .button.primary:focus { + background-color: #147cc0; + color: #fefefe; } + .button.secondary { + background-color: #777; + color: #fefefe; } + .button.secondary:hover, .button.secondary:focus { + background-color: #5f5f5f; + color: #fefefe; } + .button.success { + background-color: #3adb76; + color: #fefefe; } + .button.success:hover, .button.success:focus { + background-color: #22bb5b; + color: #fefefe; } + .button.warning { + background-color: #ffae00; + color: #fefefe; } + .button.warning:hover, .button.warning:focus { + background-color: #cc8b00; + color: #fefefe; } + .button.alert { + background-color: #ec5840; + color: #fefefe; } + .button.alert:hover, .button.alert:focus { + background-color: #da3116; + color: #fefefe; } + .button.hollow { + border: 1px solid #2199e8; + color: #2199e8; } + .button.hollow, .button.hollow:hover, .button.hollow:focus { + background-color: transparent; } + .button.hollow:hover, .button.hollow:focus { + border-color: #0c4d78; + color: #0c4d78; } + .button.hollow.primary { + border: 1px solid #2199e8; + color: #2199e8; } + .button.hollow.primary:hover, .button.hollow.primary:focus { + border-color: #0c4d78; + color: #0c4d78; } + .button.hollow.secondary { + border: 1px solid #777; + color: #777; } + .button.hollow.secondary:hover, .button.hollow.secondary:focus { + border-color: #3c3c3c; + color: #3c3c3c; } + .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 #ec5840; + color: #ec5840; } + .button.hollow.alert:hover, .button.hollow.alert:focus { + border-color: #881f0e; + color: #881f0e; } + .button.disabled, .button[disabled] { + opacity: 0.25; + cursor: not-allowed; } + .button.disabled:hover, .button.disabled:focus, .button[disabled]:hover, .button[disabled]:focus { + background-color: #2199e8; + color: #fefefe; } + .button.dropdown::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 0.4em; + border-color: #fefefe transparent transparent; + border-top-style: solid; + border-bottom-width: 0; + position: relative; + top: 0.4em; + float: right; + margin-left: 1em; + display: inline-block; } + .button.arrow-only::after { + margin-left: 0; + float: none; + top: -0.1em; } + +[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; + box-sizing: border-box; + width: 100%; + height: 2.4375rem; + padding: 0.5rem; + border: 1px solid #cacaca; + margin: 0 0 1rem; + font-family: inherit; + font-size: 1rem; + color: #0a0a0a; + background-color: #fefefe; + box-shadow: inset 0 1px 2px rgba(10, 10, 10, 0.1); + border-radius: 0; + transition: box-shadow 0.5s, border-color 0.25s ease-in-out; + -webkit-appearance: none; + -moz-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 { + border: 1px solid #8a8a8a; + background-color: #fefefe; + outline: none; + box-shadow: 0 0 5px #cacaca; + transition: box-shadow 0.5s, border-color 0.25s ease-in-out; } + +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'] { + border-radius: 0; + -webkit-appearance: none; + -moz-appearance: none; } + +input[type='search'] { + box-sizing: border-box; } + +[type='file'], +[type='checkbox'], +[type='radio'] { + margin: 0 0 1rem; } + +[type='checkbox'] + label, +[type='radio'] + label { + display: inline-block; + margin-left: 0.5rem; + margin-right: 1rem; + margin-bottom: 0; + vertical-align: baseline; } + [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 { + margin: 0; + white-space: nowrap; + display: table-cell; + vertical-align: middle; } + +.input-group-label { + text-align: center; + padding: 0 1rem; + background: #e6e6e6; + color: #0a0a0a; + border: 1px solid #cacaca; + 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; + height: 100%; + width: 1%; } + .input-group-button a, + .input-group-button input, + .input-group-button button { + margin: 0; } + +.input-group .input-group-button { + display: table-cell; } + +fieldset { + border: 0; + padding: 0; + margin: 0; } + +legend { + margin-bottom: 0.5rem; + max-width: 100%; } + +.fieldset { + border: 1px solid #cacaca; + padding: 1.25rem; + margin: 1.125rem 0; } + .fieldset legend { + background: #fefefe; + padding: 0 0.1875rem; + margin: 0; + margin-left: -0.1875rem; } + +select { + height: 2.4375rem; + padding: 0.5rem; + border: 1px solid #cacaca; + margin: 0 0 1rem; + font-size: 1rem; + font-family: inherit; + line-height: normal; + color: #0a0a0a; + background-color: #fefefe; + border-radius: 0; + -webkit-appearance: none; + -moz-appearance: none; + background-image: url("data:image/svg+xml;utf8,"); + background-size: 9px 6px; + background-position: right -1rem center; + background-origin: content-box; + background-repeat: no-repeat; + padding-right: 1.5rem; } + @media screen and (min-width: 0\0) { + select { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAYCAYAAACbU/80AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIpJREFUeNrEkckNgDAMBBfRkEt0ObRBBdsGXUDgmQfK4XhH2m8czQAAy27R3tsw4Qfe2x8uOO6oYLb6GlOor3GF+swURAOmUJ+RwtEJs9WvTGEYxBXqI1MQAZhCfUQKRzDMVj+TwrAIV6jvSUEkYAr1LSkcyTBb/V+KYfX7xAeusq3sLDtGH3kEGACPWIflNZfhRQAAAABJRU5ErkJggg=="); } } + 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) { + background-color: rgba(236, 88, 64, 0.1); + border-color: #ec5840; } + +.is-invalid-label { + color: #ec5840; } + +.form-error { + display: none; + margin-top: -0.5rem; + margin-bottom: 1rem; + font-size: 0.75rem; + font-weight: bold; + color: #ec5840; } + .form-error.is-visible { + display: block; } + +.accordion { + list-style-type: none; + background: #fefefe; + margin-left: 0; } + +.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 { + display: block; + padding: 1.25rem 1rem; + line-height: 1; + font-size: 0.75rem; + color: #2199e8; + position: relative; + border: 1px solid #e6e6e6; + border-bottom: 0; } + :last-child:not(.is-active) > .accordion-title { + border-radius: 0 0 0 0; + border-bottom: 1px solid #e6e6e6; } + .accordion-title:hover, .accordion-title:focus { + background-color: #e6e6e6; } + .accordion-title::before { + content: '+'; + position: absolute; + right: 1rem; + top: 50%; + margin-top: -0.5rem; } + .is-active > .accordion-title::before { + content: '–'; } + +.accordion-content { + padding: 1rem; + display: none; + 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 { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 6px; + border-color: #2199e8 transparent transparent; + border-top-style: solid; + border-bottom-width: 0; + position: absolute; + top: 50%; + margin-top: -4px; + right: 1rem; } + +.is-accordion-submenu-parent[aria-expanded='true'] > a::after { + -webkit-transform-origin: 50% 50%; + -ms-transform-origin: 50% 50%; + transform-origin: 50% 50%; + -webkit-transform: scaleY(-1); + -ms-transform: scaleY(-1); + transform: scaleY(-1); } + +.badge { + display: inline-block; + padding: 0.3em; + min-width: 2.1em; + font-size: 0.6rem; + text-align: center; + border-radius: 50%; + background: #2199e8; + color: #fefefe; } + .badge.secondary { + background: #777; + color: #fefefe; } + .badge.success { + background: #3adb76; + color: #fefefe; } + .badge.warning { + background: #ffae00; + color: #fefefe; } + .badge.alert { + background: #ec5840; + color: #fefefe; } + +.breadcrumbs { + list-style: none; + margin: 0 0 1rem 0; } + .breadcrumbs::before, .breadcrumbs::after { + content: ' '; + display: table; } + .breadcrumbs::after { + clear: both; } + .breadcrumbs li { + float: left; + color: #0a0a0a; + font-size: 0.6875rem; + cursor: default; + text-transform: uppercase; } + .breadcrumbs li:not(:last-child)::after { + color: #cacaca; + content: "/"; + margin: 0 0.75rem; + position: relative; + top: 1px; + opacity: 1; } + .breadcrumbs a { + color: #2199e8; } + .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 { + content: ' '; + display: table; } + .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: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: #2199e8; + color: #fefefe; } + .button-group.primary .button:hover, .button-group.primary .button:focus { + background-color: #147cc0; + color: #fefefe; } + .button-group.secondary .button { + background-color: #777; + color: #fefefe; } + .button-group.secondary .button:hover, .button-group.secondary .button:focus { + background-color: #5f5f5f; + color: #fefefe; } + .button-group.success .button { + background-color: #3adb76; + color: #fefefe; } + .button-group.success .button:hover, .button-group.success .button:focus { + background-color: #22bb5b; + color: #fefefe; } + .button-group.warning .button { + background-color: #ffae00; + color: #fefefe; } + .button-group.warning .button:hover, .button-group.warning .button:focus { + background-color: #cc8b00; + color: #fefefe; } + .button-group.alert .button { + background-color: #ec5840; + color: #fefefe; } + .button-group.alert .button:hover, .button-group.alert .button:focus { + background-color: #da3116; + 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 screen and (min-width: 40em) { + .button-group.stacked-for-small .button { + width: auto; + margin-bottom: 0; } } + @media 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 { + margin: 0 0 1rem 0; + padding: 1rem; + border: 1px solid rgba(10, 10, 10, 0.25); + border-radius: 0; + position: relative; + color: #0a0a0a; + background-color: white; } + .callout > :first-child { + margin-top: 0; } + .callout > :last-child { + margin-bottom: 0; } + .callout.primary { + background-color: #def0fc; } + .callout.secondary { + background-color: #ebebeb; } + .callout.success { + background-color: #e1faea; } + .callout.warning { + background-color: #fff3d9; } + .callout.alert { + background-color: #fce6e2; } + .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; } + +.close-button { + position: absolute; + color: #8a8a8a; + right: 1rem; + top: 0.5rem; + font-size: 2em; + line-height: 1; + cursor: pointer; } + [data-whatinput='mouse'] .close-button { + outline: 0; } + .close-button:hover, .close-button:focus { + color: #0a0a0a; } + +.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 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 { + display: table-cell; } + .menu.vertical > li { + display: block; } + @media screen and (min-width: 40em) { + .menu.medium-horizontal > li { + display: table-cell; } + .menu.medium-vertical > li { + display: block; } } + @media screen and (min-width: 64em) { + .menu.large-horizontal > li { + display: table-cell; } + .menu.large-vertical > li { + display: block; } } + .menu.simple li { + line-height: 1; + display: inline-block; + margin-right: 1rem; } + .menu.simple a { + padding: 0; } + .menu.align-right::before, .menu.align-right::after { + content: ' '; + display: table; } + .menu.align-right::after { + clear: both; } + .menu.align-right > li { + float: right; } + .menu.expanded { + width: 100%; + display: table; + table-layout: fixed; } + .menu.expanded > li:first-child:last-child { + width: 100%; } + .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.nested { + margin-left: 1rem; } + .menu .active > a { + color: #fefefe; + background: #2199e8; } + +.menu-text { + font-weight: bold; + color: inherit; + line-height: 1; + padding-top: 0; + padding-bottom: 0; + padding: 0.7rem 1rem; } + +.menu-centered { + text-align: center; } + .menu-centered > .menu { + display: inline-block; } + +.no-js [data-responsive-menu] ul { + display: none; } + +.menu-icon { + position: relative; + display: inline-block; + vertical-align: middle; + cursor: pointer; + width: 20px; + height: 16px; } + .menu-icon::after { + content: ''; + position: absolute; + display: block; + width: 100%; + height: 2px; + background: #fefefe; + top: 0; + left: 0; + box-shadow: 0 7px 0 #fefefe, 0 14px 0 #fefefe; } + .menu-icon:hover::after { + background: #cacaca; + box-shadow: 0 7px 0 #cacaca, 0 14px 0 #cacaca; } + +.menu-icon.dark { + position: relative; + display: inline-block; + vertical-align: middle; + cursor: pointer; + width: 20px; + height: 16px; } + .menu-icon.dark::after { + content: ''; + position: absolute; + display: block; + width: 100%; + height: 2px; + background: #0a0a0a; + top: 0; + left: 0; + box-shadow: 0 7px 0 #0a0a0a, 0 14px 0 #0a0a0a; } + .menu-icon.dark:hover::after { + background: #8a8a8a; + box-shadow: 0 7px 0 #8a8a8a, 0 14px 0 #8a8a8a; } + +.is-drilldown { + position: relative; + overflow: hidden; } + .is-drilldown li { + display: block !important; } + +.is-drilldown-submenu { + position: absolute; + top: 0; + left: 100%; + z-index: -1; + height: 100%; + width: 100%; + background: #fefefe; + transition: -webkit-transform 0.15s linear; + transition: 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%); } + +.is-drilldown-submenu-parent > a { + position: relative; } + .is-drilldown-submenu-parent > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 6px; + border-color: transparent transparent transparent #2199e8; + border-left-style: solid; + border-right-width: 0; + position: absolute; + top: 50%; + margin-top: -6px; + right: 1rem; } + +.js-drilldown-back > a::before { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 6px; + border-color: transparent #2199e8 transparent transparent; + border-right-style: solid; + border-left-width: 0; + border-left-width: 0; + display: inline-block; + vertical-align: middle; + margin-right: 0.75rem; } + +.dropdown-pane { + background-color: #fefefe; + border: 1px solid #cacaca; + border-radius: 0; + display: block; + font-size: 1rem; + padding: 1rem; + position: absolute; + visibility: hidden; + width: 300px; + z-index: 10; } + .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 { + left: auto; + right: 0; + top: 100%; } + +.dropdown.menu > li.opens-right > .is-dropdown-submenu { + right: auto; + left: 0; + top: 100%; } + +.dropdown.menu > li.is-dropdown-submenu-parent > a { + padding-right: 1.5rem; + position: relative; } + +.dropdown.menu > li.is-dropdown-submenu-parent > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: #2199e8 transparent transparent; + border-top-style: solid; + border-bottom-width: 0; + right: 5px; + margin-top: -2px; } + +[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 { + left: auto; + right: 100%; } + +.dropdown.menu.vertical > li.opens-right > .is-dropdown-submenu { + right: auto; + left: 100%; } + +.dropdown.menu.vertical > li > a::after { + right: 14px; + margin-top: -3px; } + +.dropdown.menu.vertical > li.opens-left > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: transparent #2199e8 transparent transparent; + border-right-style: solid; + border-left-width: 0; } + +.dropdown.menu.vertical > li.opens-right > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: transparent transparent transparent #2199e8; + border-left-style: solid; + border-right-width: 0; } + +@media screen and (min-width: 40em) { + .dropdown.menu.medium-horizontal > li.opens-left > .is-dropdown-submenu { + left: auto; + right: 0; + top: 100%; } + .dropdown.menu.medium-horizontal > li.opens-right > .is-dropdown-submenu { + right: auto; + left: 0; + top: 100%; } + .dropdown.menu.medium-horizontal > li.is-dropdown-submenu-parent > a { + padding-right: 1.5rem; + position: relative; } + .dropdown.menu.medium-horizontal > li.is-dropdown-submenu-parent > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: #2199e8 transparent transparent; + border-top-style: solid; + border-bottom-width: 0; + right: 5px; + margin-top: -2px; } + .dropdown.menu.medium-vertical > li .is-dropdown-submenu { + top: 0; } + .dropdown.menu.medium-vertical > li.opens-left > .is-dropdown-submenu { + left: auto; + right: 100%; } + .dropdown.menu.medium-vertical > li.opens-right > .is-dropdown-submenu { + right: auto; + left: 100%; } + .dropdown.menu.medium-vertical > li > a::after { + right: 14px; + margin-top: -3px; } + .dropdown.menu.medium-vertical > li.opens-left > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: transparent #2199e8 transparent transparent; + border-right-style: solid; + border-left-width: 0; } + .dropdown.menu.medium-vertical > li.opens-right > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: transparent transparent transparent #2199e8; + border-left-style: solid; + border-right-width: 0; } } + +@media screen and (min-width: 64em) { + .dropdown.menu.large-horizontal > li.opens-left > .is-dropdown-submenu { + left: auto; + right: 0; + top: 100%; } + .dropdown.menu.large-horizontal > li.opens-right > .is-dropdown-submenu { + right: auto; + left: 0; + top: 100%; } + .dropdown.menu.large-horizontal > li.is-dropdown-submenu-parent > a { + padding-right: 1.5rem; + position: relative; } + .dropdown.menu.large-horizontal > li.is-dropdown-submenu-parent > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: #2199e8 transparent transparent; + border-top-style: solid; + border-bottom-width: 0; + right: 5px; + margin-top: -2px; } + .dropdown.menu.large-vertical > li .is-dropdown-submenu { + top: 0; } + .dropdown.menu.large-vertical > li.opens-left > .is-dropdown-submenu { + left: auto; + right: 100%; } + .dropdown.menu.large-vertical > li.opens-right > .is-dropdown-submenu { + right: auto; + left: 100%; } + .dropdown.menu.large-vertical > li > a::after { + right: 14px; + margin-top: -3px; } + .dropdown.menu.large-vertical > li.opens-left > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: transparent #2199e8 transparent transparent; + border-right-style: solid; + border-left-width: 0; } + .dropdown.menu.large-vertical > li.opens-right > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: transparent transparent transparent #2199e8; + border-left-style: solid; + border-right-width: 0; } } + +.dropdown.menu.align-right .is-dropdown-submenu.first-sub { + top: 100%; + left: auto; + right: 0; } + +.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: -2px; } + .is-dropdown-submenu-parent.opens-inner > .is-dropdown-submenu { + top: 100%; + left: auto; } + .is-dropdown-submenu-parent.opens-left > .is-dropdown-submenu { + left: auto; + right: 100%; } + .is-dropdown-submenu-parent.opens-right > .is-dropdown-submenu { + right: auto; + left: 100%; } + +.is-dropdown-submenu { + display: none; + position: absolute; + top: 0; + left: 100%; + min-width: 200px; + z-index: 1; + background: #fefefe; + border: 1px solid #cacaca; } + .is-dropdown-submenu .is-dropdown-submenu-parent > a::after { + right: 14px; + margin-top: -3px; } + .is-dropdown-submenu .is-dropdown-submenu-parent.opens-left > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: transparent #2199e8 transparent transparent; + border-right-style: solid; + border-left-width: 0; } + .is-dropdown-submenu .is-dropdown-submenu-parent.opens-right > a::after { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 5px; + border-color: transparent transparent transparent #2199e8; + border-left-style: solid; + border-right-width: 0; } + .is-dropdown-submenu .is-dropdown-submenu { + margin-top: -1px; } + .is-dropdown-submenu > li { + width: 100%; } + .is-dropdown-submenu.js-dropdown-active { + display: block; } + +.flex-video { + position: relative; + height: 0; + padding-bottom: 75%; + margin-bottom: 1rem; + overflow: hidden; } + .flex-video iframe, + .flex-video object, + .flex-video embed, + .flex-video video { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; } + .flex-video.widescreen { + padding-bottom: 56.25%; } + .flex-video.vimeo { + padding-top: 0; } + +.label { + display: inline-block; + padding: 0.33333rem 0.5rem; + font-size: 0.8rem; + line-height: 1; + white-space: nowrap; + cursor: default; + border-radius: 0; + background: #2199e8; + color: #fefefe; } + .label.secondary { + background: #777; + color: #fefefe; } + .label.success { + background: #3adb76; + color: #fefefe; } + .label.warning { + background: #ffae00; + color: #fefefe; } + .label.alert { + background: #ec5840; + color: #fefefe; } + +.media-object { + margin-bottom: 1rem; + display: block; } + .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; } + +html, +body { + height: 100%; } + +.off-canvas-wrapper { + width: 100%; + overflow-x: hidden; + position: relative; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; + -webkit-overflow-scrolling: auto; } + +.off-canvas-wrapper-inner { + position: relative; + width: 100%; + transition: -webkit-transform 0.5s ease; + transition: transform 0.5s ease; } + .off-canvas-wrapper-inner::before, .off-canvas-wrapper-inner::after { + content: ' '; + display: table; } + .off-canvas-wrapper-inner::after { + clear: both; } + +.off-canvas-content, +.off-canvas-content { + min-height: 100%; + background: #fefefe; + transition: -webkit-transform 0.5s ease; + transition: transform 0.5s ease; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; + z-index: 1; + padding-bottom: 0.1px; + box-shadow: 0 0 10px rgba(10, 10, 10, 0.5); } + +.js-off-canvas-exit { + display: none; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(254, 254, 254, 0.25); + cursor: pointer; + transition: background 0.5s ease; } + +.off-canvas { + position: absolute; + background: #e6e6e6; + z-index: -1; + max-height: 100%; + overflow-y: auto; + -webkit-transform: translateX(0); + -ms-transform: translateX(0); + transform: translateX(0); } + [data-whatinput='mouse'] .off-canvas { + outline: 0; } + .off-canvas.position-left { + left: -250px; + top: 0; + width: 250px; } + .is-open-left { + -webkit-transform: translateX(250px); + -ms-transform: translateX(250px); + transform: translateX(250px); } + .off-canvas.position-right { + right: -250px; + top: 0; + width: 250px; } + .is-open-right { + -webkit-transform: translateX(-250px); + -ms-transform: translateX(-250px); + transform: translateX(-250px); } + +@media screen and (min-width: 40em) { + .position-left.reveal-for-medium { + left: 0; + z-index: auto; + position: fixed; } + .position-left.reveal-for-medium ~ .off-canvas-content { + margin-left: 250px; } + .position-right.reveal-for-medium { + right: 0; + z-index: auto; + position: fixed; } + .position-right.reveal-for-medium ~ .off-canvas-content { + margin-right: 250px; } } + +@media screen and (min-width: 64em) { + .position-left.reveal-for-large { + left: 0; + z-index: auto; + position: fixed; } + .position-left.reveal-for-large ~ .off-canvas-content { + margin-left: 250px; } + .position-right.reveal-for-large { + right: 0; + z-index: auto; + position: fixed; } + .position-right.reveal-for-large ~ .off-canvas-content { + margin-right: 250px; } } + +.orbit { + position: relative; } + +.orbit-container { + position: relative; + margin: 0; + overflow: hidden; + list-style: none; } + +.orbit-slide { + width: 100%; + max-height: 100%; } + .orbit-slide.no-motionui.is-active { + top: 0; + left: 0; } + +.orbit-figure { + margin: 0; } + +.orbit-image { + margin: 0; + width: 100%; + max-width: 100%; } + +.orbit-caption { + position: absolute; + bottom: 0; + width: 100%; + padding: 1rem; + margin-bottom: 0; + color: #fefefe; + background-color: rgba(10, 10, 10, 0.5); } + +.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; + background-color: #cacaca; + border-radius: 50%; } + .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 { + content: ' '; + display: table; } + .pagination::after { + clear: both; } + .pagination li { + font-size: 0.875rem; + margin-right: 0.0625rem; + border-radius: 0; + display: none; } + .pagination li:last-child, .pagination li:first-child { + display: inline-block; } + @media screen and (min-width: 40em) { + .pagination li { + display: inline-block; } } + .pagination a, + .pagination button { + color: #0a0a0a; + display: block; + padding: 0.1875rem 0.625rem; + border-radius: 0; } + .pagination a:hover, + .pagination button:hover { + background: #e6e6e6; } + .pagination .current { + padding: 0.1875rem 0.625rem; + background: #2199e8; + color: #fefefe; + cursor: default; } + .pagination .disabled { + padding: 0.1875rem 0.625rem; + color: #cacaca; + cursor: not-allowed; } + .pagination .disabled:hover { + background: transparent; } + .pagination .ellipsis::after { + content: '\2026'; + padding: 0.1875rem 0.625rem; + color: #0a0a0a; } + +.pagination-previous a::before, +.pagination-previous.disabled::before { + content: '\00ab'; + display: inline-block; + margin-right: 0.5rem; } + +.pagination-next a::after, +.pagination-next.disabled::after { + content: '\00bb'; + display: inline-block; + margin-left: 0.5rem; } + +.progress { + background-color: #cacaca; + height: 1rem; + margin-bottom: 1rem; + border-radius: 0; } + .progress.primary .progress-meter { + background-color: #2199e8; } + .progress.secondary .progress-meter { + background-color: #777; } + .progress.success .progress-meter { + background-color: #3adb76; } + .progress.warning .progress-meter { + background-color: #ffae00; } + .progress.alert .progress-meter { + background-color: #ec5840; } + +.progress-meter { + position: relative; + display: block; + width: 0%; + height: 100%; + background-color: #2199e8; } + +.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; } + +body.is-reveal-open { + overflow: hidden; } + +html.is-reveal-open, +html.is-reveal-open body { + height: 100%; + overflow: hidden; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } + +.reveal-overlay { + display: none; + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + z-index: 1005; + background-color: rgba(10, 10, 10, 0.45); + overflow-y: scroll; } + +.reveal { + display: none; + z-index: 1006; + padding: 1rem; + border: 1px solid #cacaca; + background-color: #fefefe; + border-radius: 0; + position: relative; + top: 100px; + margin-left: auto; + margin-right: auto; + overflow-y: auto; } + [data-whatinput='mouse'] .reveal { + outline: 0; } + @media 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 screen and (min-width: 40em) { + .reveal { + width: 600px; + max-width: 75rem; } } + @media screen and (min-width: 40em) { + .reveal .reveal { + left: auto; + right: auto; + margin: 0 auto; } } + .reveal.collapse { + padding: 0; } + @media screen and (min-width: 40em) { + .reveal.tiny { + width: 30%; + max-width: 75rem; } } + @media screen and (min-width: 40em) { + .reveal.small { + width: 50%; + max-width: 75rem; } } + @media screen and (min-width: 40em) { + .reveal.large { + width: 90%; + max-width: 75rem; } } + .reveal.full { + top: 0; + left: 0; + width: 100%; + height: 100%; + height: 100vh; + min-height: 100vh; + max-width: none; + margin-left: 0; + border: 0; + border-radius: 0; } + @media screen and (max-width: 39.9375em) { + .reveal { + top: 0; + left: 0; + width: 100%; + height: 100%; + height: 100vh; + min-height: 100vh; + max-width: none; + margin-left: 0; + border: 0; + border-radius: 0; } } + .reveal.without-overlay { + position: fixed; } + +.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; + transition: all 0.2s ease-in-out; } + .slider-fill.is-dragging { + 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; + background-color: #2199e8; + transition: all 0.2s ease-in-out; + -ms-touch-action: manipulation; + touch-action: manipulation; + border-radius: 0; } + [data-whatinput='mouse'] .slider-handle { + outline: 0; } + .slider-handle:hover { + background-color: #1583cc; } + .slider-handle.is-dragging { + 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: absolute; + 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: absolute; + left: auto; + right: auto; } + .sticky.is-anchored.is-at-bottom { + bottom: 0; } + +.switch { + margin-bottom: 1rem; + outline: 0; + position: relative; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + color: #fefefe; + font-weight: bold; + font-size: 0.875rem; } + +.switch-input { + opacity: 0; + position: absolute; } + +.switch-paddle { + background: #cacaca; + cursor: pointer; + display: block; + position: relative; + width: 4rem; + height: 2rem; + transition: all 0.25s ease-out; + border-radius: 0; + color: inherit; + font-weight: inherit; } + input + .switch-paddle { + margin: 0; } + .switch-paddle::after { + background: #fefefe; + content: ''; + display: block; + position: absolute; + height: 1.5rem; + left: 0.25rem; + top: 0.25rem; + width: 1.5rem; + transition: all 0.25s ease-out; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + border-radius: 0; } + input:checked ~ .switch-paddle { + background: #2199e8; } + 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 .switch-paddle { + width: 3rem; + height: 1.5rem; + font-size: 0.625rem; } + +.switch.tiny .switch-paddle::after { + width: 1rem; + height: 1rem; } + +.switch.tiny input:checked ~ .switch-paddle::after { + left: 1.75rem; } + +.switch.small .switch-paddle { + width: 3.5rem; + height: 1.75rem; + font-size: 0.75rem; } + +.switch.small .switch-paddle::after { + width: 1.25rem; + height: 1.25rem; } + +.switch.small input:checked ~ .switch-paddle::after { + left: 2rem; } + +.switch.large .switch-paddle { + width: 5rem; + height: 2.5rem; + font-size: 1rem; } + +.switch.large .switch-paddle::after { + 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 { + font-weight: bold; + padding: 0.5rem 0.625rem 0.625rem; } + table thead, + table tfoot { + background: #f8f8f8; + 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 tr:nth-child(even) { + background-color: #f1f1f1; } + table tbody th, + table tbody td { + padding: 0.5rem 0.625rem 0.625rem; } + +@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 tr:hover { + background-color: #f9f9f9; } + +table.hover tr:nth-of-type(even):hover { + background-color: #ececec; } + +.table-scroll { + overflow-x: auto; } + .table-scroll table { + width: auto; } + +.tabs { + margin: 0; + list-style-type: none; + background: #fefefe; + border: 1px solid #e6e6e6; } + .tabs::before, .tabs::after { + content: ' '; + display: table; } + .tabs::after { + clear: both; } + +.tabs.vertical > li { + width: auto; + float: none; + display: block; } + +.tabs.simple > li > a { + padding: 0; } + .tabs.simple > li > a:hover { + background: transparent; } + +.tabs.primary { + background: #2199e8; } + .tabs.primary > li > a { + color: #fefefe; } + .tabs.primary > li > a:hover, .tabs.primary > li > a:focus { + background: #1893e4; } + +.tabs-title { + float: left; } + .tabs-title > a { + display: block; + padding: 1.25rem 1.5rem; + line-height: 1; + font-size: 0.75rem; } + .tabs-title > a:hover { + background: #fefefe; } + .tabs-title > a:focus, .tabs-title > a[aria-selected='true'] { + background: #e6e6e6; } + +.tabs-content { + background: #fefefe; + transition: all 0.5s ease; + border: 1px solid #e6e6e6; + border-top: 0; } + +.tabs-content.vertical { + border: 1px solid #e6e6e6; + border-left: 0; } + +.tabs-panel { + display: none; + padding: 1rem; } + .tabs-panel.is-active { + display: block; } + +.thumbnail { + border: solid 4px #fefefe; + box-shadow: 0 0 0 1px rgba(10, 10, 10, 0.2); + display: inline-block; + line-height: 0; + max-width: 100%; + transition: box-shadow 200ms ease-out; + border-radius: 0; + margin-bottom: 1rem; } + .thumbnail:hover, .thumbnail:focus { + box-shadow: 0 0 6px 1px rgba(33, 153, 232, 0.5); } + +.title-bar { + background: #0a0a0a; + color: #fefefe; + padding: 0.5rem; } + .title-bar::before, .title-bar::after { + content: ' '; + display: table; } + .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 { + font-weight: bold; + vertical-align: middle; + display: inline-block; } + +.menu-icon.dark { + position: relative; + display: inline-block; + vertical-align: middle; + cursor: pointer; + width: 20px; + height: 16px; } + .menu-icon.dark::after { + content: ''; + position: absolute; + display: block; + width: 100%; + height: 2px; + background: #0a0a0a; + top: 0; + left: 0; + box-shadow: 0 7px 0 #0a0a0a, 0 14px 0 #0a0a0a; } + .menu-icon.dark:hover::after { + background: #8a8a8a; + box-shadow: 0 7px 0 #8a8a8a, 0 14px 0 #8a8a8a; } + +.has-tip { + border-bottom: dotted 1px #8a8a8a; + font-weight: bold; + position: relative; + display: inline-block; + cursor: help; } + +.tooltip { + background-color: #0a0a0a; + color: #fefefe; + font-size: 80%; + padding: 0.75rem; + position: absolute; + z-index: 10; + top: calc(100% + 0.6495rem); + max-width: 10rem !important; + border-radius: 0; } + .tooltip::before { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 0.75rem; + border-color: transparent transparent #0a0a0a; + border-bottom-style: solid; + border-top-width: 0; + bottom: 100%; + position: absolute; + left: 50%; + -webkit-transform: translateX(-50%); + -ms-transform: translateX(-50%); + transform: translateX(-50%); } + .tooltip.top::before { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 0.75rem; + border-color: #0a0a0a transparent transparent; + border-top-style: solid; + border-bottom-width: 0; + top: 100%; + bottom: auto; } + .tooltip.left::before { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 0.75rem; + border-color: transparent transparent transparent #0a0a0a; + border-left-style: solid; + border-right-width: 0; + bottom: auto; + left: 100%; + top: 50%; + -webkit-transform: translateY(-50%); + -ms-transform: translateY(-50%); + transform: translateY(-50%); } + .tooltip.right::before { + content: ''; + display: block; + width: 0; + height: 0; + border: inset 0.75rem; + border-color: transparent #0a0a0a transparent transparent; + border-right-style: solid; + border-left-width: 0; + bottom: auto; + left: auto; + right: 100%; + top: 50%; + -webkit-transform: translateY(-50%); + -ms-transform: translateY(-50%); + transform: translateY(-50%); } + +.top-bar { + padding: 0.5rem; } + .top-bar::before, .top-bar::after { + content: ' '; + display: table; } + .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 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 { + float: left; + margin-right: 1rem; } + +.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 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 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; + height: auto; + width: 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-left: auto; + margin-right: auto; } + +.clearfix::before, .clearfix::after { + content: ' '; + display: table; } + +.clearfix::after { + clear: both; } + +.slide-in-down.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: translateY(-100%); + -ms-transform: translateY(-100%); + transform: translateY(-100%); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; } + +.slide-in-down.mui-enter.mui-enter-active { + -webkit-transform: translateY(0); + -ms-transform: translateY(0); + transform: translateY(0); } + +.slide-in-left.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: translateX(-100%); + -ms-transform: translateX(-100%); + transform: translateX(-100%); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; } + +.slide-in-left.mui-enter.mui-enter-active { + -webkit-transform: translateX(0); + -ms-transform: translateX(0); + transform: translateX(0); } + +.slide-in-up.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: translateY(100%); + -ms-transform: translateY(100%); + transform: translateY(100%); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; } + +.slide-in-up.mui-enter.mui-enter-active { + -webkit-transform: translateY(0); + -ms-transform: translateY(0); + transform: translateY(0); } + +.slide-in-right.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: translateX(100%); + -ms-transform: translateX(100%); + transform: translateX(100%); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; } + +.slide-in-right.mui-enter.mui-enter-active { + -webkit-transform: translateX(0); + -ms-transform: translateX(0); + transform: translateX(0); } + +.slide-out-down.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: translateY(0); + -ms-transform: translateY(0); + transform: translateY(0); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; } + +.slide-out-down.mui-leave.mui-leave-active { + -webkit-transform: translateY(100%); + -ms-transform: translateY(100%); + transform: translateY(100%); } + +.slide-out-right.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: translateX(0); + -ms-transform: translateX(0); + transform: translateX(0); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; } + +.slide-out-right.mui-leave.mui-leave-active { + -webkit-transform: translateX(100%); + -ms-transform: translateX(100%); + transform: translateX(100%); } + +.slide-out-up.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: translateY(0); + -ms-transform: translateY(0); + transform: translateY(0); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; } + +.slide-out-up.mui-leave.mui-leave-active { + -webkit-transform: translateY(-100%); + -ms-transform: translateY(-100%); + transform: translateY(-100%); } + +.slide-out-left.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: translateX(0); + -ms-transform: translateX(0); + transform: translateX(0); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; } + +.slide-out-left.mui-leave.mui-leave-active { + -webkit-transform: translateX(-100%); + -ms-transform: translateX(-100%); + transform: translateX(-100%); } + +.fade-in.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + opacity: 0; + transition-property: opacity; } + +.fade-in.mui-enter.mui-enter-active { + opacity: 1; } + +.fade-out.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + opacity: 1; + transition-property: opacity; } + +.fade-out.mui-leave.mui-leave-active { + opacity: 0; } + +.hinge-in-from-top.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotateX(-90deg); + transform: perspective(2000px) rotateX(-90deg); + -webkit-transform-origin: top; + -ms-transform-origin: top; + transform-origin: top; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.hinge-in-from-top.mui-enter.mui-enter-active { + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + opacity: 1; } + +.hinge-in-from-right.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotateY(-90deg); + transform: perspective(2000px) rotateY(-90deg); + -webkit-transform-origin: right; + -ms-transform-origin: right; + transform-origin: right; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.hinge-in-from-right.mui-enter.mui-enter-active { + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + opacity: 1; } + +.hinge-in-from-bottom.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotateX(90deg); + transform: perspective(2000px) rotateX(90deg); + -webkit-transform-origin: bottom; + -ms-transform-origin: bottom; + transform-origin: bottom; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.hinge-in-from-bottom.mui-enter.mui-enter-active { + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + opacity: 1; } + +.hinge-in-from-left.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotateY(90deg); + transform: perspective(2000px) rotateY(90deg); + -webkit-transform-origin: left; + -ms-transform-origin: left; + transform-origin: left; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.hinge-in-from-left.mui-enter.mui-enter-active { + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + opacity: 1; } + +.hinge-in-from-middle-x.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotateX(-90deg); + transform: perspective(2000px) rotateX(-90deg); + -webkit-transform-origin: center; + -ms-transform-origin: center; + transform-origin: center; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.hinge-in-from-middle-x.mui-enter.mui-enter-active { + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + opacity: 1; } + +.hinge-in-from-middle-y.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotateY(-90deg); + transform: perspective(2000px) rotateY(-90deg); + -webkit-transform-origin: center; + -ms-transform-origin: center; + transform-origin: center; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.hinge-in-from-middle-y.mui-enter.mui-enter-active { + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + opacity: 1; } + +.hinge-out-from-top.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + -webkit-transform-origin: top; + -ms-transform-origin: top; + transform-origin: top; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.hinge-out-from-top.mui-leave.mui-leave-active { + -webkit-transform: perspective(2000px) rotateX(-90deg); + transform: perspective(2000px) rotateX(-90deg); + opacity: 0; } + +.hinge-out-from-right.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + -webkit-transform-origin: right; + -ms-transform-origin: right; + transform-origin: right; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.hinge-out-from-right.mui-leave.mui-leave-active { + -webkit-transform: perspective(2000px) rotateY(-90deg); + transform: perspective(2000px) rotateY(-90deg); + opacity: 0; } + +.hinge-out-from-bottom.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + -webkit-transform-origin: bottom; + -ms-transform-origin: bottom; + transform-origin: bottom; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.hinge-out-from-bottom.mui-leave.mui-leave-active { + -webkit-transform: perspective(2000px) rotateX(90deg); + transform: perspective(2000px) rotateX(90deg); + opacity: 0; } + +.hinge-out-from-left.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + -webkit-transform-origin: left; + -ms-transform-origin: left; + transform-origin: left; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.hinge-out-from-left.mui-leave.mui-leave-active { + -webkit-transform: perspective(2000px) rotateY(90deg); + transform: perspective(2000px) rotateY(90deg); + opacity: 0; } + +.hinge-out-from-middle-x.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + -webkit-transform-origin: center; + -ms-transform-origin: center; + transform-origin: center; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.hinge-out-from-middle-x.mui-leave.mui-leave-active { + -webkit-transform: perspective(2000px) rotateX(-90deg); + transform: perspective(2000px) rotateX(-90deg); + opacity: 0; } + +.hinge-out-from-middle-y.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: perspective(2000px) rotate(0deg); + transform: perspective(2000px) rotate(0deg); + -webkit-transform-origin: center; + -ms-transform-origin: center; + transform-origin: center; + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.hinge-out-from-middle-y.mui-leave.mui-leave-active { + -webkit-transform: perspective(2000px) rotateY(-90deg); + transform: perspective(2000px) rotateY(-90deg); + opacity: 0; } + +.scale-in-up.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: scale(0.5); + -ms-transform: scale(0.5); + transform: scale(0.5); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.scale-in-up.mui-enter.mui-enter-active { + -webkit-transform: scale(1); + -ms-transform: scale(1); + transform: scale(1); + opacity: 1; } + +.scale-in-down.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: scale(1.5); + -ms-transform: scale(1.5); + transform: scale(1.5); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.scale-in-down.mui-enter.mui-enter-active { + -webkit-transform: scale(1); + -ms-transform: scale(1); + transform: scale(1); + opacity: 1; } + +.scale-out-up.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: scale(1); + -ms-transform: scale(1); + transform: scale(1); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.scale-out-up.mui-leave.mui-leave-active { + -webkit-transform: scale(1.5); + -ms-transform: scale(1.5); + transform: scale(1.5); + opacity: 0; } + +.scale-out-down.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: scale(1); + -ms-transform: scale(1); + transform: scale(1); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.scale-out-down.mui-leave.mui-leave-active { + -webkit-transform: scale(0.5); + -ms-transform: scale(0.5); + transform: scale(0.5); + opacity: 0; } + +.spin-in.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: rotate(-0.75turn); + -ms-transform: rotate(-0.75turn); + transform: rotate(-0.75turn); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.spin-in.mui-enter.mui-enter-active { + -webkit-transform: rotate(0); + -ms-transform: rotate(0); + transform: rotate(0); + opacity: 1; } + +.spin-out.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: rotate(0); + -ms-transform: rotate(0); + transform: rotate(0); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.spin-out.mui-leave.mui-leave-active { + -webkit-transform: rotate(0.75turn); + -ms-transform: rotate(0.75turn); + transform: rotate(0.75turn); + opacity: 0; } + +.spin-in-ccw.mui-enter { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: rotate(0.75turn); + -ms-transform: rotate(0.75turn); + transform: rotate(0.75turn); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 0; } + +.spin-in-ccw.mui-enter.mui-enter-active { + -webkit-transform: rotate(0); + -ms-transform: rotate(0); + transform: rotate(0); + opacity: 1; } + +.spin-out-ccw.mui-leave { + transition-duration: 500ms; + transition-timing-function: linear; + -webkit-transform: rotate(0); + -ms-transform: rotate(0); + transform: rotate(0); + transition-property: -webkit-transform, opacity; + transition-property: transform, opacity; + opacity: 1; } + +.spin-out-ccw.mui-leave.mui-leave-active { + -webkit-transform: rotate(-0.75turn); + -ms-transform: rotate(-0.75turn); + transform: rotate(-0.75turn); + opacity: 0; } + +.slow { + transition-duration: 750ms !important; } + +.fast { + transition-duration: 250ms !important; } + +.linear { + transition-timing-function: linear !important; } + +.ease { + transition-timing-function: ease !important; } + +.ease-in { + transition-timing-function: ease-in !important; } + +.ease-out { + transition-timing-function: ease-out !important; } + +.ease-in-out { + transition-timing-function: ease-in-out !important; } + +.bounce-in { + transition-timing-function: cubic-bezier(0.485, 0.155, 0.24, 1.245) !important; } + +.bounce-out { + transition-timing-function: cubic-bezier(0.485, 0.155, 0.515, 0.845) !important; } + +.bounce-in-out { + transition-timing-function: cubic-bezier(0.76, -0.245, 0.24, 1.245) !important; } + +.short-delay { + transition-delay: 300ms !important; } + +.long-delay { + transition-delay: 700ms !important; } + +.shake { + -webkit-animation-name: shake-7; + animation-name: shake-7; } + +@-webkit-keyframes shake-7 { + 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90% { + -webkit-transform: translateX(7%); + transform: translateX(7%); } + 5%, 15%, 25%, 35%, 45%, 55%, 65%, 75%, 85%, 95% { + -webkit-transform: translateX(-7%); + transform: translateX(-7%); } } + +@keyframes shake-7 { + 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90% { + -webkit-transform: translateX(7%); + transform: translateX(7%); } + 5%, 15%, 25%, 35%, 45%, 55%, 65%, 75%, 85%, 95% { + -webkit-transform: translateX(-7%); + transform: translateX(-7%); } } + +.spin-cw { + -webkit-animation-name: spin-cw-1turn; + animation-name: spin-cw-1turn; } + +@-webkit-keyframes spin-cw-1turn { + 0% { + -webkit-transform: rotate(-1turn); + transform: rotate(-1turn); } + 100% { + -webkit-transform: rotate(0); + transform: rotate(0); } } + +@keyframes spin-cw-1turn { + 0% { + -webkit-transform: rotate(-1turn); + transform: rotate(-1turn); } + 100% { + -webkit-transform: rotate(0); + transform: rotate(0); } } + +.spin-ccw { + -webkit-animation-name: spin-cw-1turn; + animation-name: spin-cw-1turn; } + +@keyframes spin-cw-1turn { + 0% { + -webkit-transform: rotate(0); + transform: rotate(0); } + 100% { + -webkit-transform: rotate(1turn); + transform: rotate(1turn); } } + +.wiggle { + -webkit-animation-name: wiggle-7deg; + animation-name: wiggle-7deg; } + +@-webkit-keyframes wiggle-7deg { + 40%, 50%, 60% { + -webkit-transform: rotate(7deg); + transform: rotate(7deg); } + 35%, 45%, 55%, 65% { + -webkit-transform: rotate(-7deg); + transform: rotate(-7deg); } + 0%, 30%, 70%, 100% { + -webkit-transform: rotate(0); + transform: rotate(0); } } + +@keyframes wiggle-7deg { + 40%, 50%, 60% { + -webkit-transform: rotate(7deg); + transform: rotate(7deg); } + 35%, 45%, 55%, 65% { + -webkit-transform: rotate(-7deg); + transform: rotate(-7deg); } + 0%, 30%, 70%, 100% { + -webkit-transform: rotate(0); + transform: rotate(0); } } + +.shake, +.spin-cw, +.spin-ccw, +.wiggle { + -webkit-animation-duration: 500ms; + animation-duration: 500ms; } + +.infinite { + -webkit-animation-iteration-count: infinite; + animation-iteration-count: infinite; } + +.slow { + -webkit-animation-duration: 750ms !important; + animation-duration: 750ms !important; } + +.fast { + -webkit-animation-duration: 250ms !important; + animation-duration: 250ms !important; } + +.linear { + -webkit-animation-timing-function: linear !important; + animation-timing-function: linear !important; } + +.ease { + -webkit-animation-timing-function: ease !important; + animation-timing-function: ease !important; } + +.ease-in { + -webkit-animation-timing-function: ease-in !important; + animation-timing-function: ease-in !important; } + +.ease-out { + -webkit-animation-timing-function: ease-out !important; + animation-timing-function: ease-out !important; } + +.ease-in-out { + -webkit-animation-timing-function: ease-in-out !important; + animation-timing-function: ease-in-out !important; } + +.bounce-in { + -webkit-animation-timing-function: cubic-bezier(0.485, 0.155, 0.24, 1.245) !important; + animation-timing-function: cubic-bezier(0.485, 0.155, 0.24, 1.245) !important; } + +.bounce-out { + -webkit-animation-timing-function: cubic-bezier(0.485, 0.155, 0.515, 0.845) !important; + animation-timing-function: cubic-bezier(0.485, 0.155, 0.515, 0.845) !important; } + +.bounce-in-out { + -webkit-animation-timing-function: cubic-bezier(0.76, -0.245, 0.24, 1.245) !important; + animation-timing-function: cubic-bezier(0.76, -0.245, 0.24, 1.245) !important; } + +.short-delay { + -webkit-animation-delay: 300ms !important; + animation-delay: 300ms !important; } + +.long-delay { + -webkit-animation-delay: 700ms !important; + animation-delay: 700ms !important; } From 08cd589237f7ea59aad09df1f8ae08d3f916a17b Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Thu, 13 Oct 2016 14:26:42 -0700 Subject: [PATCH 23/49] Moved 'add new...' buttons on homepage. --- app/views/homepage/index.html.erb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/views/homepage/index.html.erb b/app/views/homepage/index.html.erb index aa1fcdc2aa..b3f86870bf 100644 --- a/app/views/homepage/index.html.erb +++ b/app/views/homepage/index.html.erb @@ -1,9 +1,5 @@

Top Five For All Categories

-
<%= link_to "Submit a new album for voting", new_album_path %>
-
<%= link_to "Submit a new book for voting", new_book_path %>
-
<%= link_to "Submit a new movie for voting", new_movie_path %>
- @@ -11,6 +7,12 @@ + + + + + + <% 5.times do |i| %> From 2c6054c38ded549189782689a1c0db1c87b050b0 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Thu, 13 Oct 2016 15:56:16 -0700 Subject: [PATCH 24/49] FINALLY GOT DOWNVOTE TO WORK for albums anyways --- app/controllers/albums_controller.rb | 11 +++++++++-- app/controllers/books_controller.rb | 8 ++++++++ app/controllers/movies_controller.rb | 8 ++++++++ app/views/homepage/index.html.erb | 15 ++++++++++++--- config/routes.rb | 18 ++++++++++++++---- lib/vote.rb | 11 +++++------ 6 files changed, 56 insertions(+), 15 deletions(-) diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index 3ec0dc53e2..3ff4e3951c 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -36,9 +36,16 @@ def update end end - def upvote + def vote album = Album.find(params[:id]) - add_vote(album).save + + if params[:vote] == "up" + add_vote(album).save + elsif params[:vote] == "down" + subtract_vote(album).save + else + raise + end redirect_to albums_path end diff --git a/app/controllers/books_controller.rb b/app/controllers/books_controller.rb index 6288e41726..16f965e590 100644 --- a/app/controllers/books_controller.rb +++ b/app/controllers/books_controller.rb @@ -49,6 +49,14 @@ def upvote redirect_to books_path end + def downvote + book = Book.find(params[:id]) + subtract_vote(book).save + + redirect_to books_path + end + + ####### STRONG PARAMS ######### private diff --git a/app/controllers/movies_controller.rb b/app/controllers/movies_controller.rb index 12f3dc80ba..5af52769c3 100644 --- a/app/controllers/movies_controller.rb +++ b/app/controllers/movies_controller.rb @@ -43,6 +43,14 @@ def upvote redirect_to movies_path end + def downvote + movie = Movies.find(params[:id]) + subtract_vote(movie).save + + redirect_to movies_path + end + + def destroy @movie = Movie.find(params[:id]).destroy diff --git a/app/views/homepage/index.html.erb b/app/views/homepage/index.html.erb index b3f86870bf..e45972c3fb 100644 --- a/app/views/homepage/index.html.erb +++ b/app/views/homepage/index.html.erb @@ -15,15 +15,24 @@ <% 5.times do |i| %> - + - + - + diff --git a/config/routes.rb b/config/routes.rb index 4f8fa22eee..ec647cb235 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,11 +1,21 @@ Rails.application.routes.draw do root 'homepage#index' - patch '/albums/:id', to: "albums#upvote", as: 'upvote_album' - patch '/books/:id', to: "books#upvote", as: 'upvote_book' - patch '/movies/:id', to: "movies#upvote", as: 'upvote_movie' + resources :albums, :books, :movies do + member do + patch 'vote' + end + end + + # patch '/albums/:id', to: "albums#vote", as: 'vote_album' + # put '/albums/:id', to: "albums#downvote", as: 'downvote_album' + + # patch '/books/:id', to: "books#upvote", as: 'upvote_book' + # put '/books/:id', to: "books#downvote", as: 'downvote_book' + # + # patch '/movies/:id', to: "movies#upvote", as: 'upvote_movie' + # put '/movies/:id', to: "movies#downvote", as: 'downvote_movie' - resources :albums, :books, :movies # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". diff --git a/lib/vote.rb b/lib/vote.rb index 16555875cb..5bb4fca729 100644 --- a/lib/vote.rb +++ b/lib/vote.rb @@ -1,13 +1,12 @@ module Vote - def add_vote(record) - record.rank_points += 1 - record.save + def subtract_vote(record) + record.rank_points -= 1 return record end - def subtract_vote(record) - record.rank_points -= 1 - record.save + def add_vote(record) + record.rank_points += 1 return record end + end From 440ef45b8577773eb69ae64ae33b122f6aafea01 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Thu, 13 Oct 2016 16:09:17 -0700 Subject: [PATCH 25/49] Downvotes work for books and movies. --- app/controllers/albums_controller.rb | 2 +- app/controllers/books_controller.rb | 18 +++++++++--------- app/controllers/movies_controller.rb | 18 +++++++++--------- app/views/homepage/index.html.erb | 8 ++++---- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index 3ff4e3951c..21513c4c1a 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -61,7 +61,7 @@ def destroy private def album_params - params.require(:album).permit(:name, :artist, :description, :rank_points) + params.require(:album).permit(:name, :artist, :description, :rank_points, :vote) end end diff --git a/app/controllers/books_controller.rb b/app/controllers/books_controller.rb index 16f965e590..e6c09c92cf 100644 --- a/app/controllers/books_controller.rb +++ b/app/controllers/books_controller.rb @@ -42,16 +42,16 @@ def destroy redirect_to books_path end - def upvote + def vote book = Book.find(params[:id]) - add_vote(book).save - redirect_to books_path - end - - def downvote - book = Book.find(params[:id]) - subtract_vote(book).save + if params[:vote] == "up" + add_vote(book).save + elsif params[:vote] == "down" + subtract_vote(book).save + else + raise + end redirect_to books_path end @@ -62,7 +62,7 @@ def downvote private def book_params - params.require(:book).permit(:name, :author, :description, :rank_points) + params.require(:book).permit(:name, :author, :description, :rank_points, :vote) end end diff --git a/app/controllers/movies_controller.rb b/app/controllers/movies_controller.rb index 5af52769c3..04fbaba800 100644 --- a/app/controllers/movies_controller.rb +++ b/app/controllers/movies_controller.rb @@ -36,16 +36,16 @@ def update end end - def upvote + def vote movie = Movie.find(params[:id]) - add_vote(movie).save - redirect_to movies_path - end - - def downvote - movie = Movies.find(params[:id]) - subtract_vote(movie).save + if params[:vote] == "up" + add_vote(movie).save + elsif params[:vote] == "down" + subtract_vote(movie).save + else + raise + end redirect_to movies_path end @@ -62,6 +62,6 @@ def destroy private def movie_params - params.require(:movie).permit(:name, :director, :description, :rank_points) + params.require(:movie).permit(:name, :director, :description, :rank_points, :vote) end end diff --git a/app/views/homepage/index.html.erb b/app/views/homepage/index.html.erb index e45972c3fb..46e8b7dfdc 100644 --- a/app/views/homepage/index.html.erb +++ b/app/views/homepage/index.html.erb @@ -23,15 +23,15 @@ From 92908358e96701c93a20eaac72169d3b563d6706 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Thu, 13 Oct 2016 16:21:27 -0700 Subject: [PATCH 26/49] Added Minitest Reporters gem --- Gemfile | 4 ++++ Gemfile.lock | 8 ++++++++ test/test_helper.rb | 1 + 3 files changed, 13 insertions(+) diff --git a/Gemfile b/Gemfile index ce761eeb96..3bd9fb44a0 100644 --- a/Gemfile +++ b/Gemfile @@ -43,3 +43,7 @@ group :development do gem 'spring' gem 'better_errors' end + +group :test do + gem 'minitest-reporters' +end diff --git a/Gemfile.lock b/Gemfile.lock index ec5dd5817b..8605f91ef5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -36,6 +36,7 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) + ansi (1.5.0) arel (6.0.3) better_errors (2.1.1) coderay (>= 1.0.0) @@ -77,6 +78,11 @@ GEM mime-types-data (3.2016.0521) mini_portile2 (2.1.0) minitest (5.9.1) + minitest-reporters (1.1.11) + ansi + builder + minitest (>= 5.0) + ruby-progressbar multi_json (1.12.1) nokogiri (1.6.8.1) mini_portile2 (~> 2.1.0) @@ -110,6 +116,7 @@ GEM rake (11.3.0) rdoc (4.2.2) json (~> 1.4) + ruby-progressbar (1.8.1) sass (3.4.22) sass-rails (5.0.6) railties (>= 4.0.0, < 6) @@ -155,6 +162,7 @@ DEPENDENCIES coffee-rails (~> 4.1.0) jbuilder (~> 2.0) jquery-rails + minitest-reporters rails (= 4.2.7) sass-rails (~> 5.0) sdoc (~> 0.4.0) diff --git a/test/test_helper.rb b/test/test_helper.rb index 92e39b2d78..2fee2e8e18 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,6 +1,7 @@ ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' +require 'minitest/reporters' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. From 17e772dea935e7dc7f970191ed2e9c14e5e632cd Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Thu, 13 Oct 2016 16:21:54 -0700 Subject: [PATCH 27/49] And added minitest reporters to test_helper.rb --- test/test_helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_helper.rb b/test/test_helper.rb index 2fee2e8e18..10e6e5f6e6 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -8,4 +8,5 @@ class ActiveSupport::TestCase fixtures :all # Add more helper methods to be used by all tests here... + Minitest::Reporters.use! end From 334c2bdb654bebceddcf9c23e9b25eb342cbcac1 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Thu, 13 Oct 2016 16:41:08 -0700 Subject: [PATCH 28/49] Added upvotes/downvotes to show pages --- app/views/albums/index.html.erb | 6 +++++- app/views/books/index.html.erb | 6 +++++- app/views/movies/index.html.erb | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/views/albums/index.html.erb b/app/views/albums/index.html.erb index aff1df21e5..e00d6a4235 100644 --- a/app/views/albums/index.html.erb +++ b/app/views/albums/index.html.erb @@ -2,13 +2,17 @@
<%= link_to "Submit a new album for voting", new_album_path %>
AlbumsMovies
<%= link_to "Submit a new album for voting", new_album_path %>
<%= link_to "Submit a new book for voting", new_book_path %>
<%= link_to "Submit a new movie for voting", new_movie_path %>
<%= button_to "Upvote", upvote_album_path(@albums[i]), contoller: :albums, action: :upvote, method: :patch %>
<%= button_to "Upvote", upvote_album_path(@albums[i]), contoller: :albums, action: :upvote, method: :patch %> + <%= button_to "⬆", vote_album_path(@albums[i], vote: "up"), contoller: :albums, action: :vote, method: :patch %> + <%= button_to "⬇", vote_album_path(@albums[i], vote: "down"), contoller: :albums, action: :vote, method: :patch %> + <%= "#{@albums[i].rank_points}" %> <%= "#{@albums[i].name}" %><%= button_to "Upvote", upvote_book_path(@books[i]), contoller: :books, action: :upvote, method: :patch %> + <%= button_to "⬆", vote_book_path(@books[i]), contoller: :books, action: :vote, method: :patch %> + <%= button_to "⬇", vote_book_path(@books[i]), contoller: :books, action: :vote, method: :patch %> + <%= "#{@books[i].rank_points}" %> <%= "#{@books[i].name}" %><%= button_to "Upvote", upvote_movie_path(@movies[i]), contoller: :movies, action: :upvote, method: :patch %> + <%= button_to "⬆", vote_movie_path(@movies[i]), contoller: :movies, action: :vote, method: :patch %> + <%= button_to "⬇", vote_movie_path(@movies[i]), contoller: :movies, action: :vote, method: :patch %> + <%= "#{@movies[i].rank_points}" %> <%= "#{@movies[i].name}" %>
<%= "#{@albums[i].name}" %> - <%= button_to "⬆", vote_book_path(@books[i]), contoller: :books, action: :vote, method: :patch %> - <%= button_to "⬇", vote_book_path(@books[i]), contoller: :books, action: :vote, method: :patch %> + <%= button_to "⬆", vote_book_path(@books[i], vote: "up"), contoller: :books, action: :vote, method: :patch %> + <%= button_to "⬇", vote_book_path(@books[i], vote: "down"), contoller: :books, action: :vote, method: :patch %> <%= "#{@books[i].rank_points}" %> <%= "#{@books[i].name}" %> - <%= button_to "⬆", vote_movie_path(@movies[i]), contoller: :movies, action: :vote, method: :patch %> - <%= button_to "⬇", vote_movie_path(@movies[i]), contoller: :movies, action: :vote, method: :patch %> + <%= button_to "⬆", vote_movie_path(@movies[i], vote: "up"), contoller: :movies, action: :vote, method: :patch %> + <%= button_to "⬇", vote_movie_path(@movies[i], vote: "down"), contoller: :movies, action: :vote, method: :patch %> <%= "#{@movies[i].rank_points}" %> <%= "#{@movies[i].name}" %>
- + <% @albums.each do |album| %> + diff --git a/app/views/books/index.html.erb b/app/views/books/index.html.erb index 817cc5f404..1137ee156f 100644 --- a/app/views/books/index.html.erb +++ b/app/views/books/index.html.erb @@ -2,12 +2,16 @@
<%= link_to "Submit a new book for voting", new_book_path %>
PointsPoints Album Name More...
+ <%= button_to "⬆", vote_album_path(album, vote: "up"), contoller: :albums, action: :vote, method: :patch %> + <%= button_to "⬇", vote_album_path(album, vote: "down"), contoller: :albums, action: :vote, method: :patch %> + <%= "#{album.rank_points}" %> <%= "#{album.name}" %> <%= link_to "[Details]", album_path(album) %>
- + <% @books.each do |book| %> + - + + <% end %>
PointsPoints Book Name More...
+ <%= button_to "⬆", vote_book_path(book, vote: "up"), contoller: :books, action: :vote, method: :patch %> + <%= button_to "⬇", vote_book_path(book, vote: "down"), contoller: :books, action: :vote, method: :patch %> + <%= "#{book.rank_points}" %> <%= "#{book.name}" %> diff --git a/app/views/movies/index.html.erb b/app/views/movies/index.html.erb index 4d3b8ffbb6..0179057010 100644 --- a/app/views/movies/index.html.erb +++ b/app/views/movies/index.html.erb @@ -2,12 +2,16 @@
<%= link_to "Submit a new movie for voting", new_movie_path %>
- + <% @movies.each do |movie| %> + diff --git a/config/routes.rb b/config/routes.rb index ec647cb235..7d1cbaadcb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,16 +6,19 @@ patch 'vote' end end - - # patch '/albums/:id', to: "albums#vote", as: 'vote_album' + + # THIS IS WRONG + # resources :albums, :books, :movies + # + # patch '/albums/:id', to: "albums#upvote", as: 'upvote_album' # put '/albums/:id', to: "albums#downvote", as: 'downvote_album' - + # # patch '/books/:id', to: "books#upvote", as: 'upvote_book' # put '/books/:id', to: "books#downvote", as: 'downvote_book' # # patch '/movies/:id', to: "movies#upvote", as: 'upvote_movie' # put '/movies/:id', to: "movies#downvote", as: 'downvote_movie' - + ###### # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". diff --git a/lib/sort_by_rank.rb b/lib/sort_by_rank.rb index f11867a2f9..2586040cdf 100644 --- a/lib/sort_by_rank.rb +++ b/lib/sort_by_rank.rb @@ -1,5 +1,14 @@ module SortByRank + def sort_by_rank(array) + array.map do |record| + if record.rank_points.nil? + record.rank_points = 0 + else + record + end + end + array.order(rank_points: :desc) end end diff --git a/test/controllers/albums_controller_test.rb b/test/controllers/albums_controller_test.rb new file mode 100644 index 0000000000..ad2d7bc98a --- /dev/null +++ b/test/controllers/albums_controller_test.rb @@ -0,0 +1,31 @@ +require 'test_helper' + +class AlbumsControllerTest < ActionController::TestCase + ### INDEX ### + test "Index should display correctly" do + get :index + assert_response :success + assert_template :index + end + + test "Index should populate all the records of albums" do + get :index + + assert_equal assigns(:albums).count, Album.count + end + + ### CREATE ### + + ### NEW ### + + ### EDIT ### + + ### SHOW ### + + ### UPDATE ### + + ### DESTROY ### + + ### VOTE ### + +end diff --git a/test/controllers/album_controller_test.rb b/test/controllers/books_controller_test.rb similarity index 58% rename from test/controllers/album_controller_test.rb rename to test/controllers/books_controller_test.rb index 5aaaa830a6..66da31d006 100644 --- a/test/controllers/album_controller_test.rb +++ b/test/controllers/books_controller_test.rb @@ -1,6 +1,6 @@ require 'test_helper' -class AlbumControllerTest < ActionController::TestCase +class BooksControllerTest < ActionController::TestCase # test "the truth" do # assert true # end diff --git a/test/controllers/movie_controller_test.rb b/test/controllers/movie_controller_test.rb deleted file mode 100644 index a12f1e576f..0000000000 --- a/test/controllers/movie_controller_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class MovieControllerTest < ActionController::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/controllers/book_controller_test.rb b/test/controllers/movies_controller_test.rb similarity index 57% rename from test/controllers/book_controller_test.rb rename to test/controllers/movies_controller_test.rb index 2f3a090be2..094edd7237 100644 --- a/test/controllers/book_controller_test.rb +++ b/test/controllers/movies_controller_test.rb @@ -1,6 +1,6 @@ require 'test_helper' -class BookControllerTest < ActionController::TestCase +class MoviesControllerTest < ActionController::TestCase # test "the truth" do # assert true # end diff --git a/test/fixtures/albums.yml b/test/fixtures/albums.yml index 6bd4b936c5..5a66497911 100644 --- a/test/fixtures/albums.yml +++ b/test/fixtures/albums.yml @@ -22,10 +22,10 @@ without_a_description: name: MyString artist: MyString description: - rank_points: 1 + rank_points: -1 without_rank_points: name: MyString - artist: + artist: MyString description: MyString rank_points: diff --git a/test/sort_by_rank_test.rb b/test/sort_by_rank_test.rb new file mode 100644 index 0000000000..ef911ff02d --- /dev/null +++ b/test/sort_by_rank_test.rb @@ -0,0 +1,18 @@ +require 'test_helper' +require 'sort_by_rank.rb' +include SortByRank + +class SortByRankTest < ActiveSupport::TestCase + # + # test "The first in the list should be greater than the last" do + # collect = [ + # Album.new(name:"Sdf", artist: "lskdjf", rank_points: 8), + # Book.new(name:"sat", author: "sdsdf", rank_points: 6), + # Movie.new(name: "k", director: "well", rank_points: 19) + # ] + # + # sort_by_rank(collect) + # + # assert_operator collect[1].rank_points, :>, collect[-1].rank_points + # end +end diff --git a/test/vote_test.rb b/test/vote_test.rb new file mode 100644 index 0000000000..671bc6eb9d --- /dev/null +++ b/test/vote_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class VoteTest < ActiveSupport::TestCase +end From fcc828fd3c354805fc16e1a6e5646acc01097231 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Fri, 14 Oct 2016 22:36:17 -0700 Subject: [PATCH 34/49] Added some more model controller methods --- test/controllers/albums_controller_test.rb | 44 ++++++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/test/controllers/albums_controller_test.rb b/test/controllers/albums_controller_test.rb index ad2d7bc98a..a60cc9b67c 100644 --- a/test/controllers/albums_controller_test.rb +++ b/test/controllers/albums_controller_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class AlbumsControllerTest < ActionController::TestCase - ### INDEX ### + ################## INDEX ################## test "Index should display correctly" do get :index assert_response :success @@ -14,18 +14,46 @@ class AlbumsControllerTest < ActionController::TestCase assert_equal assigns(:albums).count, Album.count end - ### CREATE ### + ################## CREATE ################## + test "Create should add one to all Albums" do + assert_difference("Album.count", 1) do + post :create, album: { name: "lkjsdf", artist: "sjkfsa", rank_points: 0 } + end + end + + test "Create should redirect to albums#index" do + post :create, album: { name: "lkjsdf", artist: "sjkfsa", rank_points: 0 } + assert_response :found + assert_redirected_to :albums + end + + ################## NEW ################## + test "should get the new form for a new albums" do + get :new + assert_response :success + assert_template :new - ### NEW ### + album = assigns(:album) + assert_not_nil album + assert_nil album.id + end - ### EDIT ### + ################## EDIT ################## + test "should get the edit form for a new albums" do + get :edit + assert_response :success + assert_template :edit - ### SHOW ### + album = assigns(:album) + assert_not_nil album + assert_nil album.id + end + ################## SHOW ################## - ### UPDATE ### + ################## UPDATE ################## - ### DESTROY ### + ################## DESTROY ################## - ### VOTE ### + ################## VOTE ################## end From 9cd651a05ffe4e9f124832b21ef5a4067a9300f5 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Sat, 15 Oct 2016 15:32:32 -0700 Subject: [PATCH 35/49] Changed the table on the front page to be three tables for Foundation CSS purposes. CSS'd other stuff a bit, too. --- app/assets/stylesheets/application.css | 14 ++- app/assets/stylesheets/foundation.css | 2 +- app/controllers/homepage_controller.rb | 6 +- app/views/homepage/index.html.erb | 122 ++++++++++++++++--------- app/views/layouts/application.html.erb | 10 +- 5 files changed, 104 insertions(+), 50 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 0fa2fb3301..cd95aa9678 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -13,5 +13,17 @@ *= require_tree . *= require_self */ +/*@import url('foundation.css')*/ - @import url('foundation.css') +h1, h2, h3, h4, h5, h6 { + font-family: 'Changa One', sans-serif; + text-align: center; +} + +p, td { + font-family: 'Varela', sans-serif; +} + +table h6 { + text-align: center; +} diff --git a/app/assets/stylesheets/foundation.css b/app/assets/stylesheets/foundation.css index 66aca962de..281b411de4 100644 --- a/app/assets/stylesheets/foundation.css +++ b/app/assets/stylesheets/foundation.css @@ -12,7 +12,7 @@ * without disabling user zoom. */ html { - font-family: sans-serif; + font-family: 'Varela', sans-serif; /* 1 */ -ms-text-size-adjust: 100%; /* 2 */ diff --git a/app/controllers/homepage_controller.rb b/app/controllers/homepage_controller.rb index a97053d9b0..b3da2437bd 100644 --- a/app/controllers/homepage_controller.rb +++ b/app/controllers/homepage_controller.rb @@ -3,8 +3,8 @@ class HomepageController < ApplicationController include SortByRank def index - @albums = sort_by_rank(Album.all) - @books = sort_by_rank(Book.all) - @movies = sort_by_rank(Movie.all) + @albums = sort_by_rank(Album.all).first(5) + @books = sort_by_rank(Book.all).first(5) + @movies = sort_by_rank(Movie.all).first(5) end end diff --git a/app/views/homepage/index.html.erb b/app/views/homepage/index.html.erb index 4e59832912..4d5a1c9b8c 100644 --- a/app/views/homepage/index.html.erb +++ b/app/views/homepage/index.html.erb @@ -1,46 +1,80 @@

Top Five For All Categories

-
PointsPoints Movie Name More...
+ <%= button_to "⬆", vote_movie_path(movie, vote: "up"), contoller: :movies, action: :vote, method: :patch %> + <%= button_to "⬇", vote_movie_path(movie, vote: "down"), contoller: :movies, action: :vote, method: :patch %> + <%= "#{movie.rank_points}" %> <%= "#{movie.name}" %> From 99df0b76940e904ce26b81077c592e6521e9a3d8 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Thu, 13 Oct 2016 16:43:56 -0700 Subject: [PATCH 29/49] Added YAML data for tests --- test/fixtures/albums.yml | 28 +++++++++++++++++++++++----- test/fixtures/books.yml | 26 ++++++++++++++++++++++---- test/fixtures/movies.yml | 28 +++++++++++++++++++++++----- 3 files changed, 68 insertions(+), 14 deletions(-) diff --git a/test/fixtures/albums.yml b/test/fixtures/albums.yml index 8f3dac63cc..a01483fa59 100644 --- a/test/fixtures/albums.yml +++ b/test/fixtures/albums.yml @@ -1,13 +1,31 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html -one: - name: MyString - artist: MyString +correct_album: + name: + author: MyString description: MyString rank: 1 -two: +without_a_name: + name: + author: MyString + description: MyString + rank: 1 + +without_an_author: name: MyString - artist: MyString + author: description: MyString rank: 1 + +without_a_description: + name: MyString + author: MyString + description: + rank: 1 + +without_rank_points: + name: MyString + author: + description: MyString + rank: diff --git a/test/fixtures/books.yml b/test/fixtures/books.yml index 3c3770bd30..6c5d695af6 100644 --- a/test/fixtures/books.yml +++ b/test/fixtures/books.yml @@ -1,13 +1,31 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html -one: - name: MyString +correct_book: + name: author: MyString description: MyString rank: 1 -two: - name: MyString +without_a_name: + name: author: MyString description: MyString rank: 1 + +without_an_author: + name: MyString + author: + description: MyString + rank: 1 + +without_a_description: + name: MyString + author: MyString + description: + rank: 1 + +without_rank_points: + name: MyString + author: + description: MyString + rank: diff --git a/test/fixtures/movies.yml b/test/fixtures/movies.yml index b6385086e0..446b46cf56 100644 --- a/test/fixtures/movies.yml +++ b/test/fixtures/movies.yml @@ -1,13 +1,31 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html -one: - name: MyString - director: MyString +correct_movie: + name: + author: MyString description: MyString rank: 1 -two: +without_a_name: + name: + author: MyString + description: MyString + rank: 1 + +without_an_author: name: MyString - director: MyString + author: description: MyString rank: 1 + +without_a_description: + name: MyString + author: MyString + description: + rank: 1 + +without_rank_points: + name: MyString + author: + description: MyString + rank: From b4fe4f7a4404ea425b38ae15979a2b405a96bdf4 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Thu, 13 Oct 2016 16:59:29 -0700 Subject: [PATCH 30/49] Added bangs to create methods, added a single validation and test to albums model --- app/controllers/albums_controller.rb | 2 +- app/controllers/books_controller.rb | 2 +- app/controllers/movies_controller.rb | 2 +- app/models/album.rb | 2 ++ test/fixtures/albums.yml | 22 +++++++++++----------- test/fixtures/books.yml | 10 +++++----- test/fixtures/movies.yml | 22 +++++++++++----------- test/models/album_test.rb | 6 +++--- 8 files changed, 35 insertions(+), 33 deletions(-) diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index 21513c4c1a..7b6af3156d 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -9,7 +9,7 @@ def index end def create - @album = Album.create(album_params) + @album = Album.create!(album_params) redirect_to albums_path end diff --git a/app/controllers/books_controller.rb b/app/controllers/books_controller.rb index e6c09c92cf..3cc0e73206 100644 --- a/app/controllers/books_controller.rb +++ b/app/controllers/books_controller.rb @@ -9,7 +9,7 @@ def index end def create - @book = Book.create(book_params) + @book = Book.create!(book_params) redirect_to books_path end diff --git a/app/controllers/movies_controller.rb b/app/controllers/movies_controller.rb index 04fbaba800..ef0cb9e9e6 100644 --- a/app/controllers/movies_controller.rb +++ b/app/controllers/movies_controller.rb @@ -9,7 +9,7 @@ def index end def create - @movie = Movie.create(movie_params) + @movie = Movie.create!(movie_params) redirect_to movies_path end diff --git a/app/models/album.rb b/app/models/album.rb index dc9f868dca..84c62ef779 100644 --- a/app/models/album.rb +++ b/app/models/album.rb @@ -1,4 +1,6 @@ class Album < ActiveRecord::Base require 'sort_by_rank.rb' include SortByRank + + validates :name, presence: true end diff --git a/test/fixtures/albums.yml b/test/fixtures/albums.yml index a01483fa59..e23ef70e68 100644 --- a/test/fixtures/albums.yml +++ b/test/fixtures/albums.yml @@ -2,30 +2,30 @@ correct_album: name: - author: MyString + artist: MyString description: MyString - rank: 1 + rank_points: 1 without_a_name: name: - author: MyString + artist: MyString description: MyString - rank: 1 + rank_points: 1 -without_an_author: +without_an_artist: name: MyString - author: + artist: description: MyString - rank: 1 + rank_points: 1 without_a_description: name: MyString - author: MyString + artist: MyString description: - rank: 1 + rank_points: 1 without_rank_points: name: MyString - author: + artist: description: MyString - rank: + rank_points: diff --git a/test/fixtures/books.yml b/test/fixtures/books.yml index 6c5d695af6..43219130a7 100644 --- a/test/fixtures/books.yml +++ b/test/fixtures/books.yml @@ -4,28 +4,28 @@ correct_book: name: author: MyString description: MyString - rank: 1 + rank_points: 1 without_a_name: name: author: MyString description: MyString - rank: 1 + rank_points: 1 without_an_author: name: MyString author: description: MyString - rank: 1 + rank_points: 1 without_a_description: name: MyString author: MyString description: - rank: 1 + rank_points: 1 without_rank_points: name: MyString author: description: MyString - rank: + rank_points: diff --git a/test/fixtures/movies.yml b/test/fixtures/movies.yml index 446b46cf56..9c3eb75143 100644 --- a/test/fixtures/movies.yml +++ b/test/fixtures/movies.yml @@ -2,30 +2,30 @@ correct_movie: name: - author: MyString + director: MyString description: MyString - rank: 1 + rank_points: 1 without_a_name: name: - author: MyString + director: MyString description: MyString - rank: 1 + rank_points: 1 -without_an_author: +without_a_director: name: MyString - author: + director: description: MyString - rank: 1 + rank_points: 1 without_a_description: name: MyString - author: MyString + director: MyString description: - rank: 1 + rank_points: 1 without_rank_points: name: MyString - author: + director: description: MyString - rank: + rank_points: diff --git a/test/models/album_test.rb b/test/models/album_test.rb index 1efcda03fb..cb9ea82f07 100644 --- a/test/models/album_test.rb +++ b/test/models/album_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class AlbumTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end + test "Album must have a name" do + assert_not albums("without_a_name").valid? + end end From 3c6a39d3396bf9e45710b34bc4cff386e7cab3cc Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Thu, 13 Oct 2016 21:40:10 -0700 Subject: [PATCH 31/49] Four passing tests for Album data validation --- app/models/album.rb | 7 ++++--- test/fixtures/albums.yml | 2 +- test/models/album_test.rb | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/app/models/album.rb b/app/models/album.rb index 84c62ef779..74a10e7be1 100644 --- a/app/models/album.rb +++ b/app/models/album.rb @@ -1,6 +1,7 @@ class Album < ActiveRecord::Base - require 'sort_by_rank.rb' - include SortByRank - validates :name, presence: true + validates :artist, presence: true + validates :rank_points, presence: true + + end diff --git a/test/fixtures/albums.yml b/test/fixtures/albums.yml index e23ef70e68..6bd4b936c5 100644 --- a/test/fixtures/albums.yml +++ b/test/fixtures/albums.yml @@ -1,7 +1,7 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html correct_album: - name: + name: MyString artist: MyString description: MyString rank_points: 1 diff --git a/test/models/album_test.rb b/test/models/album_test.rb index cb9ea82f07..72f8a71a48 100644 --- a/test/models/album_test.rb +++ b/test/models/album_test.rb @@ -4,4 +4,21 @@ class AlbumTest < ActiveSupport::TestCase test "Album must have a name" do assert_not albums("without_a_name").valid? end + + test "Album must have some sort of rank point value" do + assert_not albums("without_rank_points").valid? + end + + test "Album must have an artist" do + assert_not albums("without_an_artist").valid? + end + + test "Album can have negative points" do + album = albums("correct_album") + album.rank_points -= 2 + assert_equal(-1, album.rank_points) + assert album.valid? + end + + end From 9cca87c9848922f91e9f2baaae7dd53593a5c707 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Thu, 13 Oct 2016 21:44:33 -0700 Subject: [PATCH 32/49] Added data validation tests for book and movie models --- app/models/book.rb | 5 +++-- app/models/movie.rb | 5 +++-- test/fixtures/books.yml | 2 +- test/fixtures/movies.yml | 2 +- test/models/album_test.rb | 1 - test/models/book_test.rb | 21 ++++++++++++++++++--- test/models/movie_test.rb | 21 ++++++++++++++++++--- 7 files changed, 44 insertions(+), 13 deletions(-) diff --git a/app/models/book.rb b/app/models/book.rb index d7f4f26843..33d7173c18 100644 --- a/app/models/book.rb +++ b/app/models/book.rb @@ -1,4 +1,5 @@ class Book < ActiveRecord::Base - require 'sort_by_rank.rb' - include SortByRank + validates :name, presence: true + validates :author, presence: true + validates :rank_points, presence: true end diff --git a/app/models/movie.rb b/app/models/movie.rb index a5f369533d..d3f7fe0d3d 100644 --- a/app/models/movie.rb +++ b/app/models/movie.rb @@ -1,4 +1,5 @@ class Movie < ActiveRecord::Base - require 'sort_by_rank.rb' - include SortByRank + validates :name, presence: true + validates :director, presence: true + validates :rank_points, presence: true end diff --git a/test/fixtures/books.yml b/test/fixtures/books.yml index 43219130a7..ee99702659 100644 --- a/test/fixtures/books.yml +++ b/test/fixtures/books.yml @@ -1,7 +1,7 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html correct_book: - name: + name: MyString author: MyString description: MyString rank_points: 1 diff --git a/test/fixtures/movies.yml b/test/fixtures/movies.yml index 9c3eb75143..e8c8fcd1ce 100644 --- a/test/fixtures/movies.yml +++ b/test/fixtures/movies.yml @@ -1,7 +1,7 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html correct_movie: - name: + name: MyString director: MyString description: MyString rank_points: 1 diff --git a/test/models/album_test.rb b/test/models/album_test.rb index 72f8a71a48..df16c60186 100644 --- a/test/models/album_test.rb +++ b/test/models/album_test.rb @@ -20,5 +20,4 @@ class AlbumTest < ActiveSupport::TestCase assert album.valid? end - end diff --git a/test/models/book_test.rb b/test/models/book_test.rb index e48079d4f7..496114e8b4 100644 --- a/test/models/book_test.rb +++ b/test/models/book_test.rb @@ -1,7 +1,22 @@ require 'test_helper' class BookTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end + test "Book must have a name" do + assert_not books("without_a_name").valid? + end + + test "Book must have some sort of rank point value" do + assert_not books("without_rank_points").valid? + end + + test "Book must have an author" do + assert_not books("without_an_author").valid? + end + + test "Book can have negative points" do + book = books("correct_book") + book.rank_points -= 2 + assert_equal(-1, book.rank_points) + assert book.valid? + end end diff --git a/test/models/movie_test.rb b/test/models/movie_test.rb index 22d7084689..346c072566 100644 --- a/test/models/movie_test.rb +++ b/test/models/movie_test.rb @@ -1,7 +1,22 @@ require 'test_helper' class MovieTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end + test "Movie must have a name" do + assert_not movies("without_a_name").valid? + end + + test "Movie must have some sort of rank point value" do + assert_not movies("without_rank_points").valid? + end + + test "Movie must have a director" do + assert_not movies("without_a_director").valid? + end + + test "Movie can have negative points" do + movie = movies("correct_movie") + movie.rank_points -= 2 + assert_equal(-1, movie.rank_points) + assert movie.valid? + end end From d9a6d9b2be2f0daaae5d84bd4b3f22e56e219a01 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Fri, 14 Oct 2016 14:22:16 -0700 Subject: [PATCH 33/49] Finished album_controller index method tests --- app/controllers/albums_controller.rb | 7 +++-- app/views/homepage/index.html.erb | 12 +++---- config/routes.rb | 11 ++++--- lib/sort_by_rank.rb | 9 ++++++ test/controllers/albums_controller_test.rb | 31 +++++++++++++++++++ ...oller_test.rb => books_controller_test.rb} | 2 +- test/controllers/movie_controller_test.rb | 7 ----- ...ller_test.rb => movies_controller_test.rb} | 2 +- test/fixtures/albums.yml | 4 +-- test/sort_by_rank_test.rb | 18 +++++++++++ test/vote_test.rb | 4 +++ 11 files changed, 83 insertions(+), 24 deletions(-) create mode 100644 test/controllers/albums_controller_test.rb rename test/controllers/{album_controller_test.rb => books_controller_test.rb} (58%) delete mode 100644 test/controllers/movie_controller_test.rb rename test/controllers/{book_controller_test.rb => movies_controller_test.rb} (57%) create mode 100644 test/sort_by_rank_test.rb create mode 100644 test/vote_test.rb diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index 7b6af3156d..5e99b4088a 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -7,6 +7,10 @@ class AlbumsController < ApplicationController def index @albums = sort_by_rank(Album.all) end + + def new + @album = Album.new + end def create @album = Album.create!(album_params) @@ -14,9 +18,6 @@ def create redirect_to albums_path end - def new - @album = Album.new - end def edit @album = Album.find(params[:id]) diff --git a/app/views/homepage/index.html.erb b/app/views/homepage/index.html.erb index 46e8b7dfdc..4e59832912 100644 --- a/app/views/homepage/index.html.erb +++ b/app/views/homepage/index.html.erb @@ -16,22 +16,22 @@ <% 5.times do |i| %>
- <%= button_to "⬆", vote_album_path(@albums[i], vote: "up"), contoller: :albums, action: :vote, method: :patch %> - <%= button_to "⬇", vote_album_path(@albums[i], vote: "down"), contoller: :albums, action: :vote, method: :patch %> + <%= button_to "⬆", vote_album_path(@albums[i], vote: "up"), controller: :albums, action: :vote, method: :patch %> + <%= button_to "⬇", vote_album_path(@albums[i], vote: "down"), controller: :albums, action: :vote, method: :patch %> <%= "#{@albums[i].rank_points}" %> <%= "#{@albums[i].name}" %> - <%= button_to "⬆", vote_book_path(@books[i], vote: "up"), contoller: :books, action: :vote, method: :patch %> - <%= button_to "⬇", vote_book_path(@books[i], vote: "down"), contoller: :books, action: :vote, method: :patch %> + <%= button_to "⬆", vote_book_path(@books[i], vote: "up"), controller: :books, action: :vote, method: :patch %> + <%= button_to "⬇", vote_book_path(@books[i], vote: "down"), controller: :books, action: :vote, method: :patch %> <%= "#{@books[i].rank_points}" %> <%= "#{@books[i].name}" %> - <%= button_to "⬆", vote_movie_path(@movies[i], vote: "up"), contoller: :movies, action: :vote, method: :patch %> - <%= button_to "⬇", vote_movie_path(@movies[i], vote: "down"), contoller: :movies, action: :vote, method: :patch %> + <%= button_to "⬆", vote_movie_path(@movies[i], vote: "up"), controller: :movies, action: :vote, method: :patch %> + <%= button_to "⬇", vote_movie_path(@movies[i], vote: "down"), controller: :movies, action: :vote, method: :patch %> <%= "#{@movies[i].rank_points}" %> <%= "#{@movies[i].name}" %>
- - - - - - - - - - - - - <% 5.times do |i| %> - - - - - - - - - - - - - - <% end %> - - - - - - -
AlbumsBooksMovies
<%= link_to "Submit a new album for voting", new_album_path %>
<%= link_to "Submit a new book for voting", new_book_path %>
<%= link_to "Submit a new movie for voting", new_movie_path %>
- <%= button_to "⬆", vote_album_path(@albums[i], vote: "up"), controller: :albums, action: :vote, method: :patch %> - <%= button_to "⬇", vote_album_path(@albums[i], vote: "down"), controller: :albums, action: :vote, method: :patch %> - <%= "#{@albums[i].rank_points}" %><%= "#{@albums[i].name}" %> - <%= button_to "⬆", vote_book_path(@books[i], vote: "up"), controller: :books, action: :vote, method: :patch %> - <%= button_to "⬇", vote_book_path(@books[i], vote: "down"), controller: :books, action: :vote, method: :patch %> - <%= "#{@books[i].rank_points}" %><%= "#{@books[i].name}" %> - <%= button_to "⬆", vote_movie_path(@movies[i], vote: "up"), controller: :movies, action: :vote, method: :patch %> - <%= button_to "⬇", vote_movie_path(@movies[i], vote: "down"), controller: :movies, action: :vote, method: :patch %> - <%= "#{@movies[i].rank_points}" %><%= "#{@movies[i].name}" %>
<%= link_to "More Albums...", albums_path %><%= link_to "More Books...", books_path %><%= link_to "More Movies...", movies_path %>
+
+ + + + + + + + + + + <% @albums.each do |album| %> + + + + + + <% end %> + + + + +
Albums
<%= link_to "Submit a new album for voting", new_album_path %>
+ <%= button_to "⬆", vote_album_path(album, vote: "up"), controller: :albums, action: :vote, method: :patch %> + <%= button_to "⬇", vote_album_path(album, vote: "down"), controller: :albums, action: :vote, method: :patch %> + <%= "#{album.rank_points}" %><%= "#{album.name}" %>
<%= link_to "More Albums...", albums_path %>
+ + + + + + + + + + + <% @books.each do |book| %> + + + + + + <% end %> + + + + +
Books
<%= link_to "Submit a new book for voting", new_book_path %>
+ <%= button_to "⬆", vote_book_path(book, vote: "up"), controller: :books, action: :vote, method: :patch %> + <%= button_to "⬇", vote_book_path(book, vote: "down"), controller: :books, action: :vote, method: :patch %> + <%= "#{book.rank_points}" %><%= "#{book.name}" %>
<%= link_to "More Books...", books_path %>
+ + + + + + + + + + + <% @movies.each do |movie| %> + + + + + + <% end %> + + + + +
Movies
<%= link_to "Submit a new movie for voting", new_movie_path %>
+ <%= button_to "⬆", vote_movie_path(movie, vote: "up"), controller: :movies, action: :vote, method: :patch %> + <%= button_to "⬇", vote_movie_path(movie, vote: "down"), controller: :movies, action: :vote, method: :patch %> + <%= "#{movie.rank_points}" %><%= "#{movie.name}" %>
<%= link_to "More Movies...", movies_path %>
+ +
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 2d02e8fbd4..0d277a5a10 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,10 +5,18 @@ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> <%= csrf_meta_tags %> + + -<%= yield %> +
+

Media Ranker

+
+ +
+ <%= yield %> +
From d0ce63e0f53f1cc181117e199bf658f6fdc0cf1c Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Sat, 15 Oct 2016 15:55:55 -0700 Subject: [PATCH 36/49] Added delete links on model index pages --- app/views/albums/index.html.erb | 3 ++- app/views/books/index.html.erb | 3 +-- app/views/movies/index.html.erb | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/views/albums/index.html.erb b/app/views/albums/index.html.erb index e00d6a4235..075f07c338 100644 --- a/app/views/albums/index.html.erb +++ b/app/views/albums/index.html.erb @@ -15,6 +15,7 @@
<%= "#{album.rank_points}" %> <%= "#{album.name}" %><%= link_to "[Details]", album_path(album) %>
<%= link_to "[Details]", album_path(album) %> | <%= link_to "[Delete]", album_path(album), method: :delete, data: { confirm: "Honestly?" } %>
diff --git a/app/views/books/index.html.erb b/app/views/books/index.html.erb index 1137ee156f..659cc1de4d 100644 --- a/app/views/books/index.html.erb +++ b/app/views/books/index.html.erb @@ -14,8 +14,7 @@ <%= "#{book.rank_points}" %> <%= "#{book.name}" %> - - <%= link_to "[Details]", book_path(book) %> + <%= link_to "[Details]", book_path(book) %> | <%= link_to "[Delete]", book_path(book), method: :delete, data: { confirm: "Honestly?" } %> <% end %> diff --git a/app/views/movies/index.html.erb b/app/views/movies/index.html.erb index 0179057010..d6745efe53 100644 --- a/app/views/movies/index.html.erb +++ b/app/views/movies/index.html.erb @@ -14,8 +14,7 @@ <%= "#{movie.rank_points}" %> <%= "#{movie.name}" %> - - <%= link_to "[Details]", movie_path(movie) %> + <%= link_to "[Details]", movie_path(movie) %> | <%= link_to "[Delete]", movie_path(movie), method: :delete, data: { confirm: "Honestly?" } %> <% end %> From f9a6ee00dc4561393bacdeefa6c94047a03ef6ad Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Sat, 15 Oct 2016 16:17:52 -0700 Subject: [PATCH 37/49] Actually decided to undo delete opens on model index pages, added root path buttons instead to get back to the homepage. --- app/views/albums/index.html.erb | 5 ++++- app/views/books/index.html.erb | 6 +++++- app/views/layouts/application.html.erb | 4 ++-- app/views/movies/index.html.erb | 6 +++++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/views/albums/index.html.erb b/app/views/albums/index.html.erb index 075f07c338..56dcbe017e 100644 --- a/app/views/albums/index.html.erb +++ b/app/views/albums/index.html.erb @@ -1,5 +1,6 @@

All Albums

<%= link_to "Submit a new album for voting", new_album_path %>
+ @@ -15,7 +16,9 @@ - + <% end %>
Points <%= "#{album.rank_points}" %> <%= "#{album.name}" %><%= link_to "[Details]", album_path(album) %> | <%= link_to "[Delete]", album_path(album), method: :delete, data: { confirm: "Honestly?" } %><%= link_to "More Details...", album_path(album) %>
+ +
<%= link_to "Head back home", root_path %>
diff --git a/app/views/books/index.html.erb b/app/views/books/index.html.erb index 659cc1de4d..ee0874b20b 100644 --- a/app/views/books/index.html.erb +++ b/app/views/books/index.html.erb @@ -1,11 +1,13 @@

All Books

<%= link_to "Submit a new book for voting", new_book_path %>
+ + <% @books.each do |book| %> - + <% end %>
Points Book Name More...
@@ -14,7 +16,9 @@ <%= "#{book.rank_points}" %> <%= "#{book.name}" %><%= link_to "[Details]", book_path(book) %> | <%= link_to "[Delete]", book_path(book), method: :delete, data: { confirm: "Honestly?" } %><%= link_to "More Details...", book_path(book) %>
+ +
<%= link_to "Head back home", root_path %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 0d277a5a10..62ee14f71c 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -14,9 +14,9 @@

Media Ranker

-
+
<%= yield %> -
+ diff --git a/app/views/movies/index.html.erb b/app/views/movies/index.html.erb index d6745efe53..955b0ab69f 100644 --- a/app/views/movies/index.html.erb +++ b/app/views/movies/index.html.erb @@ -1,11 +1,13 @@

All Movies

<%= link_to "Submit a new movie for voting", new_movie_path %>
+ + <% @movies.each do |movie| %> - + <% end %>
Points Movie Name More...
@@ -14,7 +16,9 @@ <%= "#{movie.rank_points}" %> <%= "#{movie.name}" %><%= link_to "[Details]", movie_path(movie) %> | <%= link_to "[Delete]", movie_path(movie), method: :delete, data: { confirm: "Honestly?" } %><%= link_to "More Details...", movie_path(movie) %>
+ +
<%= link_to "Head back home", root_path %>
From 1ed2c3891c5671c4f1e527d93daac502badb0560 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Sat, 15 Oct 2016 16:23:12 -0700 Subject: [PATCH 38/49] Added back buttons to show pages for all models --- app/views/albums/show.html.erb | 3 +++ app/views/books/show.html.erb | 3 +++ app/views/movies/show.html.erb | 3 +++ 3 files changed, 9 insertions(+) diff --git a/app/views/albums/show.html.erb b/app/views/albums/show.html.erb index a53225eca5..2cc8d0832f 100644 --- a/app/views/albums/show.html.erb +++ b/app/views/albums/show.html.erb @@ -18,3 +18,6 @@ <%= link_to "[Delete]", album_path(@album), method: :delete, data: { confirm: "Really, now?" } %>
+ +
<%= link_to "Head back to all albums", albums_path %>
+
<%= link_to "Head back home", root_path %>
diff --git a/app/views/books/show.html.erb b/app/views/books/show.html.erb index f9ac0e961a..7d29b00054 100644 --- a/app/views/books/show.html.erb +++ b/app/views/books/show.html.erb @@ -18,3 +18,6 @@ <%= link_to "[Delete]", book_path(@book), method: :delete, data: { confirm: "Really, now?" } %>
+ +
<%= link_to "Head back to all books", books_path %>
+
<%= link_to "Head back home", root_path %>
diff --git a/app/views/movies/show.html.erb b/app/views/movies/show.html.erb index a170bee02d..9d39fc070a 100644 --- a/app/views/movies/show.html.erb +++ b/app/views/movies/show.html.erb @@ -18,3 +18,6 @@ <%= link_to "[Delete]", movie_path(@movie), method: :delete, data: { confirm: "Really, now?" } %> + +
<%= link_to "Head back to all movies", movies_path %>
+
<%= link_to "Head back home", root_path %>
From 24e91f75a3682697c0ab61997952057905b6dc80 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Sun, 16 Oct 2016 12:09:34 -0700 Subject: [PATCH 39/49] Fixed fixtures so they're all correctly validated. Changed model tests to compensate for correct fixtures. Finished books controller tests --- app/controllers/albums_controller.rb | 4 +- app/controllers/books_controller.rb | 2 +- app/controllers/movies_controller.rb | 2 +- test/controllers/albums_controller_test.rb | 40 +--------- test/controllers/books_controller_test.rb | 88 +++++++++++++++++++++- test/fixtures/albums.yml | 12 +-- test/fixtures/books.yml | 16 ++-- test/fixtures/movies.yml | 16 ++-- test/models/album_test.rb | 22 ++++-- test/models/book_test.rb | 20 +++-- test/models/movie_test.rb | 22 ++++-- 11 files changed, 160 insertions(+), 84 deletions(-) diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index 5e99b4088a..9c8f6a2310 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -7,7 +7,7 @@ class AlbumsController < ApplicationController def index @albums = sort_by_rank(Album.all) end - + def new @album = Album.new end @@ -15,7 +15,7 @@ def new def create @album = Album.create!(album_params) - redirect_to albums_path + redirect_to album_path(@album) end diff --git a/app/controllers/books_controller.rb b/app/controllers/books_controller.rb index 3cc0e73206..9ce01f049c 100644 --- a/app/controllers/books_controller.rb +++ b/app/controllers/books_controller.rb @@ -11,7 +11,7 @@ def index def create @book = Book.create!(book_params) - redirect_to books_path + redirect_to book_path(@book) end def new diff --git a/app/controllers/movies_controller.rb b/app/controllers/movies_controller.rb index ef0cb9e9e6..34eed486db 100644 --- a/app/controllers/movies_controller.rb +++ b/app/controllers/movies_controller.rb @@ -11,7 +11,7 @@ def index def create @movie = Movie.create!(movie_params) - redirect_to movies_path + redirect_to movie_path(@movie) end def new diff --git a/test/controllers/albums_controller_test.rb b/test/controllers/albums_controller_test.rb index a60cc9b67c..b0e7ead647 100644 --- a/test/controllers/albums_controller_test.rb +++ b/test/controllers/albums_controller_test.rb @@ -2,52 +2,16 @@ class AlbumsControllerTest < ActionController::TestCase ################## INDEX ################## - test "Index should display correctly" do - get :index - assert_response :success - assert_template :index - end - test "Index should populate all the records of albums" do - get :index - - assert_equal assigns(:albums).count, Album.count - end ################## CREATE ################## - test "Create should add one to all Albums" do - assert_difference("Album.count", 1) do - post :create, album: { name: "lkjsdf", artist: "sjkfsa", rank_points: 0 } - end - end - - test "Create should redirect to albums#index" do - post :create, album: { name: "lkjsdf", artist: "sjkfsa", rank_points: 0 } - assert_response :found - assert_redirected_to :albums - end + ################## NEW ################## - test "should get the new form for a new albums" do - get :new - assert_response :success - assert_template :new - album = assigns(:album) - assert_not_nil album - assert_nil album.id - end ################## EDIT ################## - test "should get the edit form for a new albums" do - get :edit - assert_response :success - assert_template :edit - - album = assigns(:album) - assert_not_nil album - assert_nil album.id - end + ################## SHOW ################## ################## UPDATE ################## diff --git a/test/controllers/books_controller_test.rb b/test/controllers/books_controller_test.rb index 66da31d006..802499af8d 100644 --- a/test/controllers/books_controller_test.rb +++ b/test/controllers/books_controller_test.rb @@ -1,7 +1,89 @@ require 'test_helper' class BooksControllerTest < ActionController::TestCase - # test "the truth" do - # assert true - # end + setup do + @book = books(:correct_book) + end + + ############### INDEX ############### + test "should get index" do + get :index + assert_response :success + assert_template :index + assert_not_nil assigns(:books) + end + + test "Index should populate all the records of books" do + get :index + + assert_equal assigns(:books).count, Book.count + end + + test "Index should sort the books by rank" do + get :index + books = assigns(:books) + + assert_operator books[0].rank_points, :>=, books[-1].rank_points + end + + ############### NEW ############### + test "New should get new page" do + get :new + assert_response :success + assert_template :new + end + + test "New should create a new book but not save it yet" do + get :new + book = assigns(:book) + assert_not_nil book + assert_nil book.id + end + + ############### CREATE ############### + test "Create should add 1 to all books" do + assert_difference('Book.count', 1) do + post :create, book: { name: "lksjdf", author: "sdfasdf", rank_points: 0 } + end + end + + test "Create should redirect to created book page" do + post :create, book: { name: "lkjsdf", author: "sjkfsa", rank_points: 0 } + + assert_response :found + assert_redirected_to book_path(assigns(:book)) + end + + ############### SHOW ############### + test "should show book" do + get :show, id: @book + assert_response :success + end + + ############### EDIT ############### + test "should get edit" do + get :edit, id: @book + assert_response :success + end + + ############### UPDATE ############### + test "should redirect to correct page" do + patch :update, id: @book, book: { name: "sdfsdfsd" } + assert_redirected_to book_path(assigns(:book)) + end + + test "should update book name" do + patch :update, id: @book, book: { name: "hey" } + assert_equal "hey", assigns(:book).name + assert_redirected_to book_path(assigns(:book)) + end + + ############### DESTROY ############### + test "should destroy book" do + assert_difference('Book.count', -1) do + delete :destroy, id: @book + end + + assert_redirected_to books_path + end end diff --git a/test/fixtures/albums.yml b/test/fixtures/albums.yml index 5a66497911..a1f757f3e1 100644 --- a/test/fixtures/albums.yml +++ b/test/fixtures/albums.yml @@ -4,19 +4,19 @@ correct_album: name: MyString artist: MyString description: MyString - rank_points: 1 + rank_points: 10 without_a_name: - name: + name: MyString artist: MyString description: MyString - rank_points: 1 + rank_points: 14 without_an_artist: name: MyString - artist: + artist: MyString description: MyString - rank_points: 1 + rank_points: -19 without_a_description: name: MyString @@ -28,4 +28,4 @@ without_rank_points: name: MyString artist: MyString description: MyString - rank_points: + rank_points: 0 diff --git a/test/fixtures/books.yml b/test/fixtures/books.yml index ee99702659..62870a37aa 100644 --- a/test/fixtures/books.yml +++ b/test/fixtures/books.yml @@ -4,28 +4,28 @@ correct_book: name: MyString author: MyString description: MyString - rank_points: 1 + rank_points: 19 without_a_name: - name: + name: MyString author: MyString description: MyString - rank_points: 1 + rank_points: 14 without_an_author: name: MyString - author: + author: MyString description: MyString - rank_points: 1 + rank_points: 0 without_a_description: name: MyString author: MyString description: - rank_points: 1 + rank_points: 4 without_rank_points: name: MyString - author: + author: MyString description: MyString - rank_points: + rank_points: -19 diff --git a/test/fixtures/movies.yml b/test/fixtures/movies.yml index e8c8fcd1ce..8e7938c399 100644 --- a/test/fixtures/movies.yml +++ b/test/fixtures/movies.yml @@ -4,28 +4,28 @@ correct_movie: name: MyString director: MyString description: MyString - rank_points: 1 + rank_points: 16 without_a_name: - name: + name: MyString director: MyString description: MyString - rank_points: 1 + rank_points: 11 without_a_director: name: MyString - director: + director: MyString description: MyString - rank_points: 1 + rank_points: 0 without_a_description: name: MyString director: MyString description: - rank_points: 1 + rank_points: -1 without_rank_points: name: MyString - director: + director: MyString description: MyString - rank_points: + rank_points: 0 diff --git a/test/models/album_test.rb b/test/models/album_test.rb index df16c60186..b932bdbc26 100644 --- a/test/models/album_test.rb +++ b/test/models/album_test.rb @@ -2,21 +2,31 @@ class AlbumTest < ActiveSupport::TestCase test "Album must have a name" do - assert_not albums("without_a_name").valid? + album = albums("without_a_name") + album.name = nil + + assert_not album.valid? end test "Album must have some sort of rank point value" do - assert_not albums("without_rank_points").valid? + album = albums("without_rank_points") + album.rank_points = nil + + assert_not album.valid? end - test "Album must have an artist" do - assert_not albums("without_an_artist").valid? + test "Album must have an author" do + album = albums("without_an_artist") + album.artist = nil + + assert_not album.valid? end test "Album can have negative points" do album = albums("correct_album") - album.rank_points -= 2 - assert_equal(-1, album.rank_points) + album.rank_points -= 100 + + assert_operator album.rank_points, :<, 0 assert album.valid? end diff --git a/test/models/book_test.rb b/test/models/book_test.rb index 496114e8b4..501da899db 100644 --- a/test/models/book_test.rb +++ b/test/models/book_test.rb @@ -2,21 +2,31 @@ class BookTest < ActiveSupport::TestCase test "Book must have a name" do - assert_not books("without_a_name").valid? + book = books("without_a_name") + book.name = nil + + assert_not book.valid? end test "Book must have some sort of rank point value" do - assert_not books("without_rank_points").valid? + book = books("without_rank_points") + book.rank_points = nil + + assert_not book.valid? end test "Book must have an author" do - assert_not books("without_an_author").valid? + book = books("without_an_author") + book.author = nil + + assert_not book.valid? end test "Book can have negative points" do book = books("correct_book") - book.rank_points -= 2 - assert_equal(-1, book.rank_points) + book.rank_points -= 100 + + assert_operator book.rank_points, :<, 0 assert book.valid? end end diff --git a/test/models/movie_test.rb b/test/models/movie_test.rb index 346c072566..d00af66fe9 100644 --- a/test/models/movie_test.rb +++ b/test/models/movie_test.rb @@ -2,21 +2,31 @@ class MovieTest < ActiveSupport::TestCase test "Movie must have a name" do - assert_not movies("without_a_name").valid? + movie = movies("without_a_name") + movie.name = nil + + assert_not movie.valid? end test "Movie must have some sort of rank point value" do - assert_not movies("without_rank_points").valid? + movie = movies("without_rank_points") + movie.rank_points = nil + + assert_not movie.valid? end - test "Movie must have a director" do - assert_not movies("without_a_director").valid? + test "Movie must have an director" do + movie = movies("without_a_director") + movie.director = nil + + assert_not movie.valid? end test "Movie can have negative points" do movie = movies("correct_movie") - movie.rank_points -= 2 - assert_equal(-1, movie.rank_points) + movie.rank_points -= 100 + + assert_operator movie.rank_points, :<, 0 assert movie.valid? end end From 8a429bbe6bbccbe239af1339f0c26677694daadf Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Sun, 16 Oct 2016 12:36:35 -0700 Subject: [PATCH 40/49] Continuing to add complexity to books_controller tests. --- app/controllers/albums_controller.rb | 6 +++- app/controllers/books_controller.rb | 6 +++- app/controllers/movies_controller.rb | 6 +++- test/controllers/books_controller_test.rb | 39 ++++++++++++++++------- 4 files changed, 43 insertions(+), 14 deletions(-) diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index 9c8f6a2310..a9cff25380 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -13,7 +13,11 @@ def new end def create - @album = Album.create!(album_params) + if album_params[:rank_points].nil? + @album = Album.create!(name: album_params[:name], author: album_params[:author], description: album_params[:description], rank_points: 1) + else + @album = Album.create!(album_params) + end redirect_to album_path(@album) end diff --git a/app/controllers/books_controller.rb b/app/controllers/books_controller.rb index 9ce01f049c..98260b674c 100644 --- a/app/controllers/books_controller.rb +++ b/app/controllers/books_controller.rb @@ -9,7 +9,11 @@ def index end def create - @book = Book.create!(book_params) + if book_params[:rank_points].nil? + @book = Book.create!(name: book_params[:name], author: book_params[:author], description: book_params[:description], rank_points: 1) + else + @book = Book.create!(book_params) + end redirect_to book_path(@book) end diff --git a/app/controllers/movies_controller.rb b/app/controllers/movies_controller.rb index 34eed486db..28227ac9be 100644 --- a/app/controllers/movies_controller.rb +++ b/app/controllers/movies_controller.rb @@ -9,7 +9,11 @@ def index end def create - @movie = Movie.create!(movie_params) + if movie_params[:rank_points].nil? + @movie = Movie.create!(name: movie_params[:name], author: movie_params[:author], description: movie_params[:description], rank_points: 1) + else + @movie = Movie.create!(movie_params) + end redirect_to movie_path(@movie) end diff --git a/test/controllers/books_controller_test.rb b/test/controllers/books_controller_test.rb index 802499af8d..84503e8b5f 100644 --- a/test/controllers/books_controller_test.rb +++ b/test/controllers/books_controller_test.rb @@ -54,36 +54,53 @@ class BooksControllerTest < ActionController::TestCase assert_redirected_to book_path(assigns(:book)) end + test "Create should assign an ID to a new record" do + post :create, book: { name: "lkjsdf", author: "sjkfsa", rank_points: 0 } + + assert_not_nil assigns(:book).id + end + + test "Create should automatically give a new book rank_points of 1" do + post :create, book: { name: "lkjsdf", author: "sjkfsa", rank_points: nil } + + assert_equal 1, assigns(:book).rank_points + end + ############### SHOW ############### - test "should show book" do - get :show, id: @book + test "Show should show book and template" do + get :show, id: @book.id assert_response :success + assert_template :show end ############### EDIT ############### - test "should get edit" do - get :edit, id: @book + test "Edit should get edit and template" do + get :edit, id: @book.id assert_response :success + assert_template :edit end ############### UPDATE ############### - test "should redirect to correct page" do - patch :update, id: @book, book: { name: "sdfsdfsd" } + test "Update should correctly update book name" do + patch :update, id: @book.id, book: { name: "hey" } + assert_equal "hey", assigns(:book).name assert_redirected_to book_path(assigns(:book)) end - test "should update book name" do - patch :update, id: @book, book: { name: "hey" } - assert_equal "hey", assigns(:book).name + test "Update should redirect to correct page" do + patch :update, id: @book.id, book: { name: "sdfsdfsd" } assert_redirected_to book_path(assigns(:book)) end ############### DESTROY ############### - test "should destroy book" do + test "Destroy should lower book count by one" do assert_difference('Book.count', -1) do - delete :destroy, id: @book + delete :destroy, id: @book.id end + end + test "Destroy should redirect to books index" do + delete :destroy, id: @book.id assert_redirected_to books_path end end From cf9f9c39785522caf0a149cae7648bb950094a35 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Sun, 16 Oct 2016 14:33:01 -0700 Subject: [PATCH 41/49] Moved save into vote.rb and out of model controller. Pasted all controller tests from book into other models and changed variable names as needed. --- app/controllers/albums_controller.rb | 2 +- app/controllers/books_controller.rb | 4 +- app/controllers/movies_controller.rb | 2 +- lib/vote.rb | 2 + test/controllers/albums_controller_test.rb | 111 ++++++++++++++++++-- test/controllers/books_controller_test.rb | 14 ++- test/controllers/movies_controller_test.rb | 116 ++++++++++++++++++++- 7 files changed, 235 insertions(+), 16 deletions(-) diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index a9cff25380..165d556807 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -14,7 +14,7 @@ def new def create if album_params[:rank_points].nil? - @album = Album.create!(name: album_params[:name], author: album_params[:author], description: album_params[:description], rank_points: 1) + @album = Album.create!(name: album_params[:name], artist: album_params[:artist], description: album_params[:description], rank_points: 1) else @album = Album.create!(album_params) end diff --git a/app/controllers/books_controller.rb b/app/controllers/books_controller.rb index 98260b674c..0c0b4aade8 100644 --- a/app/controllers/books_controller.rb +++ b/app/controllers/books_controller.rb @@ -50,9 +50,9 @@ def vote book = Book.find(params[:id]) if params[:vote] == "up" - add_vote(book).save + add_vote(book) elsif params[:vote] == "down" - subtract_vote(book).save + subtract_vote(book) else raise end diff --git a/app/controllers/movies_controller.rb b/app/controllers/movies_controller.rb index 28227ac9be..96eb47149b 100644 --- a/app/controllers/movies_controller.rb +++ b/app/controllers/movies_controller.rb @@ -10,7 +10,7 @@ def index def create if movie_params[:rank_points].nil? - @movie = Movie.create!(name: movie_params[:name], author: movie_params[:author], description: movie_params[:description], rank_points: 1) + @movie = Movie.create!(name: movie_params[:name], director: movie_params[:director], description: movie_params[:description], rank_points: 1) else @movie = Movie.create!(movie_params) end diff --git a/lib/vote.rb b/lib/vote.rb index 5bb4fca729..626fd59aa6 100644 --- a/lib/vote.rb +++ b/lib/vote.rb @@ -1,11 +1,13 @@ module Vote def subtract_vote(record) record.rank_points -= 1 + record.save return record end def add_vote(record) record.rank_points += 1 + record.save return record end diff --git a/test/controllers/albums_controller_test.rb b/test/controllers/albums_controller_test.rb index b0e7ead647..b7c5222f6c 100644 --- a/test/controllers/albums_controller_test.rb +++ b/test/controllers/albums_controller_test.rb @@ -1,23 +1,118 @@ require 'test_helper' class AlbumsControllerTest < ActionController::TestCase - ################## INDEX ################## + setup do + @album = albums(:correct_album) + end + ############### INDEX ############### + test "should get index" do + get :index + assert_response :success + assert_template :index + assert_not_nil assigns(:albums) + end - ################## CREATE ################## + test "Index should populate all the records of albums" do + get :index + assert_equal assigns(:albums).count, Album.count + end - ################## NEW ################## + test "Index should sort the albums by rank" do + get :index + albums = assigns(:albums) + assert_operator albums[0].rank_points, :>=, albums[-1].rank_points + end - ################## EDIT ################## + ############### NEW ############### + test "New should get new page" do + get :new + assert_response :success + assert_template :new + end - ################## SHOW ################## + test "New should create a new album but not save it yet" do + get :new + album = assigns(:album) + assert_not_nil album + assert_nil album.id + end - ################## UPDATE ################## + ############### CREATE ############### + test "Create should add 1 to all albums" do + assert_difference('Album.count', 1) do + post :create, album: { name: "lksjdf", artist: "sdfasdf", rank_points: 0 } + end + end - ################## DESTROY ################## + test "Create should redirect to created album page" do + post :create, album: { name: "lkjsdf", artist: "sjkfsa", rank_points: 0 } - ################## VOTE ################## + assert_response :found + assert_redirected_to album_path(assigns(:album)) + end + + test "Create should assign an ID to a new record" do + post :create, album: { name: "lkjsdf", artist: "sjkfsa", rank_points: 0 } + + assert_not_nil assigns(:album).id + end + + test "Create should automatically give a new album rank_points of 1" do + post :create, album: { name: "lkjsdf", artist: "sjkfsa", rank_points: nil } + + assert_equal 1, assigns(:album).rank_points + end + + ############### SHOW ############### + test "Show should show album and template" do + get :show, id: @album.id + assert_response :success + assert_template :show + end + + ############### EDIT ############### + test "Edit should get edit and template" do + get :edit, id: @album.id + assert_response :success + assert_template :edit + end + + ############### UPDATE ############### + test "Update should correctly update album name" do + patch :update, id: @album.id, album: { name: "hey" } + assert_equal "hey", assigns(:album).name + assert_redirected_to album_path(assigns(:album)) + end + + test "Update should redirect to correct page" do + patch :update, id: @album.id, album: { name: "sdfsdfsd" } + assert_redirected_to album_path(assigns(:album)) + end + + ############### DESTROY ############### + test "Destroy should lower album count by one" do + assert_difference('Album.count', -1) do + delete :destroy, id: @album.id + end + end + + test "Destroy should redirect to albums index" do + delete :destroy, id: @album.id + assert_redirected_to albums_path + end + + ############### VOTE ############### + test "Vote should change rank_points by 1 if upvote" do + patch :vote, id: @album.id, vote: "up" + assert_equal 11, Album.find(@album.id).rank_points + end + + test "Vote should change rank_points by -1 if downvote" do + patch :vote, id: @album.id, vote: "down" + assert_equal 9, Album.find(@album.id).rank_points + end end diff --git a/test/controllers/books_controller_test.rb b/test/controllers/books_controller_test.rb index 84503e8b5f..227831bc70 100644 --- a/test/controllers/books_controller_test.rb +++ b/test/controllers/books_controller_test.rb @@ -65,7 +65,7 @@ class BooksControllerTest < ActionController::TestCase assert_equal 1, assigns(:book).rank_points end - + ############### SHOW ############### test "Show should show book and template" do get :show, id: @book.id @@ -103,4 +103,16 @@ class BooksControllerTest < ActionController::TestCase delete :destroy, id: @book.id assert_redirected_to books_path end + + ############### VOTE ############### + test "Vote should change rank_points by 1 if upvote" do + patch :vote, id: @book.id, vote: "up" + assert_equal 20, Book.find(@book.id).rank_points + end + + test "Vote should change rank_points by -1 if downvote" do + patch :vote, id: @book.id, vote: "down" + assert_equal 18, Book.find(@book.id).rank_points + end + end diff --git a/test/controllers/movies_controller_test.rb b/test/controllers/movies_controller_test.rb index 094edd7237..8af6b3b89f 100644 --- a/test/controllers/movies_controller_test.rb +++ b/test/controllers/movies_controller_test.rb @@ -1,7 +1,117 @@ require 'test_helper' class MoviesControllerTest < ActionController::TestCase - # test "the truth" do - # assert true - # end + setup do + @movie = movies(:correct_movie) + end + + ############### INDEX ############### + test "should get index" do + get :index + assert_response :success + assert_template :index + assert_not_nil assigns(:movies) + end + + test "Index should populate all the records of movies" do + get :index + + assert_equal assigns(:movies).count, Movie.count + end + + test "Index should sort the movies by rank" do + get :index + movies = assigns(:movies) + + assert_operator movies[0].rank_points, :>=, movies[-1].rank_points + end + + ############### NEW ############### + test "New should get new page" do + get :new + assert_response :success + assert_template :new + end + + test "New should create a new movie but not save it yet" do + get :new + movie = assigns(:movie) + assert_not_nil movie + assert_nil movie.id + end + + ############### CREATE ############### + test "Create should add 1 to all movies" do + assert_difference('Movie.count', 1) do + post :create, movie: { name: "lksjdf", director: "sdfasdf", rank_points: 0 } + end + end + + test "Create should redirect to created movie page" do + post :create, movie: { name: "lkjsdf", director: "sjkfsa", rank_points: 0 } + + assert_response :found + assert_redirected_to movie_path(assigns(:movie)) + end + + test "Create should assign an ID to a new record" do + post :create, movie: { name: "lkjsdf", director: "sjkfsa", rank_points: 0 } + + assert_not_nil assigns(:movie).id + end + + test "Create should automatically give a new movie rank_points of 1" do + post :create, movie: { name: "lkjsdf", director: "sjkfsa", rank_points: nil } + + assert_equal 1, assigns(:movie).rank_points + end + + ############### SHOW ############### + test "Show should show movie and template" do + get :show, id: @movie.id + assert_response :success + assert_template :show + end + + ############### EDIT ############### + test "Edit should get edit and template" do + get :edit, id: @movie.id + assert_response :success + assert_template :edit + end + + ############### UPDATE ############### + test "Update should correctly update movie name" do + patch :update, id: @movie.id, movie: { name: "hey" } + assert_equal "hey", assigns(:movie).name + assert_redirected_to movie_path(assigns(:movie)) + end + + test "Update should redirect to correct page" do + patch :update, id: @movie.id, movie: { name: "sdfsdfsd" } + assert_redirected_to movie_path(assigns(:movie)) + end + + ############### DESTROY ############### + test "Destroy should lower movie count by one" do + assert_difference('Movie.count', -1) do + delete :destroy, id: @movie.id + end + end + + test "Destroy should redirect to movies index" do + delete :destroy, id: @movie.id + assert_redirected_to movies_path + end + + ############### VOTE ############### + test "Vote should change rank_points by 1 if upvote" do + patch :vote, id: @movie.id, vote: "up" + assert_equal 17, Movie.find(@movie.id).rank_points + end + + test "Vote should change rank_points by -1 if downvote" do + patch :vote, id: @movie.id, vote: "down" + assert_equal 15, Movie.find(@movie.id).rank_points + end end From f41aad5851cc060aba76f4f9fdb3441c410b93f6 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Sun, 16 Oct 2016 15:27:00 -0700 Subject: [PATCH 42/49] Added a few tests for the Vote By Rank mixin --- lib/sort_by_rank.rb | 25 ++++++++++++++++++------- test/sort_by_rank_test.rb | 37 +++++++++++++++++++++++++------------ 2 files changed, 43 insertions(+), 19 deletions(-) diff --git a/lib/sort_by_rank.rb b/lib/sort_by_rank.rb index 2586040cdf..25d8e387f4 100644 --- a/lib/sort_by_rank.rb +++ b/lib/sort_by_rank.rb @@ -1,14 +1,25 @@ module SortByRank - def sort_by_rank(array) - array.map do |record| - if record.rank_points.nil? - record.rank_points = 0 + def sort_by_rank(unsorted) + begin + unsorted.count + rescue NoMethodError + if unsorted.rank_points.nil? + unsorted.rank_points = 0 + return unsorted else - record + return unsorted end + else + unsorted.map do |record| + if record.rank_points.nil? + record.rank_points = 0 + else + record + end + end + + unsorted.sort_by { |record| record.rank_points }.reverse! end - - array.order(rank_points: :desc) end end diff --git a/test/sort_by_rank_test.rb b/test/sort_by_rank_test.rb index ef911ff02d..3109940fbc 100644 --- a/test/sort_by_rank_test.rb +++ b/test/sort_by_rank_test.rb @@ -3,16 +3,29 @@ include SortByRank class SortByRankTest < ActiveSupport::TestCase - # - # test "The first in the list should be greater than the last" do - # collect = [ - # Album.new(name:"Sdf", artist: "lskdjf", rank_points: 8), - # Book.new(name:"sat", author: "sdsdf", rank_points: 6), - # Movie.new(name: "k", director: "well", rank_points: 19) - # ] - # - # sort_by_rank(collect) - # - # assert_operator collect[1].rank_points, :>, collect[-1].rank_points - # end + setup do + @collection = [ + Movie.create(name: "movieone", director: "jeff", rank_points: 0), + Movie.create(name: "movietwo", director: "allison", rank_points: nil), + Movie.create(name: "moviethree", director: "personface", rank_points: 1) + ] + end + + test "The first in the list should be greater than or equal to the last" do + movies = sort_by_rank(@collection) + + assert_operator movies[0].rank_points, :>=, movies[-1].rank_points + end + + test "Sort By Rank should change nil rank points to 0" do + movie = Movie.create(name: "movietwo", director: "allison", rank_points: nil) + sort_by_rank(movie) + assert_equal 0, movie.rank_points + end + + test "Sort By Rank should work on a single record" do + assert_nothing_raised do + sort_by_rank(@collection[0]) + end + end end From d434641d26f0c49adee81597493bb16ed8018689 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Sun, 16 Oct 2016 16:50:07 -0700 Subject: [PATCH 43/49] Tried to figure out how to test vote.rb and got nowhere. --- test/sort_by_rank_test.rb | 2 +- test/vote_test.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/test/sort_by_rank_test.rb b/test/sort_by_rank_test.rb index 3109940fbc..c84b1ab1aa 100644 --- a/test/sort_by_rank_test.rb +++ b/test/sort_by_rank_test.rb @@ -18,7 +18,7 @@ class SortByRankTest < ActiveSupport::TestCase end test "Sort By Rank should change nil rank points to 0" do - movie = Movie.create(name: "movietwo", director: "allison", rank_points: nil) + movie = @collection[1] sort_by_rank(movie) assert_equal 0, movie.rank_points end diff --git a/test/vote_test.rb b/test/vote_test.rb index 671bc6eb9d..54f972c9e3 100644 --- a/test/vote_test.rb +++ b/test/vote_test.rb @@ -1,4 +1,18 @@ require 'test_helper' class VoteTest < ActiveSupport::TestCase + setup do + @movie = Movie.create(name: "movieone", director: "jeff", rank_points: 0) + end + + # test "Vote should change rank_points by 1 if upvote" do + # assert_difference(@movie.rank_points.to_s, 1) do + # add_vote(@movie) + # end + # end + + # test "Vote should change rank_points by -1 if downvote" do + # subtract_vote(@movie) + # assert_equal -1, Movie.find(@movie.id).rank_points + # end end From fdf6cc9171cea4d3d02ebb482008474dc97f1db8 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Sun, 16 Oct 2016 16:58:44 -0700 Subject: [PATCH 44/49] Figured out vote.rb test (i had to include and require vote.rb before actually testing it. Oops. --- test/vote_test.rb | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/test/vote_test.rb b/test/vote_test.rb index 54f972c9e3..fa337abb05 100644 --- a/test/vote_test.rb +++ b/test/vote_test.rb @@ -1,18 +1,21 @@ require 'test_helper' +require 'vote.rb' +include Vote class VoteTest < ActiveSupport::TestCase setup do @movie = Movie.create(name: "movieone", director: "jeff", rank_points: 0) end - # test "Vote should change rank_points by 1 if upvote" do - # assert_difference(@movie.rank_points.to_s, 1) do - # add_vote(@movie) - # end - # end + test "Vote should change rank_points by 1 if upvote" do + add_vote(@movie) - # test "Vote should change rank_points by -1 if downvote" do - # subtract_vote(@movie) - # assert_equal -1, Movie.find(@movie.id).rank_points - # end + assert_equal(1, Movie.find(@movie.id).rank_points) + end + + test "Vote should change rank_points by -1 if downvote" do + subtract_vote(@movie) + + assert_equal(-1, Movie.find(@movie.id).rank_points) + end end From 4b377dfc3968a7fd78a8b38975bfc3970fa465a8 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Sun, 16 Oct 2016 17:52:31 -0700 Subject: [PATCH 45/49] Moving tests for mixins elsewhere bc Dan told me to in Slack --- app/assets/stylesheets/application.css | 6 ++++++ app/views/albums/index.html.erb | 4 +++- app/views/books/index.html.erb | 4 +++- app/views/movies/index.html.erb | 4 +++- config/environments/production.rb | 2 +- test/{ => unit}/sort_by_rank_test.rb | 0 test/{ => unit}/vote_test.rb | 0 7 files changed, 16 insertions(+), 4 deletions(-) rename test/{ => unit}/sort_by_rank_test.rb (100%) rename test/{ => unit}/vote_test.rb (100%) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index cd95aa9678..f30a3c14f0 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -27,3 +27,9 @@ p, td { table h6 { text-align: center; } + + +.button { + border: solid black 1px; + border-radius: 1em; +} diff --git a/app/views/albums/index.html.erb b/app/views/albums/index.html.erb index 56dcbe017e..4770f26c9d 100644 --- a/app/views/albums/index.html.erb +++ b/app/views/albums/index.html.erb @@ -21,4 +21,6 @@ <% end %> -
<%= link_to "Head back home", root_path %>
+<%= link_to root_path do%> +
Go back home
+<% end %> diff --git a/app/views/books/index.html.erb b/app/views/books/index.html.erb index ee0874b20b..a5253d3461 100644 --- a/app/views/books/index.html.erb +++ b/app/views/books/index.html.erb @@ -21,4 +21,6 @@ <% end %> -
<%= link_to "Head back home", root_path %>
+<%= link_to root_path do%> +
Go back home
+<% end %> diff --git a/app/views/movies/index.html.erb b/app/views/movies/index.html.erb index 955b0ab69f..ded71d5b8d 100644 --- a/app/views/movies/index.html.erb +++ b/app/views/movies/index.html.erb @@ -21,4 +21,6 @@ <% end %> -
<%= link_to "Head back home", root_path %>
+<%= link_to root_path do%> +
Go back home
+<% end %> diff --git a/config/environments/production.rb b/config/environments/production.rb index 5c1b32e486..10a93ddf6a 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -29,7 +29,7 @@ # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. - config.assets.compile = false + config.assets.compile = true # Asset digests allow you to set far-future HTTP expiration dates on all assets, # yet still be able to expire them through the digest params. diff --git a/test/sort_by_rank_test.rb b/test/unit/sort_by_rank_test.rb similarity index 100% rename from test/sort_by_rank_test.rb rename to test/unit/sort_by_rank_test.rb diff --git a/test/vote_test.rb b/test/unit/vote_test.rb similarity index 100% rename from test/vote_test.rb rename to test/unit/vote_test.rb From bb9c0cb26b95f99bb16953bc48f3cdb7b88f94a9 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Sun, 16 Oct 2016 18:04:33 -0700 Subject: [PATCH 46/49] added buttons to form partial to go back either to model index or homepage --- app/assets/stylesheets/application.css | 1 - app/views/albums/_form.html.erb | 9 +++++++++ app/views/albums/show.html.erb | 10 ++++++++-- app/views/books/_form.html.erb | 9 +++++++++ app/views/books/show.html.erb | 10 ++++++++-- app/views/movies/_form.html.erb | 9 +++++++++ app/views/movies/show.html.erb | 10 ++++++++-- 7 files changed, 51 insertions(+), 7 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index f30a3c14f0..97ad50ea09 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -28,7 +28,6 @@ table h6 { text-align: center; } - .button { border: solid black 1px; border-radius: 1em; diff --git a/app/views/albums/_form.html.erb b/app/views/albums/_form.html.erb index 53f4fdf396..76e41baa85 100644 --- a/app/views/albums/_form.html.erb +++ b/app/views/albums/_form.html.erb @@ -30,3 +30,12 @@ <% end %> + +
+<%= link_to root_path do%> +
Go back home
+<% end %> +<%= link_to albums_path do%> +
Go back to all albums
+<% end %> +
diff --git a/app/views/albums/show.html.erb b/app/views/albums/show.html.erb index 2cc8d0832f..ccfd7acc98 100644 --- a/app/views/albums/show.html.erb +++ b/app/views/albums/show.html.erb @@ -19,5 +19,11 @@ -
<%= link_to "Head back to all albums", albums_path %>
-
<%= link_to "Head back home", root_path %>
+
+<%= link_to root_path do%> +
Go back home
+<% end %> +<%= link_to albums_path do%> +
Go back to all albums
+<% end %> +
diff --git a/app/views/books/_form.html.erb b/app/views/books/_form.html.erb index 6461da9e12..eca8ee731c 100644 --- a/app/views/books/_form.html.erb +++ b/app/views/books/_form.html.erb @@ -30,3 +30,12 @@ <% end %> + +
+<%= link_to root_path do%> +
Go back home
+<% end %> +<%= link_to books_path do%> +
Go back to all books
+<% end %> +
diff --git a/app/views/books/show.html.erb b/app/views/books/show.html.erb index 7d29b00054..667b355967 100644 --- a/app/views/books/show.html.erb +++ b/app/views/books/show.html.erb @@ -19,5 +19,11 @@ -
<%= link_to "Head back to all books", books_path %>
-
<%= link_to "Head back home", root_path %>
+
+<%= link_to root_path do%> +
Go back home
+<% end %> +<%= link_to books_path do%> +
Go back to all books
+<% end %> +
diff --git a/app/views/movies/_form.html.erb b/app/views/movies/_form.html.erb index 46e9abbeef..616f1f985e 100644 --- a/app/views/movies/_form.html.erb +++ b/app/views/movies/_form.html.erb @@ -30,3 +30,12 @@ <% end %> + +
+<%= link_to root_path do%> +
Go back home
+<% end %> +<%= link_to movies_path do%> +
Go back to all movies
+<% end %> +
diff --git a/app/views/movies/show.html.erb b/app/views/movies/show.html.erb index 9d39fc070a..4cceb895b6 100644 --- a/app/views/movies/show.html.erb +++ b/app/views/movies/show.html.erb @@ -19,5 +19,11 @@ -
<%= link_to "Head back to all movies", movies_path %>
-
<%= link_to "Head back home", root_path %>
+
+<%= link_to root_path do%> +
Go back home
+<% end %> +<%= link_to movies_path do%> +
Go back to all movies
+<% end %> +
From 9ec6fa00eeec37de26dafecb427e04e8ac60c7f8 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Sun, 16 Oct 2016 18:11:31 -0700 Subject: [PATCH 47/49] Changed some colors to show I didn't just completely let foundation carry me with the whole CSS thing. --- app/assets/stylesheets/application.css | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 97ad50ea09..47c0014f3e 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -28,7 +28,18 @@ table h6 { text-align: center; } +table tr:nth-last-of-type(odd) { + background-color: #cde6f1; +} +table tr:nth-last-of-type(even) { + background-color: #e1eaed; +} + .button { border: solid black 1px; border-radius: 1em; } + +body { + background-color: #b1e6fc; +} From 85781c372f7029efab8205fc4ac80c8b2b2209d4 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Sun, 16 Oct 2016 18:22:12 -0700 Subject: [PATCH 48/49] Making the submit button one partial form look less awkward --- app/assets/stylesheets/application.css | 10 ++++++++++ app/views/albums/_form.html.erb | 2 +- app/views/books/_form.html.erb | 2 +- app/views/movies/_form.html.erb | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 47c0014f3e..6ef0dcc88a 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -40,6 +40,16 @@ table tr:nth-last-of-type(even) { border-radius: 1em; } +table * { + border-color: #b1e6fc; +} +.form-div { + background-color: #b1e6fc; +} +#submit { + background-color: #b1e6fc; +} + body { background-color: #b1e6fc; } diff --git a/app/views/albums/_form.html.erb b/app/views/albums/_form.html.erb index 76e41baa85..48701d58f9 100644 --- a/app/views/albums/_form.html.erb +++ b/app/views/albums/_form.html.erb @@ -25,7 +25,7 @@ <%= f.hidden_field :rank_points, value: 1 %> - + <%= f.submit "Submit Album Info" %> diff --git a/app/views/books/_form.html.erb b/app/views/books/_form.html.erb index eca8ee731c..482849dc27 100644 --- a/app/views/books/_form.html.erb +++ b/app/views/books/_form.html.erb @@ -25,7 +25,7 @@ <%= f.hidden_field :rank_points, value: 1 %> - + <%= f.submit "Submit Book Info" %> diff --git a/app/views/movies/_form.html.erb b/app/views/movies/_form.html.erb index 616f1f985e..31b408bf6f 100644 --- a/app/views/movies/_form.html.erb +++ b/app/views/movies/_form.html.erb @@ -25,7 +25,7 @@ <%= f.hidden_field :rank_points, value: 1 %> - + <%= f.submit "Submit Movie Info" %> From 5593bd0b72951df5ef28cefbcac7ecd4e9be4675 Mon Sep 17 00:00:00 2001 From: Nicole Url Date: Sun, 16 Oct 2016 19:54:13 -0700 Subject: [PATCH 49/49] Doing all the gem nonsense for Heroku deployment --- Gemfile | 7 ++++++- Gemfile.lock | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 3bd9fb44a0..53f035e153 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,6 @@ source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.7' # Use sqlite3 as the database for Active Record -gem 'sqlite3' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets @@ -33,6 +32,7 @@ gem 'sdoc', '~> 0.4.0', group: :doc group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console + gem 'sqlite3' gem 'byebug' end @@ -47,3 +47,8 @@ end group :test do gem 'minitest-reporters' end + +group :production do + gem 'pg' + gem 'rails_12factor' +end diff --git a/Gemfile.lock b/Gemfile.lock index 8605f91ef5..0126ca7181 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -86,6 +86,7 @@ GEM multi_json (1.12.1) nokogiri (1.6.8.1) mini_portile2 (~> 2.1.0) + pg (0.19.0) rack (1.6.4) rack-test (0.6.3) rack (>= 1.0) @@ -108,6 +109,11 @@ GEM rails-deprecated_sanitizer (>= 1.0.1) rails-html-sanitizer (1.0.3) loofah (~> 2.0) + rails_12factor (0.0.3) + rails_serve_static_assets + rails_stdout_logging + rails_serve_static_assets (0.0.5) + rails_stdout_logging (0.0.5) railties (4.2.7) actionpack (= 4.2.7) activesupport (= 4.2.7) @@ -163,7 +169,9 @@ DEPENDENCIES jbuilder (~> 2.0) jquery-rails minitest-reporters + pg rails (= 4.2.7) + rails_12factor sass-rails (~> 5.0) sdoc (~> 0.4.0) spring