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

Search #60

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
40ba687
create validation for user_id
pacemade Jan 26, 2018
eadf3df
Correct owner cannot back own project test
pacemade Jan 26, 2018
748cef0
finish validating tests for both reward_test.rb
pacemade Jan 26, 2018
bab3733
refactor validations to use presence
pacemade Jan 26, 2018
b092057
Correct seed to create projects with users
pacemade Jan 29, 2018
bd8531a
Allow users to pledge
pacemade Jan 29, 2018
497e20d
error messages added to project, pledge, sign up and log in. Moved re…
vioif Jan 29, 2018
afad6a4
Merge pull request #1 from pacemade/validations
vioif Jan 29, 2018
fc9a20e
Create show for user profile
pacemade Jan 29, 2018
4521c82
Merge branch 'master' of https://github.com/pacemade/crowdfunder
pacemade Jan 29, 2018
891ea38
added more validations
vioif Jan 29, 2018
676c3af
Merge pull request #2 from pacemade/validations
pacemade Jan 29, 2018
723b989
Merge branch 'master' of https://github.com/pacemade/crowdfunder
pacemade Jan 29, 2018
83cfa12
Rewrote project show page to allow user to view project user profile
pacemade Jan 29, 2018
dd05236
Method to sum total amount pledged for project, and create test
pacemade Jan 30, 2018
d170a40
added time remaining to product show page
scotthuston82 Jan 30, 2018
f66d7b3
Link new project to current logged in user
pacemade Jan 30, 2018
3835267
Merge branch 'master' of https://github.com/pacemade/crowdfunder
pacemade Jan 30, 2018
bb7f9a6
added factories for tests
pacemade Jan 30, 2018
659a8f8
added a list of who has donated to the project on the owners show page
scotthuston82 Jan 30, 2018
1c7474a
pledges factory added test works
vioif Jan 30, 2018
c61db5b
Merge pull request #3 from pacemade/pledgesf
vioif Jan 30, 2018
148c348
define project, users, reward factories
pacemade Jan 30, 2018
4c52767
Merge branch 'master' of https://github.com/pacemade/crowdfunder
pacemade Jan 30, 2018
973e66e
added a list of what rewards have been earned
scotthuston82 Jan 30, 2018
91fc369
Merge branch 'master' of github.com:pacemade/crowdfunder
scotthuston82 Jan 30, 2018
f329e0c
rewrite pledge test rb to use factory methods
pacemade Jan 30, 2018
cfa7ffb
Merge branch 'master' of https://github.com/pacemade/crowdfunder
pacemade Jan 30, 2018
81243f2
Rewrite tests for reward and projects using FactoryGirl
pacemade Jan 30, 2018
78b4c3a
users test
vioif Jan 30, 2018
e87084a
Merge pull request #4 from pacemade/usertest
vioif Jan 30, 2018
0bda26b
Create view for my profile to show backers and the amount they backed
pacemade Jan 30, 2018
65c2344
Merge branch 'master' of https://github.com/pacemade/crowdfunder
pacemade Jan 30, 2018
f21be0c
added search bar
vioif Jan 30, 2018
2d3ba1f
start on pledge rewards
pacemade Jan 31, 2018
e054fa4
added search bar not functioning fully yet and fixed pledge dollar am…
vioif Jan 31, 2018
930fa42
search bar is funtioning
vioif Jan 31, 2018
3c98be9
create reward check on pledge model, implement when user pledges
pacemade Jan 31, 2018
b72fa94
Merge branch 'master' into search
vioif Jan 31, 2018
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
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ gem 'jquery-rails'
gem 'jbuilder', '~> 2.5'

# Database
gem 'pg'
gem 'pg', '=0.21'

# Authentication and authorization
gem 'bcrypt', '~> 3.1.7'
Expand All @@ -23,6 +23,7 @@ group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
gem 'faker'
gem 'pry-rails'
end

