Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
8f42f15
[Munch] created the skeleton which has the model, association, and co…
d-ang1993 Oct 10, 2018
de7cd5e
[Munch] Sign-up page controller, view created, and b-crypt installed,…
d-ang1993 Oct 10, 2018
bead93a
[Munch] removed column owner within users table
d-ang1993 Oct 10, 2018
2f47590
Added restaurant index page from seeds
Kevintudiep Oct 10, 2018
67a11ec
[Munch] completed log-in controller and view
d-ang1993 Oct 10, 2018
f153b6e
Merge pull request #1 from DangAsian/session_user
ndelforno Oct 10, 2018
4a4b506
Merge pull request #2 from DangAsian/Index_layout
ndelforno Oct 10, 2018
0c0ac2c
added name column to restaurants
Kevintudiep Oct 10, 2018
af9d88a
home login and signup button done
ndelforno Oct 10, 2018
8e76789
Changed Index page to show list restaurants, added individual show pa…
Kevintudiep Oct 10, 2018
77b5dc4
[munch] initialize current_user added log out
ndelforno Oct 10, 2018
697355e
Merge pull request #3 from DangAsian/layout_creation
ndelforno Oct 11, 2018
ff19159
Merge pull request #4 from DangAsian/adding_show_page
ndelforno Oct 11, 2018
9102bca
created restaurant show, edit, create methods in restaurant controlle…
Kevintudiep Oct 11, 2018
a3fda88
Added destroy method in restaurant controller
Kevintudiep Oct 11, 2018
be501dd
reservation party time form
gitmamhub Oct 11, 2018
354b00f
Merge pull request #5 from DangAsian/restaurant_create
ndelforno Oct 11, 2018
04a9504
Changed index layout
ndelforno Oct 11, 2018
d621596
Displayed list of restaurants in user profile
ndelforno Oct 11, 2018
b66cd6c
Edit restaurant from profile page
ndelforno Oct 11, 2018
547af17
[Munch] added the reservation form:
gitmamhub Oct 11, 2018
19997c2
Merge pull request #6 from DangAsian/RO_managment
ndelforno Oct 11, 2018
6e428a6
Merge branch 'master' into reservation
d-ang1993 Oct 11, 2018
60a3f50
Merge pull request #7 from DangAsian/reservation
d-ang1993 Oct 11, 2018
8b1c1e3
Deleted overlapping migration for adding column
Kevintudiep Oct 11, 2018
d1ceaed
Added delete function on User show page, link to profile on layout
Kevintudiep Oct 11, 2018
5b13ed1
completed finding the total sum
d-ang1993 Oct 11, 2018
642d5b3
Added list of reservations into profile
Kevintudiep Oct 11, 2018
ab7e9d0
Merge pull request #8 from DangAsian/link_to_user_profile_and_delete_…
ndelforno Oct 11, 2018
2763afb
added min and max party to schema, added to new and edit form
Kevintudiep Oct 11, 2018
7c237e4
Merge pull request #9 from DangAsian/adding_min_max_party_to_schema
ndelforno Oct 11, 2018
edbd5df
nothing
ndelforno Oct 11, 2018
94077ea
resolved conflict
ndelforno Oct 11, 2018
0b21b4d
Validation added and errors messages added + partial view created
ndelforno Oct 11, 2018
c92cea4
[Munch] CAN'T RENDER THE SHOW PAGE FOR RESERVATIONS!
d-ang1993 Oct 11, 2018
7f8e4e6
Displayed resrvation made in profile
ndelforno Oct 12, 2018
de2af2f
Merge pull request #10 from DangAsian/validation_and_errors_messages
ndelforno Oct 12, 2018
16bef6f
Merge branch 'master' into reservation_complete
ndelforno Oct 12, 2018
a31a561
Merge pull request #11 from DangAsian/reservation_complete
ndelforno Oct 12, 2018
6ba5202
added css layout
Kevintudiep Oct 12, 2018
bc87b0b
resolved conflict
Kevintudiep Oct 12, 2018
938b8f1
displayed restaurant name on reservations made
ndelforno Oct 12, 2018
7717638
Merge pull request #12 from DangAsian/reservation_details
ndelforno Oct 12, 2018
10c7475
general push
ndelforno Oct 12, 2018
b589065
slight change in css
Kevintudiep Oct 12, 2018
64a33ca
test
Kevintudiep Oct 12, 2018
b5b1d37
Completed the user
d-ang1993 Oct 12, 2018
31d1e95
Merge pull request #13 from DangAsian/reservation_user
d-ang1993 Oct 12, 2018
f29b583
Merge branch 'master' of https://github.com/DangAsian/seatyourself
ndelforno Oct 12, 2018
204c4cb
Blocked reservations for visitors + redirect to same pages after logg…
ndelforno Oct 12, 2018
8cff9fb
[Munch] All Reservation completed except for past dates, included all…
d-ang1993 Oct 12, 2018
1244d8a
errors messges on login done
ndelforno Oct 12, 2018
d27b26d
Merge pull request #14 from DangAsian/errors_message_login
ndelforno Oct 12, 2018
f669b33
added css to header,footre and index
Kevintudiep Oct 12, 2018
c962afc
Merge branch 'master' into css_test
ndelforno Oct 12, 2018
45cfcce
Merge pull request #15 from DangAsian/css_test
ndelforno Oct 12, 2018
c683b3f
[Munch] Reservation is complete git branchgit branch! GO TEAMWORK
d-ang1993 Oct 12, 2018
09eed07
Merge branch 'master' into reservation_user
d-ang1993 Oct 12, 2018
944d305
Merge pull request #16 from DangAsian/reservation_user
d-ang1993 Oct 12, 2018
a1efc04
changed on time
ndelforno Oct 12, 2018
9c7ee46
Merge branch 'master' into time_structure
ndelforno Oct 12, 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
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,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 @@ -41,4 +41,3 @@ group :development do
gem 'spring'
gem 'listen'
end

