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

User branch #54

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
bbf10b6
add user stories
jeffrothwell Jan 23, 2018
e5fd906
prioritize by need, should and could have
jeffrothwell Jan 23, 2018
0f6ad0b
add assumptions to simplify reservation
jeffrothwell Jan 23, 2018
f40ddba
minor assumption change
jeffrothwell Jan 23, 2018
3972bee
generate models, run migrations
jeffrothwell Jan 23, 2018
a80381d
changed time in restaurant table to time, seed db, setup restaurant r…
jeffrothwell Jan 23, 2018
d5812ba
create restaurants controller, index action and view
jeffrothwell Jan 23, 2018
aa2760f
add show view
jeffrothwell Jan 23, 2018
bc1cf68
make restaurant name link to show page
jeffrothwell Jan 23, 2018
7eb439d
set up associations
jeffrothwell Jan 23, 2018
cbb263f
nest bookings resources
jeffrothwell Jan 23, 2018
dfc79b5
add bcrypt gem
jeffrothwell Jan 23, 2018
0c2ee1e
change column header type to kind
jeffrothwell Jan 23, 2018
6f50841
seed some users
jeffrothwell Jan 23, 2018
3c0a870
add has_secure_password method
jeffrothwell Jan 23, 2018
f743d0c
add assumption for current day bookings only
jeffrothwell Jan 23, 2018
a5e312a
Create user controller, define new and create methods
pacemade Jan 23, 2018
28f516d
Create new view form for user signup
pacemade Jan 23, 2018
01a6ef3
Make restaurants index the root
pacemade Jan 23, 2018
461488c
Create resources for sessions, create signup link on application.html…
pacemade Jan 23, 2018
f93df1b
Define sessions create and destroy
pacemade Jan 23, 2018
3c44125
Add logout link in application.html
pacemade Jan 24, 2018
a159837
add address attribute to restaurants, re-seed db
jeffrothwell Jan 24, 2018
b447783
Merge pull request #1 from jeffrothwell/user_branch
pacemade Jan 24, 2018
e750cf4
Create if's for whether or not you are logged in
pacemade Jan 24, 2018
457ff26
add @bookings and @booking instance variables to restaurants controller
jeffrothwell Jan 24, 2018
aa4698c
generate bookings controller
jeffrothwell Jan 24, 2018
53e261d
Create flash notice and alert on application.html
pacemade Jan 24, 2018
4f2303a
Add flash alert for @user.errors.full_messages
pacemade Jan 24, 2018
e82ad5a
create validations for signup
pacemade Jan 24, 2018
2619a57
added create restaurant form
scotthuston82 Jan 24, 2018
bf69ce0
Create flash for login session errors
pacemade Jan 24, 2018
aca94c5
create bookings controller, new booking form
jeffrothwell Jan 24, 2018
5d3ac81
Merge branch 'master' of https://github.com/jeffrothwell/seatyourself
scotthuston82 Jan 24, 2018
2ef30fb
Create radio buttons for signup, save choice into User.kind
pacemade Jan 24, 2018
44ade5a
add save to create action for booking
jeffrothwell Jan 24, 2018
86235eb
Merge pull request #2 from jeffrothwell/save-booking
jeffrothwell Jan 24, 2018
b9b29c9
Make it so that when you sign up, it logs you in automatically
pacemade Jan 24, 2018
4ff872f
Fix merge conflict within users_controller
pacemade Jan 24, 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
5 changes: 2 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

gem 'awesome_print'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
Expand All @@ -22,7 +22,7 @@ gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

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

# Use Unicorn as the app server
# gem 'unicorn'
Expand All @@ -42,4 +42,3 @@ group :development do
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end

