Skip to content
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

Pull Request for Tunes and Takeout #2

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
246dab6
Gems and ignoring secrets.yml
jadevance May 16, 2016
b0cfb01
testing out to make sure secrets.yml is for reals not getting pushed …
jadevance May 16, 2016
13756ce
Delete secrets.yml
jadevance May 16, 2016
1aba372
doof
jadevance May 16, 2016
ebf8711
Too many secrets
jadevance May 16, 2016
195e550
Working with Charles, yay
jadevance May 16, 2016
428f25d
modified gitignore file
jadevance May 16, 2016
99a8511
Completed the env and oauth pieces
jadevance May 17, 2016
90354a8
Generated models and made a root route for the site.
jadevance May 17, 2016
0ce7b87
new gems, fixed issues with oauth
jadevance May 18, 2016
0aae5b0
added controllers and login functionality
jadevance May 18, 2016
56d8b34
added music and user models
jadevance May 18, 2016
6493aac
added tunes and takeout wrapper to lib
jadevance May 18, 2016
3c09ccd
added views to application
jadevance May 18, 2016
6be7bde
added configuration for omniauth as well as routing to log into spotify
jadevance May 18, 2016
e177022
migrations to modify the user schema
jadevance May 18, 2016
89eb499
Figured out how to get lib to be 'seen' by app by altering the config…
jadevance May 19, 2016
0fafced
added a home controller to keep routing straight between suggestions …
jadevance May 19, 2016
d023a94
Spotify and Yelp api calls now work through the tunes takeout api.
jadevance May 19, 2016
f772556
added a partial to suggestions. Need to remove extra testing views (r…
jadevance May 19, 2016
425bb1f
clarified code in the models, finished writing the food model to quer…
jadevance May 19, 2016
abec55f
limited search to 10 results, modified the file name so rails would s…
jadevance May 19, 2016
d007670
re-organized views to accomidate favorting suggestions
jadevance May 19, 2016
4335e57
Generated a migration to add in user images from spotify when logged in
jadevance May 19, 2016
577717c
added css and the spotify icon to application.html.erb
jadevance May 19, 2016
3892e60
images from spotify work now, yaaaaaaaaay
jadevance May 19, 2016
8c46756
Cleaned up and standardized views
jadevance May 20, 2016
30c7007
Music and Food are now paired together, yaaaay
jadevance May 20, 2016
e8fc2c2
extracting tunes and takeout ids from suggestions, not doing anything…
jadevance May 20, 2016
26b1242
favorites work, yay
jadevance May 20, 2016
46a682d
Added some CSS to handle standardizing image size. Also added font aw…
jadevance May 20, 2016
2a7d69a
Implemented top favorites list as well as retrieving a list user favo…
jadevance May 20, 2016
eb65c26
Played with javascript amd made a favorite heart that toggles between…
jadevance May 21, 2016
9da1348
Favoriting and unfavorting work, but routing is a mess.
jadevance May 22, 2016
5faee2b
styling
jadevance May 22, 2016
36cb8b9
removed zip function, went back to an old school method of adding arr…
jadevance May 22, 2016
e999ff4
cleaned up formatting, working on routing
jadevance May 22, 2016
010fb8b
favoriting and routing now works, working on unfavoriting now
jadevance May 22, 2016
4b7c996
unfavorting now works along with routing correctly
jadevance May 22, 2016
3f3335f
bundling up testing gems
jadevance May 22, 2016
89604fa
Tunes and Takeout testing done, 100% coverage
jadevance May 22, 2016
9e40e14
cleaning up the tests, making sure they are readable
jadevance May 22, 2016
aa4c7ae
wrestled with postgres migrations and finding the correct syntax to n…
jadevance May 23, 2016
dbc8b0d
user testing done. vcr cassettes saved for both user testing and tune…
jadevance May 23, 2016
a84a3f2
refactoring and cleanup
jadevance May 23, 2016
7f3828d
refactoring and cleanup
jadevance May 23, 2016
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
# Ignore bundler config.
/.bundle




# Ignore all logfiles and tempfiles.
/log/*
!/log/.keep
Expand All @@ -26,7 +29,7 @@
/tmp/

# Used by dotenv library to load environment variables.
# .env
.env

## Specific to RubyMotion:
.dat*
Expand Down
30 changes: 18 additions & 12 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ ruby '2.3.1'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.15'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'pg', '~> 0.15'
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'rspotify'
gem 'yelp'
gem 'httparty'
gem 'omniauth-oauth2', '~> 1.3.1'

# Use jquery as the JavaScript library
gem 'jquery-rails'
Expand All @@ -21,25 +22,30 @@ gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'turbolinks'

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'pry-rails'
gem 'dotenv-rails'
gem 'simplecov'
gem 'minitest-vcr'
gem 'minitest-reporters'
gem 'webmock'
end

group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
gem "better_errors"
gem "binding_of_caller"

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'

group :production do
gem 'rails_12factor'
end
end

106 changes: 105 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,18 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.4.0)
ansi (1.5.0)
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 (8.2.5)
coderay (1.1.1)
coffee-rails (4.1.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.1.x)
Expand All @@ -49,11 +56,27 @@ GEM
execjs
coffee-script-source (1.10.0)
concurrent-ruby (1.0.2)
crack (0.4.3)
safe_yaml (~> 1.0.0)
debug_inspector (0.0.2)
docile (1.1.5)
dotenv (2.1.1)
dotenv-rails (2.1.1)
dotenv (= 2.1.1)
railties (>= 4.0, < 5.1)
erubis (2.7.0)
execjs (2.6.0)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
faraday_middleware (0.10.0)
faraday (>= 0.7.4, < 0.10)
globalid (0.3.6)
activesupport (>= 4.1.0)
hashdiff (0.3.0)
hashie (3.4.4)
httparty (0.13.7)
json (~> 1.8)
multi_xml (>= 0.5.2)
i18n (0.7.0)
jbuilder (2.4.1)
activesupport (>= 3.0.0, < 5.1)
Expand All @@ -63,19 +86,53 @@ GEM
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
jwt (1.5.1)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.4)
mime-types (>= 1.16, < 4)
method_source (0.8.2)
mime-types (3.0)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0221)
mini_portile2 (2.0.0)
minispec-metadata (2.0.0)
minitest
minitest (5.8.4)
minitest-reporters (1.1.9)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
minitest-vcr (1.4.0)
minispec-metadata (~> 2.0)
minitest (>= 4.7.5)
vcr (>= 2.9)
multi_json (1.12.0)
multi_xml (0.5.5)
multipart-post (2.0.0)
netrc (0.7.9)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
oauth2 (1.1.0)
faraday (>= 0.8, < 0.10)
jwt (~> 1.0, < 1.5.2)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
omniauth (1.3.1)
hashie (>= 1.2, < 4)
rack (>= 1.0, < 3)
omniauth-oauth2 (1.3.1)
oauth2 (~> 1.0)
omniauth (~> 1.2)
pg (0.18.4)
pry (0.10.3)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-rails (0.3.4)
pry (>= 0.9.10)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
Expand All @@ -98,6 +155,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.6)
actionpack (= 4.2.6)
activesupport (= 4.2.6)
Expand All @@ -106,6 +168,13 @@ GEM
rake (11.1.2)
rdoc (4.2.2)
json (~> 1.4)
rest_client (1.8.3)
netrc (~> 0.7.7)
rspotify (1.10.0)
omniauth-oauth2 (~> 1.1)
rest_client (~> 1.8)
ruby-progressbar (1.8.1)
safe_yaml (1.0.4)
sass (3.4.22)
sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0)
Expand All @@ -116,6 +185,13 @@ GEM
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
simple_oauth (0.3.1)
simplecov (0.11.2)
docile (~> 1.1.0)
json (~> 1.8)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
slop (3.6.0)
spring (1.7.1)
sprockets (3.6.0)
concurrent-ruby (~> 1.0)
Expand All @@ -127,31 +203,59 @@ GEM
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.2)
turbolinks (2.5.3)
coffee-rails
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (3.0.0)
execjs (>= 0.3.0, < 3)
vcr (3.0.3)
web-console (2.3.0)
activemodel (>= 4.0)
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
webmock (2.0.3)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
yelp (2.1.2)
faraday (~> 0.8, >= 0.8.0)
faraday_middleware (~> 0.8, >= 0.8.0)
simple_oauth (~> 0.3.1)

PLATFORMS
ruby

DEPENDENCIES
better_errors
binding_of_caller
byebug
coffee-rails (~> 4.1.0)
dotenv-rails
httparty
jbuilder (~> 2.0)
jquery-rails
minitest-reporters
minitest-vcr
omniauth-oauth2 (~> 1.3.1)
pg (~> 0.15)
pry-rails
rails (= 4.2.6)
rails_12factor
rspotify
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
simplecov
spring
turbolinks
uglifier (>= 1.3.0)
web-console (~> 2.0)
webmock
yelp

RUBY VERSION
ruby 2.3.1p112

BUNDLED WITH
1.12.3
1.12.4
Binary file added app/assets/images/Spotify_Icon_RGB_Green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@
//= require jquery
//= require jquery_ujs
//= require_tree .
$(function() {
$('a').click(function() {
$(this).find('i').toggleClass('fa fa-heart-o fa fa-heart');
});
});
3 changes: 3 additions & 0 deletions app/assets/javascripts/home.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/sessions.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/suggestions.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/users.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/
41 changes: 26 additions & 15 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
/*
* 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.
*
*= require_tree .
*= require_self
*/

/* ALL PAGES */

.spotify-banner {
text-align: right;
}
.spotify-banner img {

width: 75px;

}

/* SUGGESTION PARTIAL */
.album-art {
width: 100px;
height: 100px;
}

.fa {
font-size: 2rem !important;
color: red;
}

.fa-heart:hover {
cursor: pointer;
}
3 changes: 3 additions & 0 deletions app/assets/stylesheets/home.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the home 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/sessions.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the sessions controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/suggestions.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the suggestions 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/users.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the users controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
19 changes: 19 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,23 @@ class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception

helper_method :current_user, :user_favorited?, :current_page


def current_user
@user ||= User.find_by(id: session[:user_id])
end

def require_login
if current_user.nil?
flash[:error] = "You must be logged in to view this section"
redirect_to root_path
end
end

def user_favorited?(suggestion_id)
user_favorites = TunesTakeoutWrapper.get_favorites(current_user.uid)
user_favorites.include? suggestion_id
end
end
6 changes: 6 additions & 0 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class HomeController < ApplicationController
def index
@user = current_user
end
end

Loading