4 changes: 3 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ GEM
minitest (~> 5.1)
tzinfo (~> 1.1)
arel (9.0.0)
bcrypt (3.1.12)
bindex (0.5.0)
builder (3.2.3)
byebug (10.0.2)
Expand Down Expand Up @@ -160,6 +161,7 @@ PLATFORMS
ruby

DEPENDENCIES
bcrypt (~> 3.1.7)
byebug
jbuilder (~> 2.0)
jquery-rails
Expand All @@ -173,4 +175,4 @@ DEPENDENCIES
web-console

BUNDLED WITH
1.16.1
1.16.2
2 changes: 2 additions & 0 deletions app/assets/javascripts/reservations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
2 changes: 2 additions & 0 deletions app/assets/javascripts/restaurants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
2 changes: 2 additions & 0 deletions app/assets/javascripts/sessions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
2 changes: 2 additions & 0 deletions app/assets/javascripts/users.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
98 changes: 98 additions & 0 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,101 @@
*= require_tree .
*= require_self
*/

a, h1, h2 {
text-decoration: none;
font-family: "Helvetica", sans-serif;
}

li {
list-style: none;
}

header {
display: grid;
grid-template-rows: 70% 30%;
background-color: #E48B58;
width: 100%;
border-style: solid;
}

.header_background {
background-size: auto;
width: 100%;
}

.header_logo {
position: absolute;
display: inline-block;
}

.header_logo h1 {
margin-top: 0;
margin-bottom: 0;
padding-top: 20px;
padding-left: 20px;
color: white;
position: absolute;
grid-row: 1/2;
text-align: center;
}

.header_logo li {
padding-left: 20px;
}

.header_logo img {
padding-top: 20px;
padding-left: 20px;
}

header a {
color: white;
}
.header_nav li {
display: inline;
color: white;
padding-right: 5px;
text-align: left;

}

.header_nav {

}

body {
margin: 0
}

.restaurant_list ul {
display: inline-block;
margin-left: 50px;
margin-right: 50px;
}

.restaurant_list li {
text-align: center;
}

footer {
border-style: solid;
}

footer ul {
padding-top: 20px;
padding-bottom: 20px;
margin: 0
}

.footer_nav {
background-color: #E48B58;
}

.footer_nav a {
color: white;
}

.footer_nav li {
text-align: center;
}
3 changes: 3 additions & 0 deletions app/assets/stylesheets/reservations.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the Reservations controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
Empty file.
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/
12 changes: 12 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,16 @@ 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
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

def create
@reservation = Reservation.new
@reservation.time = params[:reservation][:time]
@reservation.date = params[:reservation][:date]
@reservation.number_of_guests = params[:reservation][:number_of_guests]

