From 5e4359d1877a5f75b04e90237ab08c2fbdeeb40c Mon Sep 17 00:00:00 2001 From: Fabio Date: Fri, 2 Jul 2021 14:54:38 +0200 Subject: [PATCH 1/2] price branch --- app.rb | 8 ++++++++ views/confirm.erb | 1 + views/spaces/booking.erb | 13 ++++++++----- 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 views/confirm.erb diff --git a/app.rb b/app.rb index 025fe82..be9bd7e 100644 --- a/app.rb +++ b/app.rb @@ -103,9 +103,17 @@ class MakersBnB < Sinatra::Base @id = User.find(session[:user_id]) @user = User.find(params[:book]) @booking = Space.find(params[:book]) + + session[:space] = @booking.price erb :"spaces/booking" end + post '/spaces/:id/booking/confirm' do + @space = Space.find(params[:book]) + erb :"spaces/booking" + end + + # start the server if ruby file executed directly run! if app_file == $0 diff --git a/views/confirm.erb b/views/confirm.erb new file mode 100644 index 0000000..aad92f4 --- /dev/null +++ b/views/confirm.erb @@ -0,0 +1 @@ +<%= @price%> \ No newline at end of file diff --git a/views/spaces/booking.erb b/views/spaces/booking.erb index 010354a..02a43ae 100644 --- a/views/spaces/booking.erb +++ b/views/spaces/booking.erb @@ -11,15 +11,15 @@ -
+
@@ -28,6 +28,9 @@

<< Changed your mind?

+<% if params[:available] %> + <%= @space %> +<% end %>