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

Week 7 part 2 #144

Open
wants to merge 63 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
84166d0
Finished prework
Jameskcoleman Jun 22, 2014
8389e62
Finished week 1 assignments 7 through 10
Jameskcoleman Jun 22, 2014
f41e882
Merge pull request #1 from Jameskcoleman/week_1_first_assignments
Jameskcoleman Jun 23, 2014
503fb10
Completed assignments 15 and 16
Jameskcoleman Jun 23, 2014
c651f11
Trying to solve problem
Jameskcoleman Jun 23, 2014
bbf12e5
Finished Week 1
Jameskcoleman Jun 29, 2014
d37d229
Merge pull request #2 from Jameskcoleman/week_1_section_2
Jameskcoleman Jun 29, 2014
7c7f812
Finished Week 2 assignment 10
Jameskcoleman Jul 4, 2014
596aed6
Completed through week 2 assignment 17
Jameskcoleman Jul 7, 2014
c578c38
Merge pull request #3 from Jameskcoleman/week_2_part_1
Jameskcoleman Jul 7, 2014
79ea0ad
Completed week 2 assignments 15 and 16
Jameskcoleman Jul 7, 2014
394f9c7
Finished Week 2
Jameskcoleman Jul 7, 2014
7b8e61d
Merge pull request #4 from Jameskcoleman/week_2_part_2
Jameskcoleman Jul 7, 2014
cced288
User can reorder videos in the queue
Jameskcoleman Jul 9, 2014
6c32f0c
Pushed down complexity. User can change video ratings in the queue.
Jameskcoleman Jul 9, 2014
2cda3ef
Merge pull request #5 from Jameskcoleman/week_3_part_1
Jameskcoleman Jul 9, 2014
80d46d8
Implemented feature spec for user sign in
Jameskcoleman Jul 10, 2014
e9b76e9
Completed Week 3
Jameskcoleman Jul 11, 2014
d0f3e1e
Merge pull request #6 from Jameskcoleman/week_3_part_2
Jameskcoleman Jul 11, 2014
d9df28f
Implemented the user profile page
Jameskcoleman Jul 11, 2014
aeb77ad
Implemented user profile page, People I Follow page, ability to follo…
Jameskcoleman Jul 14, 2014
d139ad6
Merge pull request #7 from Jameskcoleman/week_4_part_1
Jameskcoleman Jul 14, 2014
26c035d
Implemented welcome email sending and added tests to email sending
Jameskcoleman Jul 15, 2014
294336e
Implemented sending welcome email, added tests to email sending, impl…
Jameskcoleman Jul 16, 2014
9cf1cd5
Merge pull request #8 from Jameskcoleman/week_4_part_2
Jameskcoleman Jul 16, 2014
2195494
Deleted superfluous file.
Jameskcoleman Jul 16, 2014
94cf991
Wrote integration test for resetting password and implemented invitin…
Jameskcoleman Jul 19, 2014
2eb4e45
Refactored with concerns
Jameskcoleman Jul 21, 2014
a595be2
Merge pull request #9 from Jameskcoleman/week_5_part_1
Jameskcoleman Jul 21, 2014
5f90182
Changed email configuration
Jameskcoleman Jul 21, 2014
81e8a93
Changed email configuration
Jameskcoleman Jul 21, 2014
2edbd1d
Changed email configuration
Jameskcoleman Jul 21, 2014
43ab794
Changed email configuration
Jameskcoleman Jul 21, 2014
7d2ba13
Changed email configuration
Jameskcoleman Jul 21, 2014
6516620
Set up Sidekiq and Unicorn
Jameskcoleman Jul 28, 2014
0580974
Merge pull request #10 from Jameskcoleman/week_5_part_2
Jameskcoleman Jul 28, 2014
0b12bb8
Changed Unicorn config
Jameskcoleman Jul 28, 2014
7e8bfb8
Changed procfile
Jameskcoleman Jul 28, 2014
b8cd20c
Added Sentry
Jameskcoleman Jul 28, 2014
cbf2f7e
Gem update
Jameskcoleman Jul 28, 2014
1570e44
Added paratrooper gem
Jameskcoleman Jul 28, 2014
e8ce385
Added deployment rake task
Jameskcoleman Jul 28, 2014
73eb8da
Modified deploy.rake
Jameskcoleman Jul 28, 2014
c6e4051
Modified deploy.rake
Jameskcoleman Jul 28, 2014
3822f37
Modified deploy.rake
Jameskcoleman Jul 28, 2014
a91c02d
Implemented admin sign in
Jameskcoleman Jul 29, 2014
428c65e
Implemented admin signs in, admin adds a video
Jameskcoleman Aug 4, 2014
735bd67
Implemented watch video and feature test for adding video.
Jameskcoleman Aug 5, 2014
5685425
Merge pull request #11 from Jameskcoleman/week_6_part_1
Jameskcoleman Aug 5, 2014
1e9a6b9
Implemented using Stripe custom form to charge credit card
Jameskcoleman Aug 5, 2014
1b39aec
Improved description of tokenable
Jameskcoleman Aug 5, 2014
775c38e
Merge pull request #12 from Jameskcoleman/week_6_part_2
Jameskcoleman Aug 6, 2014
1d04683
Removed config file
Jameskcoleman Aug 6, 2014
a243c15
Built API wrapper for Stripe
Jameskcoleman Aug 6, 2014
b7db515
Implemented charge credit card on registration
Jameskcoleman Aug 6, 2014
91576aa
Implemented charge credit card on registration
Jameskcoleman Aug 6, 2014
536f1e2
Implemented feature test for registration with credit card
Jameskcoleman Aug 7, 2014
85f0d27
Merge pull request #13 from Jameskcoleman/week_7_part_1
Jameskcoleman Aug 7, 2014
f79956b
Wrote videos decorator
Jameskcoleman Aug 7, 2014
f0ce62d
Wrote a sign up service
Jameskcoleman Aug 7, 2014
c5b5936
Modified .gitignore
Jameskcoleman Aug 9, 2014
f6ec4b2
Modified .gitignore
Jameskcoleman Aug 9, 2014
d46c20d
Modified gitignore
Jameskcoleman Aug 9, 2014
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp

