Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
b0cea2f
root index with clickable header
jennaplusplus Nov 30, 2015
1596145
generated model and controller for Movies
jennaplusplus Nov 30, 2015
b4c155f
index and new actions/view for Movies
jennaplusplus Nov 30, 2015
7ca3235
show action/view for Movies
jennaplusplus Nov 30, 2015
5d9053a
update functionality for Movies
jennaplusplus Nov 30, 2015
eb42bc9
DRY code for Movies forms
jennaplusplus Nov 30, 2015
41c1d37
delete functionality for Movies
jennaplusplus Nov 30, 2015
2662367
validations on create/update Movie
jennaplusplus Nov 30, 2015
5b050ae
migration to add votes column to movies
jennaplusplus Nov 30, 2015
715fff0
upvote functionality from movies index
jennaplusplus Nov 30, 2015
f9a6ca6
upvote functionality with page refresh
jennaplusplus Nov 30, 2015
f137452
updated root index with list of top movies
jennaplusplus Nov 30, 2015
87caba5
links to sort asc/desc in movies index
jennaplusplus Nov 30, 2015
6381310
model and controller for books
jennaplusplus Nov 30, 2015
f66c40f
recycled movies controller for books and made books index
jennaplusplus Nov 30, 2015
ef9f118
completed set of actions/views for Book
jennaplusplus Nov 30, 2015
bcde828
model and controller for albums
jennaplusplus Nov 30, 2015
3980625
replaced movies index with layout and partial
jennaplusplus Dec 1, 2015
b326549
replaced books index with partial
jennaplusplus Dec 1, 2015
602bf0f
partial for all index views
jennaplusplus Dec 1, 2015
1f2fefb
more complete partials for index views
jennaplusplus Dec 1, 2015
e8cde39
added rspec with empty spec files
jennaplusplus Dec 1, 2015
30dafa1
filled in spec files with stubs
jennaplusplus Dec 1, 2015
c1bc64e
tests passing for model validations
jennaplusplus Dec 1, 2015
a78e7bb
controller tests for index actions
jennaplusplus Dec 1, 2015
0885153
additional validation and test for Album title length
jennaplusplus Dec 1, 2015
a3c5bd1
partial for book show view
jennaplusplus Dec 1, 2015
e000ba1
Update README.md
kariabancroft Dec 1, 2015
94c5133
filled out Album views using partials
jennaplusplus Dec 1, 2015
c1e5e99
finished testing for additional validations
jennaplusplus Dec 1, 2015
1ac965a
passed test for new methods
jennaplusplus Dec 1, 2015
ac70644
all tests for album model and controller
jennaplusplus Dec 2, 2015
1e1c059
all controller tests for books
jennaplusplus Dec 2, 2015
a02bfa6
all controller tests for movies
jennaplusplus Dec 2, 2015
909782e
added top books and albums to front page
jennaplusplus Dec 2, 2015
8fcd8ff
Merge remote-tracking branch 'upstream/master' into jmn/master
jennaplusplus Dec 2, 2015
c70c4f2
added simplecov gem
jennaplusplus Dec 2, 2015
84f69ac
test for welcome controller index
jennaplusplus Dec 2, 2015
212f8be
styled front page with bootstrap
jennaplusplus Dec 2, 2015
42815e9
fixed votes grammar on front page
jennaplusplus Dec 2, 2015
e1ddac7
bootstrap styling on show view
jennaplusplus Dec 2, 2015
e2987d6
bootstrap for index view
jennaplusplus Dec 2, 2015
c98e02c
one shared example in spec
jennaplusplus Dec 3, 2015
29c4b35
shared examples for Movie model
jennaplusplus Dec 3, 2015
94bfae3
shared examples for Album model
jennaplusplus Dec 3, 2015
261b85b
shared examples for Book model
jennaplusplus Dec 3, 2015
f126c63
shared examples for index methods for controllers
jennaplusplus Dec 3, 2015
40e3365
some shared examples working
jennaplusplus Dec 3, 2015
d96bf7c
styled forms with bootstrap
jennaplusplus Dec 3, 2015
fa5f792
shared examples for all tests in controllers
jennaplusplus Dec 3, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--color
--require spec_helper
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ source 'https://rubygems.org'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# boostrap
gem 'bootstrap-sass', '~> 3.3.6'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
Expand Down Expand Up @@ -36,6 +38,8 @@ group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'better_errors'
gem 'rspec-rails'
gem 'simplecov'
end