# @reservation.user_id = params[:user_id]
@reservation.user = current_user
# @restaurant = Restaurant.find(@reservation.restaurant_id)
@restaurant = Restaurant.find(params[:restaurant_id])
@reservation.restaurant_id = @restaurant.id







# @restaurant_total_capacity = Restaurant.find(params[:restaurant_id]).capacity
# @restaurant_open = (Restaurant.find(params[:restaurant_id]).opening_hours..Restaurant.find(params[:restaurant_id]).closing_hours).step(1.hour)
# @total_guests = Restaurant.find(params[:restaurant_id]).reservations.where(time: @reservation.time).sum(:number_of_guests)



if @reservation.save
redirect_to restaurants_url
else
render "restaurants/show"
end
end


def edit

end


def update

end




def delete

end



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

def index
@restaurants = Restaurant.all
end

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

def new
@restaurant = Restaurant.new
end

def create
@restaurant = Restaurant.new
@restaurant.name = params[:restaurant][:name]
@restaurant.address = params[:restaurant][:address]
@restaurant.city = params[:restaurant][:city]
@restaurant.price_range = params[:restaurant][:price_range]
@restaurant.summary = params[:restaurant][:summary]
@restaurant.menu = params[:restaurant][:menu]
@restaurant.opening_hours = params[:restaurant][:opening_hours]
@restaurant.closing_hours = params[:restaurant][:closing_hours]
@restaurant.capacity = params[:restaurant][:capacity]
@restaurant.min_party_size = params[:restaurant][:min_party_size]
@restaurant.max_party_size = params[:restaurant][:max_party_size]
@restaurant.picture_url = params[:restaurant][:picture_url]
@restaurant.user = current_user
if @restaurant.save
redirect_to restaurants_url
else
render :new
end
end

def edit
@restaurant = Restaurant.find(params[:id])
end

def update
@restaurant = Restaurant.find(params[:id])
@restaurant.name = params[:restaurant][:name]
@restaurant.address = params[:restaurant][:address]
@restaurant.city = params[:restaurant][:city]
@restaurant.price_range = params[:restaurant][:price_range]
@restaurant.summary = params[:restaurant][:summary]
@restaurant.menu = params[:restaurant][:menu]
@restaurant.opening_hours = params[:restaurant][:opening_hours]
@restaurant.closing_hours = params[:restaurant][:closing_hours]
@restaurant.capacity = params[:restaurant][:capacity]
@restaurant.min_party_size = params[:restaurant][:min_party_size]
@restaurant.max_party_size = params[:restaurant][:max_party_size]
@restaurant.picture_url = params[:restaurant][:picture_url]
if @restaurant.save
redirect_to restaurant_url
else
render :edit
end
end

def destroy
@restaurant = Restaurant.find(params[:id])
@restaurant.destroy
redirect_to restaurants_url
end


end
25 changes: 25 additions & 0 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class SessionsController < ApplicationController
def new
flash[:previous_page] = request.referer
end

def create
user = User.find_by(email: params[:session][:email])
if user && user.authenticate(params[:session][:password])
session[:user_id] = user.id
if flash[:previous_page] && flash[:previous_page] != new_user_url
redirect_to flash[:previous_page], notice: "Logged in!"
else
redirect_to root_path
end
else
flash[:notice] = "Login failed !"
render :new
end
end

def destroy
session[:user_id] = nil
redirect_to restaurants_url, notice: "Logged out!"
end
end
26 changes: 26 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
class UsersController < ApplicationController

def new
@user = User.new
end

def create
@user = User.new
@user.name = params[:user][:name]
@user.email = params[:user][:email]
@user.password = params[:user][:password]


if @user.save
current_user = @user
redirect_to restaurants_url
else
render :new
end
end

def show
@restaurants = current_user.restaurants
end

end
2 changes: 2 additions & 0 deletions app/helpers/reservations_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module ReservationsHelper
end
2 changes: 2 additions & 0 deletions app/helpers/restaurants_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module RestaurantsHelper
end
2 changes: 2 additions & 0 deletions app/helpers/sessions_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module SessionsHelper
end
2 changes: 2 additions & 0 deletions app/helpers/users_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module UsersHelper
end
Loading