/config/application.yml
29 changes: 25 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,43 @@ gem 'haml-rails'
gem 'sass-rails'
gem 'uglifier'
gem 'jquery-rails'
gem 'bootstrap_form'
gem 'bcrypt-ruby', '=3.1.0'
gem 'sidekiq'
gem 'unicorn'
gem 'sentry-raven'
gem 'paratrooper'
gem 'carrierwave'
gem 'mini_magick'
gem 'stripe'
gem 'figaro'
gem 'draper'

group :development do
gem 'sqlite3'
gem 'pry'
gem 'pry-nav'
gem 'thin'
gem "better_errors"
gem "binding_of_caller"
gem 'better_errors'
gem 'binding_of_caller'
gem 'letter_opener'
end

group :development, :test do
gem 'rspec-rails', '2.99'
gem 'fabrication'
gem 'faker'
gem 'pry'
gem 'pry-nav'
end

group :test do
gem 'database_cleaner', '1.2.0'
gem 'shoulda-matchers'
gem 'capybara', '2.1.0'
gem 'launchy'
gem 'capybara-email', '2.1.2'
gem 'vcr'
gem 'webmock', '1.11.0'
gem 'selenium-webdriver'
end

group :production do
Expand Down
127 changes: 127 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,36 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
addressable (2.3.6)
arel (5.0.1.20140414130214)
bcrypt-ruby (3.1.0)
better_errors (1.0.1)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootstrap-sass (3.1.1.1)
sass (~> 3.2)
bootstrap_form (2.1.1)
builder (3.2.2)
capybara (2.1.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
capybara-email (2.1.2)
capybara (~> 2.1.0)
mail
carrierwave (0.10.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
json (>= 1.7)
mime-types (>= 1.16)
celluloid (0.15.2)
timers (~> 1.1.0)
childprocess (0.5.3)
ffi (~> 1.0, >= 1.0.11)
coderay (1.1.0)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
Expand All @@ -44,33 +65,72 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.6.3)
connection_pool (2.0.0)
crack (0.4.2)
safe_yaml (~> 1.0.0)
daemons (1.1.9)
database_cleaner (1.2.0)
debug_inspector (0.0.2)
diff-lcs (1.2.5)
draper (1.3.1)
actionpack (>= 3.0)
activemodel (>= 3.0)
activesupport (>= 3.0)
request_store (~> 1.0.3)
erubis (2.7.0)
eventmachine (1.0.0)
excon (0.38.0)
execjs (2.0.2)
fabrication (2.11.3)
faker (1.3.0)
i18n (~> 0.5)
faraday (0.9.0)
multipart-post (>= 1.2, < 3)
ffi (1.9.3)
figaro (0.7.0)
bundler (~> 1.0)
rails (>= 3, < 5)
haml (4.0.5)
tilt
haml-rails (0.5.3)
actionpack (>= 4.0.1)
activesupport (>= 4.0.1)
haml (>= 3.1, < 5.0)
railties (>= 4.0.1)
hashie (3.2.0)
heroku-api (0.3.19)
excon (~> 0.38)
multi_json (~> 1.8)
hike (1.2.3)
i18n (0.6.9)
jquery-rails (3.0.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1)
kgio (2.9.2)
launchy (2.4.2)
addressable (~> 2.3)
letter_opener (1.2.0)
launchy (~> 2.2)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
method_source (0.8.2)
mime-types (1.25.1)
mini_magick (3.8.0)
subexec (~> 0.2.1)
mini_portile (0.6.0)
minitest (5.3.4)
multi_json (1.10.1)
multipart-post (2.0.0)
netrc (0.7.7)
nokogiri (1.6.3.1)
mini_portile (= 0.6.0)
paratrooper (2.4.1)
excon
heroku-api (~> 0.3)
netrc (~> 0.7)
rendezvous (~> 0.0.1)
pg (0.17.0)
polyglot (0.3.5)
pry (0.9.12.3)
Expand Down Expand Up @@ -102,7 +162,16 @@ GEM
activesupport (= 4.1.1)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
raindrops (0.13.0)
rake (10.3.2)
redis (3.1.0)
redis-namespace (1.5.0)
redis (~> 3.0, >= 3.0.4)
rendezvous (0.0.2)
request_store (1.0.8)
rest-client (1.7.2)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rspec-collection_matchers (1.0.0)
rspec-expectations (>= 2.99.0.beta1)
rspec-core (2.99.0)
Expand All @@ -118,12 +187,31 @@ GEM
rspec-core (~> 2.99.0)
rspec-expectations (~> 2.99.0)
rspec-mocks (~> 2.99.0)
rubyzip (1.1.6)
safe_yaml (1.0.3)
sass (3.2.19)
sass-rails (4.0.3)
railties (>= 4.0.0, < 5.0)
sass (~> 3.2.0)
sprockets (~> 2.8, <= 2.11.0)
sprockets-rails (~> 2.0)
selenium-webdriver (2.42.0)
childprocess (>= 0.5.0)
multi_json (~> 1.0)
rubyzip (~> 1.0)
websocket (~> 1.0.4)
sentry-raven (0.9.4)
faraday (>= 0.7.6)
hashie (>= 1.1.0)
uuidtools
shoulda-matchers (2.6.1)
activesupport (>= 3.0.0)
sidekiq (3.2.1)
celluloid (>= 0.15.2)
connection_pool (>= 2.0.0)
json
redis (>= 3.0.6)
redis-namespace (>= 1.3.1)
slop (3.4.7)
sprockets (2.11.0)
hike (~> 1.2)
Expand All @@ -135,13 +223,19 @@ GEM
activesupport (>= 3.0)
sprockets (~> 2.8)
sqlite3 (1.3.8)
stripe (1.15.0)
json (~> 1.8.1)
mime-types (>= 1.25, < 3.0)
rest-client (~> 1.4)
subexec (0.2.3)
thin (1.5.0)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
timers (1.1.0)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
Expand All @@ -150,25 +244,58 @@ GEM
uglifier (2.3.1)
execjs (>= 0.3.0)
json (>= 1.8.0)
unicorn (4.8.3)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
uuidtools (2.1.4)
vcr (2.9.2)
webmock (1.11.0)
addressable (>= 2.2.7)
crack (>= 0.3.2)
websocket (1.0.7)
xpath (2.0.0)
nokogiri (~> 1.3)

PLATFORMS
ruby

DEPENDENCIES
bcrypt-ruby (= 3.1.0)
better_errors
binding_of_caller
bootstrap-sass
bootstrap_form
capybara (= 2.1.0)
capybara-email (= 2.1.2)
carrierwave
coffee-rails
database_cleaner (= 1.2.0)
draper
fabrication
faker
figaro
haml-rails
jquery-rails
launchy
letter_opener
mini_magick
paratrooper
pg
pry
pry-nav
rails (= 4.1.1)
rails_12factor
rspec-rails (= 2.99)
sass-rails
selenium-webdriver
sentry-raven
shoulda-matchers
sidekiq
sqlite3
stripe
thin
uglifier
unicorn
vcr
webmock (= 1.11.0)
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
26 changes: 26 additions & 0 deletions app/assets/javascripts/payment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
jQuery(function($) {
$('#payment-form').submit(function(event) {
var $form = $(this);
$form.find('button').prop('disabled', true);

Stripe.card.createToken($form, stripeResponseHandler);
return false;
});
});

function stripeResponseHandler(status, response) {
var $form = $('#payment-form');

if (response.error) {
// Show the errors on the form
$form.find('.payment-errors').text(response.error.message);
$form.find('button').prop('disabled', false);
} else {
// response contains id and card, which contains additional card details
var token = response.id;
// Insert the token into the form so it gets submitted to the server
$form.append($('<input type="hidden" name="stripeToken" />').val(token));
// and submit
$form.get(0).submit();
}
};
2 changes: 1 addition & 1 deletion app/assets/stylesheets/user.sass
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ section.user
h2
font-size: 16px
font-weight: normal
button
a
float: right

section.user_reviews
Expand Down
32 changes: 32 additions & 0 deletions app/controllers/admin/videos_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
class Admin::VideosController < ApplicationController
before_filter :require_user
before_filter :require_admin

def new
@video = Video.new
end

def create
@video = Video.new(video_params)
if @video.save
flash[:success] = "You have successfully added the video '#{@video.title}'."
redirect_to new_admin_video_path
else
flash[:danger] = "You cannot add this video. Please check the errors."
render :new
end
end

private

def video_params
params.require(:video).permit!
end

def require_admin
if !current_user.admin?
flash[:danger] = "You are not authorized to do that."
redirect_to home_path
end
end
end
10 changes: 10 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
class ApplicationController < ActionController::Base
protect_from_forgery

def require_user
redirect_to sign_in_path unless current_user
end

def current_user
User.find(session[:user_id]) if session[:user_id]
end

helper_method :current_user
end
7 changes: 7 additions & 0 deletions app/controllers/categories_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class CategoriesController < ApplicationController

def show
@category = Category.find(params[:id])
end

end
Loading