group :development do
Expand Down
33 changes: 33 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,18 @@ GEM
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
arel (6.0.3)
autoprefixer-rails (6.1.2)
execjs
json
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)
bootstrap-sass (3.3.6)
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
builder (3.2.2)
byebug (8.2.1)
coderay (1.1.0)
Expand All @@ -54,6 +60,8 @@ GEM
execjs
coffee-script-source (1.10.0)
debug_inspector (0.0.2)
diff-lcs (1.2.5)
docile (1.1.5)
erubis (2.7.0)
execjs (2.6.0)
globalid (0.3.6)
Expand Down Expand Up @@ -106,6 +114,23 @@ GEM
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
rdoc (4.2.0)
rspec-core (3.4.1)
rspec-support (~> 3.4.0)
rspec-expectations (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-mocks (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-rails (3.4.0)
actionpack (>= 3.0, < 4.3)
activesupport (>= 3.0, < 4.3)
railties (>= 3.0, < 4.3)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
rspec-support (~> 3.4.0)
rspec-support (3.4.1)
sass (3.4.19)
sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0)
Expand All @@ -116,6 +141,11 @@ GEM
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
simplecov (0.11.0)
docile (~> 1.1.0)
json (~> 1.8)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
spring (1.5.0)
sprockets (3.4.1)
rack (> 1, < 3)
Expand Down Expand Up @@ -145,13 +175,16 @@ PLATFORMS

DEPENDENCIES
better_errors
bootstrap-sass (~> 3.3.6)
byebug
coffee-rails (~> 4.1.0)
jbuilder (~> 2.0)
jquery-rails
rails (= 4.2.5)
rspec-rails
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
simplecov
spring
sqlite3
turbolinks
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Each data model needs to have standard RESTful (index, show, edit, update, new,

#### Wave 2

Testing will come in Wave 2!
Your rails application must have 90% code coverage across models and controllers. Use TDD practices to develop new functionality, and add tests for functionality that has already been added in Wave 1.

#### Wave 3

Expand Down
Binary file added app/assets/images/black-cat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/header-owl.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/assets/javascripts/albums.coffee
Original file line number Diff line number Diff line change
@@ -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/
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// about supported directives.
//
//= require jquery
//= require bootstrap-sprockets
//= require jquery_ujs
//= require turbolinks
//= require_tree .
3 changes: 3 additions & 0 deletions app/assets/javascripts/books.coffee
Original file line number Diff line number Diff line change
@@ -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/
3 changes: 3 additions & 0 deletions app/assets/javascripts/movies.coffee
Original file line number Diff line number Diff line change
@@ -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/
3 changes: 3 additions & 0 deletions app/assets/javascripts/welcome.coffee
Original file line number Diff line number Diff line change
@@ -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/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/albums.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the albums controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_tree .
*= require_self
*/

@import "bootstrap-sprockets";
@import "bootstrap";

.page-header {
background: url(header-owl.jpg);
background-repeat: no-repeat;
}

.page-header h1 {
margin-left: 150px;
}

a {
color: #428bca;
}

form .btn-primary {
margin-bottom: 10px;
}
3 changes: 3 additions & 0 deletions app/assets/stylesheets/books.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the books controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/movies.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the movies controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/welcome.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the welcome controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
62 changes: 62 additions & 0 deletions app/controllers/albums_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
class AlbumsController < ApplicationController
def index
albums = Album.all

@media = albums.order(votes: :desc)
end

def new
@album = Album.new
end

def create
@album = Album.new(album_params[:album])

if @album.save
redirect_to album_path(@album)
else
render :new
end
end

def show
@art = Album.find(params[:id])
@art_attribute = @art.artist
end

def edit
@album = Album.find(params[:id])
end

def update
@album = Album.find(params[:id])
@album.attributes = album_params[:album]

if @album.save
redirect_to album_path(@album)
else
render :edit
end
end

def destroy
album = Album.find(params[:id])
album.destroy

redirect_to albums_path
end

def upvote
album = Album.find(params[:id])
album.increment!(:votes)

redirect_to :back
end


private

def album_params
params.permit(album:[:title, :artist, :description])
end
end
62 changes: 62 additions & 0 deletions app/controllers/books_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
class BooksController < ApplicationController
def index
books = Book.all

@media = books.order(votes: :desc)
end

def new
@book = Book.new
end

def create
@book = Book.new(book_params[:book])

if @book.save
redirect_to book_path(@book)
else
render :new
end
end

def show
@art = Book.find(params[:id])
@art_attribute = @art.author
end

def edit
@book = Book.find(params[:id])
end

def update
@book = Book.find(params[:id])
@book.attributes = book_params[:book]

if @book.save
redirect_to book_path(@book)
else
render :edit
end
end

def destroy
book = Book.find(params[:id])
book.destroy

redirect_to books_path
end

def upvote
book = Book.find(params[:id])
book.increment!(:votes)

redirect_to :back
end


private

def book_params
params.permit(book:[:title, :author, :description])
end
end
63 changes: 63 additions & 0 deletions app/controllers/movies_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
class MoviesController < ApplicationController
def index
movies = Movie.all

@media = movies.order(votes: :desc)
end

def new
@movie = Movie.new
end

def create
@movie = Movie.new(movie_params[:movie])

if @movie.save
redirect_to movie_path(@movie)
else
render :new
end
end

def show
@art = Movie.find(params[:id])
@art_attribute = @art.director
end

def edit
@movie = Movie.find(params[:id])
end

def update
@movie = Movie.find(params[:id])
@movie.attributes = movie_params[:movie]

if @movie.save
redirect_to movie_path(@movie)
else
render :edit
end
end

def destroy
movie = Movie.find(params[:id])
movie.destroy

redirect_to movies_path
end

def upvote
movie = Movie.find(params[:id])
movie.increment!(:votes)

redirect_to :back
end


private

def movie_params
params.permit(movie:[:title, :director, :description])
end

end
12 changes: 12 additions & 0 deletions app/controllers/welcome_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class WelcomeController < ApplicationController
def index
movies = Movie.all
@movies = movies.order(votes: :desc).first(10)

books = Book.all
@books = books.order(votes: :desc).first(10)

albums = Album.all
@albums = albums.order(votes: :desc).first(10)
end
end
2 changes: 2 additions & 0 deletions app/helpers/albums_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module AlbumsHelper
end
2 changes: 2 additions & 0 deletions app/helpers/books_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module BooksHelper
end
2 changes: 2 additions & 0 deletions app/helpers/movies_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module MoviesHelper
end
2 changes: 2 additions & 0 deletions app/helpers/welcome_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module WelcomeHelper
end
Loading