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

Reservationlink #61

Open
wants to merge 48 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
b188b65
added controllers (reservation, restaurant and user)
vioif Jan 23, 2018
aef70b8
added sessions controller androutes (user, reservation and resturant)
vioif Jan 23, 2018
85901ef
html create1
pkosta8 Jan 23, 2018
96825a7
html create1.1
pkosta8 Jan 23, 2018
54fd0bd
views added folders (rsv, rst, session and user)
vioif Jan 23, 2018
8ff26f0
Merge branch 'master' of https://github.com/pkosta8/seatyourself
pkosta8 Jan 23, 2018
9bcc79d
fixed controllers and now users view function is working
vioif Jan 24, 2018
c862648
Merge pull request #1 from pkosta8/irenea_seatyourself
vioif Jan 24, 2018
534f2dd
restaurant views current, form, edit
pkosta8 Jan 24, 2018
8470f96
Merge branch 'master' of https://github.com/pkosta8/seatyourself
pkosta8 Jan 24, 2018
cb468a6
fixed master views application made files plural ie. restaurants
vioif Jan 24, 2018
326743b
added info into sessions controller and views session controller. Bot…
vioif Jan 24, 2018
79ae8db
application controller def current user
vioif Jan 24, 2018
589e8a1
reservation controller made nothing in reservations view yet
vioif Jan 24, 2018
95de2d1
added models (ie. rst, rsv, owner, user) fixed resevations controller
vioif Jan 24, 2018
707e541
restaurant controller, viewform_restaurants, modelrestaurants migrate…
pkosta8 Jan 24, 2018
5e5e980
Merge pull request #2 from pkosta8/irenea_seatyourself
pkosta8 Jan 24, 2018
49e5206
rename folder form_restaurants
pkosta8 Jan 24, 2018
fed055d
resevation page functioning
vioif Jan 24, 2018
557c407
added opentime closetime , renamed index to new, new schema
pkosta8 Jan 24, 2018
6e1a561
Merge pull request #3 from pkosta8/paulseatyourself
pkosta8 Jan 24, 2018
225fa8b
modified resevation time and now able to rollback migrations
vioif Jan 24, 2018
2844dfb
changed reservations time and date slot
vioif Jan 24, 2018
b89e948
added schema back
vioif Jan 24, 2018
1a460f2
controller time and index
pkosta8 Jan 24, 2018
9204e93
Merge branch 'paulseatyourself'
pkosta8 Jan 24, 2018
560b20c
time update field restaurants controller
pkosta8 Jan 25, 2018
8fb4457
working new restaurants page+save+redirect index
pkosta8 Jan 25, 2018
ec0c917
added users index and fixed up resevationd controller removed S in re…
vioif Jan 25, 2018
0e5d916
Merge pull request #4 from pkosta8/user2
vioif Jan 25, 2018
4f2b20c
Merge pull request #6 from pkosta8/c
vioif Jan 25, 2018
5a25c0a
r updated on new.html restaurant
pkosta8 Jan 25, 2018
d316404
Merge pull request #7 from pkosta8/c
pkosta8 Jan 25, 2018
5bb3cf4
working render index.of db restaurants
pkosta8 Jan 25, 2018
affbdfd
Merge pull request #8 from pkosta8/rest.index.all
pkosta8 Jan 25, 2018
2f4b9b6
users now directed to index page and sessions contorl is still not fu…
vioif Jan 25, 2018
7a643f8
Merge pull request #9 from pkosta8/sessions1
vioif Jan 25, 2018
f1d8ca2
fixed sessions controller and sessions view working
vioif Jan 25, 2018
b4ac528
Merge pull request #10 from pkosta8/sessions2
vioif Jan 25, 2018
98ffda6
sessions controller functioning now when logged in
vioif Jan 25, 2018
5c59f1c
edited reservation page number field and time field
vioif Jan 25, 2018
703708f
Merge pull request #11 from pkosta8/reservation
vioif Jan 25, 2018
7c5c7a4
links on restaurant name to reservations new path
pkosta8 Jan 25, 2018
f2cd639
Merge pull request #12 from pkosta8/rest.index.links2
pkosta8 Jan 25, 2018
2d6174e
deleted files
vioif Jan 25, 2018
46f7044
Merge branch 'master' of https://github.com/pkosta8/seatyourself
vioif Jan 25, 2018
bdbef30
reservations now link to restaurant page
vioif Jan 25, 2018
8fddd33
reservations now link to individual restaurants
vioif Jan 26, 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: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@ -33,13 +33,14 @@ gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'awesome_print'
end

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


# 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.1
3 changes: 3 additions & 0 deletions app/assets/javascripts/reservation.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/restaurant.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/user.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/reservation.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the reservation 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/restaurant.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the restaurant 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/user.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the user controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
23 changes: 23 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,27 @@ 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

def ensure_logged_in
if !session[:user_id]
flash[:alert] = ["You need to be logged in to do that!"]
redirect_to sessions_new_path
end
end

def ensure_user_reservation
if session[:user_id] != @user.user_id
flash[:alert] = ["Would you like to contiune with your reservations?"]
redirect_to root_path
end
end

end
53 changes: 53 additions & 0 deletions app/controllers/reservations_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
class ReservationsController < ApplicationController
before_action :ensure_logged_in, only: [:create, :edit, :destroy]
# before_action :load_restaurant

def index
@reservations = Reservation.all
end

def show
@reservation = Reservation.find(params[:id])
end

def new
@restaurant = Restaurant.find(params[:restaurant_id])
@reservation = Reservation.new
end

def edit
@reservation = Reservation.find(params[:id])
end

def create
@reservation = Reservation.new

@reservation.user_id = params[:reservation][:user_id]
@reservation.date = params[:reservation][:date]
@reservation.number_of_people = params[:reservation][:number_of_people]
if @reservation.save
redirect_to restaurants_path, notice: 'Reservation have succesfully been booked'
else
render 'restaurants'
end
end
def update
@reservation = Reservation.find(params[:id])

@reservatiton.name = params[:reservation][:name]
@reservation.date = params[:reservation][:date]
@reservation.number_of_people = params[:reservation][:number_of_people]

if @reservation.save
redirect_to resturants_path, notice: 'Resevations have succesfully been updated '
else
render :edit
end
end

def destroy
@reservation = Reservation.find(params[:id])
@reservation.destory
redirect_to "/resturants"
end
end
Loading