180 changes: 96 additions & 84 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,115 +1,125 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.0.0.1)
actionpack (= 5.0.0.1)
nio4r (~> 1.2)
actioncable (5.0.6)
actionpack (= 5.0.6)
nio4r (>= 1.2, < 3.0)
websocket-driver (~> 0.6.1)
actionmailer (5.0.0.1)
actionpack (= 5.0.0.1)
actionview (= 5.0.0.1)
activejob (= 5.0.0.1)
actionmailer (5.0.6)
actionpack (= 5.0.6)
actionview (= 5.0.6)
activejob (= 5.0.6)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.0.0.1)
actionview (= 5.0.0.1)
activesupport (= 5.0.0.1)
actionpack (5.0.6)
actionview (= 5.0.6)
activesupport (= 5.0.6)
rack (~> 2.0)
rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.0.1)
activesupport (= 5.0.0.1)
actionview (5.0.6)
activesupport (= 5.0.6)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (5.0.0.1)
activesupport (= 5.0.0.1)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.0.6)
activesupport (= 5.0.6)
globalid (>= 0.3.6)
activemodel (5.0.0.1)
activesupport (= 5.0.0.1)
activerecord (5.0.0.1)
activemodel (= 5.0.0.1)
activesupport (= 5.0.0.1)
activemodel (5.0.6)
activesupport (= 5.0.6)
activerecord (5.0.6)
activemodel (= 5.0.6)
activesupport (= 5.0.6)
arel (~> 7.0)
activesupport (5.0.0.1)
activesupport (5.0.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
arel (7.1.4)
binding_of_caller (0.7.2)
awesome_print (1.8.0)
bcrypt (3.1.11)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
builder (3.2.2)
byebug (9.0.6)
builder (3.2.3)
byebug (9.1.0)
coffee-rails (4.1.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.1.x)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.10.0)
concurrent-ruby (1.0.2)
debug_inspector (0.0.2)
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
crass (1.0.3)
debug_inspector (0.0.3)
erubis (2.7.0)
execjs (2.7.0)
globalid (0.3.7)
activesupport (>= 4.1.0)
i18n (0.7.0)
jbuilder (2.6.0)
activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2)
jquery-rails (4.2.1)
ffi (1.9.18)
globalid (0.4.1)
activesupport (>= 4.2.0)
i18n (0.9.3)
concurrent-ruby (~> 1.0)
jbuilder (2.7.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
jquery-rails (4.3.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
loofah (2.0.3)
json (1.8.6)
loofah (2.1.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.6.4)
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.1.0)
minitest (5.9.1)
multi_json (1.12.1)
nio4r (1.2.1)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
rack (2.0.1)
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.1)
multi_json (1.13.1)
nio4r (2.2.0)
nokogiri (1.8.1)
mini_portile2 (~> 2.3.0)
rack (2.0.3)
rack-test (0.6.3)
rack (>= 1.0)
rails (5.0.0.1)
actioncable (= 5.0.0.1)
actionmailer (= 5.0.0.1)
actionpack (= 5.0.0.1)
actionview (= 5.0.0.1)
activejob (= 5.0.0.1)
activemodel (= 5.0.0.1)
activerecord (= 5.0.0.1)
activesupport (= 5.0.0.1)
bundler (>= 1.3.0, < 2.0)
railties (= 5.0.0.1)
rails (5.0.6)
actioncable (= 5.0.6)
actionmailer (= 5.0.6)
actionpack (= 5.0.6)
actionview (= 5.0.6)
activejob (= 5.0.6)
activemodel (= 5.0.6)
activerecord (= 5.0.6)
activesupport (= 5.0.6)
bundler (>= 1.3.0)
railties (= 5.0.6)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.1)
activesupport (>= 4.2.0, < 6.0)
nokogiri (~> 1.6.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (5.0.0.1)
actionpack (= 5.0.0.1)
activesupport (= 5.0.0.1)
railties (5.0.6)
actionpack (= 5.0.6)
activesupport (= 5.0.6)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (11.3.0)
rdoc (4.2.2)
json (~> 1.4)
sass (3.4.22)
sass-rails (5.0.6)
rake (12.3.0)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rdoc (4.3.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)
Expand All @@ -118,41 +128,43 @@ GEM
sdoc (0.4.2)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
spring (2.0.0)
spring (2.0.2)
activesupport (>= 4.2)
sprockets (3.7.0)
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)
sqlite3 (1.3.12)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.5)
tzinfo (1.2.2)
sqlite3 (1.3.13)
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.8)
tzinfo (1.2.4)
thread_safe (~> 0.1)
uglifier (3.0.3)
uglifier (4.1.4)
execjs (>= 0.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)
websocket-driver (0.6.4)
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
websocket-extensions (0.1.3)

PLATFORMS
ruby

DEPENDENCIES
awesome_print
bcrypt (~> 3.1.7)
byebug
coffee-rails (~> 4.1.0)
jbuilder (~> 2.0)
jquery-rails
rails (~> 5.0)
rails (~> 5.0.1)
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
spring
Expand All @@ -161,4 +173,4 @@ DEPENDENCIES
web-console (~> 2.0)

BUNDLED WITH
1.11.2
1.16.0
3 changes: 3 additions & 0 deletions app/assets/javascripts/bookings.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/restaurants.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/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/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/bookings.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the bookings 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/restaurants.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the restaurants 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/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/
8 changes: 8 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@ 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

private

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

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

def create
@restaurant = Restaurant.find(params[:restaurant_id])
@booking = @restaurant.bookings.new
@booking.time = params[:booking][:time] + params[:hour].hour
@booking.n_people = params[:booking][:time]
@booking.user = current_user

if @booking.save
flash[:notice] = "Reservation made at #{@restaurant.name} on #{@booking.time.month}/#{@booking.time.day} at #{@booking.time.hour}"
redirect_to root_path
end
end

end
42 changes: 42 additions & 0 deletions app/controllers/restaurants_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
class RestaurantsController < ApplicationController

def index
@restaurants = Restaurant.all
end

def show
@restaurant = Restaurant.find(params[:id])
@bookings = @restaurant.bookings
@booking = Booking.new
end

def new
@restaurant = Restaurant.new
end

def create
@restaurant = Restaurant.new
@restaurant.name = params[:restaurant][:name]
@restaurant.description = params[:restaurant][:description]
@restaurant.open_time = params[:restaurant][:open_time]
@restaurant.close_time = params[:restaurant][:close_time]
@restaurant.price = params[:restaurant][:price]

if @restaurant.save
redirect_to restaurants_url
end
end

def edit

end

def update

end

def destroy

end

end
Loading