group :development do
Expand All @@ -40,4 +41,5 @@ group :test do
gem 'simplecov', require: false
gem 'guard', '~> 2.14.0'
gem 'guard-minitest'
gem 'factory_girl_rails'
end
170 changes: 91 additions & 79 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.1.1)
actionpack (= 5.1.1)
actioncable (5.1.4)
actionpack (= 5.1.4)
nio4r (~> 2.0)
websocket-driver (~> 0.6.1)
actionmailer (5.1.1)
actionpack (= 5.1.1)
actionview (= 5.1.1)
activejob (= 5.1.1)
actionmailer (5.1.4)
actionpack (= 5.1.4)
actionview (= 5.1.4)
activejob (= 5.1.4)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.1.1)
actionview (= 5.1.1)
activesupport (= 5.1.1)
actionpack (5.1.4)
actionview (= 5.1.4)
activesupport (= 5.1.4)
rack (~> 2.0)
rack-test (~> 0.6.3)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.1.1)
activesupport (= 5.1.1)
actionview (5.1.4)
activesupport (= 5.1.4)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.1.1)
activesupport (= 5.1.1)
activejob (5.1.4)
activesupport (= 5.1.4)
globalid (>= 0.3.6)
activemodel (5.1.1)
activesupport (= 5.1.1)
activerecord (5.1.1)
activemodel (= 5.1.1)
activesupport (= 5.1.1)
activemodel (5.1.4)
activesupport (= 5.1.4)
activerecord (5.1.4)
activemodel (= 5.1.4)
activesupport (= 5.1.4)
arel (~> 8.0)
activesupport (5.1.1)
activesupport (5.1.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
Expand All @@ -43,24 +43,30 @@ GEM
bcrypt (3.1.11)
bindex (0.5.0)
builder (3.2.3)
byebug (9.0.6)
coderay (1.1.1)
byebug (9.1.0)
coderay (1.1.2)
concurrent-ruby (1.0.5)
crass (1.0.3)
docile (1.1.5)
erubi (1.6.0)
erubi (1.7.0)
execjs (2.7.0)
faker (1.7.3)
i18n (~> 0.5)
factory_girl (4.8.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.8.0)
factory_girl (~> 4.8.0)
railties (>= 3.0.0)
faker (1.8.7)
i18n (>= 0.7)
ffi (1.9.18)
font-awesome-sass (4.7.0)
sass (>= 3.2)
formatador (0.2.5)
globalid (0.4.0)
globalid (0.4.1)
activesupport (>= 4.2.0)
guard (2.14.1)
guard (2.14.2)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (~> 1.0)
lumberjack (>= 1.0.12, < 2.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
Expand All @@ -70,7 +76,8 @@ GEM
guard-minitest (2.4.6)
guard-compat (~> 1.2)
minitest (>= 3.0)
i18n (0.8.4)
i18n (0.9.3)
concurrent-ruby (~> 1.0)
jbuilder (2.7.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
Expand All @@ -82,53 +89,53 @@ GEM
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
loofah (2.0.3)
loofah (2.1.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
lumberjack (1.0.12)
mail (2.6.6)
mime-types (>= 1.16, < 4)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.2.0)
minitest (5.10.2)
mail (2.7.0)
mini_mime (>= 0.1.1)
method_source (0.9.0)
mini_mime (1.0.0)
mini_portile2 (2.3.0)
minitest (5.11.2)
minitest-rails (3.0.0)
minitest (~> 5.8)
railties (~> 5.0)
minitest-reporters (1.1.14)
minitest-reporters (1.1.19)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
multi_json (1.12.1)
multi_json (1.13.1)
nenv (0.3.0)
nio4r (2.1.0)
nokogiri (1.8.0)
mini_portile2 (~> 2.2.0)
nio4r (2.2.0)
nokogiri (1.8.1)
mini_portile2 (~> 2.3.0)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
pg (0.21.0)
pry (0.10.4)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
puma (3.9.1)
method_source (~> 0.9.0)
pry-rails (0.3.6)
pry (>= 0.10.4)
puma (3.11.2)
rack (2.0.3)
rack-test (0.6.3)
rack (>= 1.0)
rails (5.1.1)
actioncable (= 5.1.1)
actionmailer (= 5.1.1)
actionpack (= 5.1.1)
actionview (= 5.1.1)
activejob (= 5.1.1)
activemodel (= 5.1.1)
activerecord (= 5.1.1)
activesupport (= 5.1.1)
bundler (>= 1.3.0, < 2.0)
railties (= 5.1.1)
rack-test (0.8.2)
rack (>= 1.0, < 3)
rails (5.1.4)
actioncable (= 5.1.4)
actionmailer (= 5.1.4)
actionpack (= 5.1.4)
actionview (= 5.1.4)
activejob (= 5.1.4)
activemodel (= 5.1.4)
activerecord (= 5.1.4)
activesupport (= 5.1.4)
bundler (>= 1.3.0)
railties (= 5.1.4)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.2)
actionpack (~> 5.x, >= 5.0.1)
Expand All @@ -139,31 +146,34 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (5.1.1)
actionpack (= 5.1.1)
activesupport (= 5.1.1)
railties (5.1.4)
actionpack (= 5.1.4)
activesupport (= 5.1.4)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (12.0.0)
rb-fsevent (0.9.8)
rake (12.3.0)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
ruby-progressbar (1.8.1)
sass (3.4.24)
sass-rails (5.0.6)
ruby-progressbar (1.9.0)
sass (3.5.5)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
shellany (0.0.1)
simplecov (0.14.1)
simplecov (0.15.1)
docile (~> 1.1.0)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.1)
slop (3.6.0)
simplecov-html (0.10.2)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
Expand All @@ -172,16 +182,16 @@ GEM
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.0)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
thor (0.19.4)
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.7)
tzinfo (1.2.3)
tilt (2.0.8)
tzinfo (1.2.4)
thread_safe (~> 0.1)
uglifier (3.2.0)
uglifier (4.1.4)
execjs (>= 0.3.0, < 3)
web-console (3.5.1)
actionview (>= 5.0)
Expand All @@ -190,14 +200,15 @@ GEM
railties (>= 5.0)
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
websocket-extensions (0.1.3)

