-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MediaRanker #43
base: arh/master
Are you sure you want to change the base?
MediaRanker #43
Changes from all commits
df58496
23bfb5e
4ef8d4f
227b4dd
884b878
e88a3a0
e258c32
0ef7ba2
8f7b043
df96949
6a4c3f9
f38f9d1
208dfc3
bde207a
544a6ed
75205a2
0a5ee90
b2145f4
ce3fc96
253d43d
a706cfb
c395b5e
ed1dde3
fd88520
3b74f6b
17412c2
010f4dd
55de772
4d55c60
4418583
df893fa
37084c1
35ae7ad
2a74db8
f4840c2
748b7d5
7e21c71
17095b6
357a8c9
354a602
96c3d0d
86e8f97
b9e0dda
c933b07
b8d793d
f75ef3d
1a6d9b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
/db/*.sqlite3-journal | ||
|
||
# Ignore all logfiles and tempfiles. | ||
/coverage | ||
/log/* | ||
!/log/.keep | ||
/tmp |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--color | ||
--require spec_helper |
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/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ | |
//= require jquery_ujs | ||
//= require turbolinks | ||
//= require_tree . | ||
//= require bootstrap-sprockets |
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/ |
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/ |
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/ |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* This is a manifest file that'll be compiled into application.css, which will include all the files | ||
* listed below. | ||
* | ||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, | ||
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. | ||
* | ||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the | ||
* compiled file so the styles you add here take precedence over styles defined in any styles | ||
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new | ||
* file per style scope. | ||
* | ||
|
||
*/ | ||
@import "bootstrap-sprockets"; | ||
@import "bootstrap"; | ||
|
||
.page-header { | ||
background: url(http://media-ranker.herokuapp.com/assets/owl-5e51d9e0d49c787f2ebd143e32cbf41c.jpg); | ||
background-repeat: no-repeat; | ||
} | ||
|
||
.page-header h1 { | ||
margin-left: 150px; | ||
} | ||
|
||
a { | ||
color: #428bca; | ||
text-decoration: none; | ||
} | ||
|
||
form .btn-primary { | ||
margin-bottom: 10px; | ||
} | ||
|
||
.btn-default { | ||
color: #333; | ||
background-color: #fff; | ||
border-color: #ccc; | ||
} | ||
|
||
.btn-danger { | ||
color: #fff; | ||
background-color: #d9534f; | ||
border-color: #d43f3a; | ||
} | ||
|
||
.row { | ||
margin-right: -15px; | ||
margin-left: -15px; | ||
} | ||
|
||
h1 small, .h1 small, h2 small, .h2 small, h3 small, .h3 small, h1 .small, .h1 .small, h2 .small, .h2 .small, h3 .small, .h3 .small { | ||
font-size: 65%; | ||
} | ||
|
||
h1 small, h2 small, h3 small, h4 small, h5 small, h6 small, .h1 small, .h2 small, .h3 small, .h4 small, .h5 small, .h6 small, h1 .small, h2 .small, h3 .small, h4 .small, h5 .small, h6 .small, .h1 .small, .h2 .small, .h3 .small, .h4 .small, .h5 .small, .h6 .small { | ||
font-weight: 400; | ||
line-height: 1; | ||
color: #777; | ||
} | ||
|
||
h4, .h4 { | ||
font-size: 18px; | ||
} | ||
|
||
h4, .h4, h5, .h5, h6, .h6 { | ||
margin-top: 10px; | ||
margin-bottom: 10px; | ||
} | ||
|
||
element.style { | ||
margin: 0; | ||
padding: 0; | ||
display: inline; | ||
} | ||
|
||
body { | ||
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; | ||
font-size: 14px; | ||
line-height: 1.42857143; | ||
color: #333; | ||
background-color: #fff; | ||
} |
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/ |
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/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
class AlbumsController < ApplicationController | ||
before_action :get_album, only: [:edit, :update, :destroy] | ||
def get_album | ||
@album = Album.find(params[:id]) | ||
end | ||
|
||
def index | ||
@albums = Album.all | ||
end | ||
|
||
def new | ||
@url = "create" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have this included in the books and movies controllers as well but it doesn't appear that it is being used anywhere. |
||
@legend = "New Album" | ||
@album = Album.new | ||
end | ||
|
||
def create | ||
@album = Album.create(album_params[:album]) | ||
if @album.save | ||
redirect_to albums_path | ||
else | ||
render :new | ||
end | ||
end | ||
|
||
def show | ||
@album = Album.find(params[:id]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You made that handy dandy get_album before method but are re-writing that code here. Also you could add upvote and edit to your before action as those are also using |
||
end | ||
|
||
def edit | ||
@album = Album.find(params[:id]) | ||
@legend = "Edit Album" | ||
end | ||
|
||
def update | ||
@album = Album.update(params[:id], album_params[:album]) | ||
if @album.save | ||
redirect_to album_path(params[:id]) | ||
else | ||
render :edit | ||
end | ||
end | ||
|
||
def destroy | ||
Album.destroy(params[:id]) | ||
redirect_to albums_path | ||
end | ||
|
||
def upvote | ||
@album = Album.find(params[:id]) | ||
@album.rank += 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This works beautifully and is generally my go to as it works across many different programming languages. Another way to accomplish the same thing in Ruby is the method increment. Yay options! |
||
@album.save | ||
render :show | ||
end | ||
|
||
private | ||
|
||
def album_params | ||
params.permit(album: [:name, :artist, :description, :rank]) | ||
end | ||
|
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
class BooksController < ApplicationController | ||
|
||
def index | ||
@books = Book.all | ||
end | ||
|
||
def new | ||
@url = "create" | ||
@book = Book.new | ||
end | ||
|
||
def create | ||
@book = Book.create(book_params[:book]) | ||
if @book.save | ||
redirect_to books_path | ||
else | ||
render :new | ||
end | ||
end | ||
|
||
def show | ||
@book = Book.find(params[:id]) | ||
end | ||
|
||
def edit | ||
@book = Book.find(params[:id]) | ||
@legend = "Edit Book" | ||
end | ||
|
||
def update | ||
@book = Book.update(params[:id], book_params[:book]) | ||
if @book.save | ||
redirect_to book_path(params[:id]) | ||
else | ||
render :edit | ||
end | ||
end | ||
|
||
def destroy | ||
Book.destroy(params[:id]) | ||
redirect_to books_path | ||
end | ||
|
||
def upvote | ||
@book = Book.find(params[:id]) | ||
@book.rank += 1 | ||
@book.save | ||
render :show | ||
end | ||
|
||
private | ||
|
||
def book_params | ||
params.permit(book: [:name, :author, :description, :rank]) | ||
end | ||
|
||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Including only the gems you need, awesome! 👍 This is a good habit to have as the more dependencies you include the higher the change that your build will fail when deploying. I used to have the bad habit of copy pasta-ing gems from previous projects and it bit me at least once.