PLATFORMS
ruby

DEPENDENCIES
bcrypt (~> 3.1.7)
byebug
factory_girl_rails
faker
font-awesome-sass (~> 4.7.0)
guard (~> 2.14.0)
Expand All @@ -207,7 +218,8 @@ DEPENDENCIES
listen (~> 3.0.5)
minitest-rails
minitest-reporters
pg
pg (= 0.21)
pry-rails
puma (~> 3.0)
rails (~> 5.1.1)
rails-controller-testing
Expand All @@ -219,4 +231,4 @@ DEPENDENCIES
web-console

BUNDLED WITH
1.16.0
1.16.1
7 changes: 7 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,11 @@ def current_user
def not_authenticated
redirect_to login_path, alert: "Please login first"
end

def require_login
unless current_user
flash[:alert] = "You must be logged in to create or donate."
redirect_to login_path
end
end
end
5 changes: 3 additions & 2 deletions app/controllers/pledges_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ def create
@pledge.user = current_user

if @pledge.save
redirect_to project_url(@project), notice: "You have successfully backed #{@project.title}!"
@pledge.reward_check
redirect_to project_url(@project), notice: "You have successfully backed #{@project.title} and earned the #{@pledge.reward_check.description} reward!"
else
flash.now[:alert] = @pledge.errors.full_messages.first
render 'projects/show'
end
end

end
8 changes: 8 additions & 0 deletions app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class ProjectsController < ApplicationController
def index
@projects = Project.all
@projects = @projects.order(:end_date)
@projects = Project.search(params[:term])
end

def show
Expand All @@ -23,12 +24,19 @@ def create
@project.start_date = params[:project][:start_date]
@project.end_date = params[:project][:end_date]
@project.image = params[:project][:image]
@project.user_id = session[:user_id]

if @project.save
redirect_to projects_url
else
flash[:notice] = "There was an error with your form. Please try again."
render :new

end
end

def task_params
params.require[:project].permit(:title, :description, :goal, :user_id, :term)
end

end
1 change: 1 addition & 0 deletions app/controllers/user_sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def create
session[:user_id] = user.id
redirect_to projects_url, notice: "Logged in!"
else
flash[:notice] = "There was an error with your form. Please try again."
render "new"
end
end
Expand Down
Loading