Skip to content

Commit

Permalink
Adding Basic Welcome & Contact Us Pages with Links
Browse files Browse the repository at this point in the history
  • Loading branch information
LiorKGOW committed Dec 21, 2022
1 parent f069609 commit fff3567
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
20 changes: 19 additions & 1 deletion app/controllers/guitars_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,25 @@ def index

def guitar_gallery; end

def welcome_page; end
def welcome_page
param = params['country']
@phone_number = "111"

if param == "us" || param == "ca"
@phone_number = "(800) 555-6789"
elsif param == "uk"
@phone_number = "(020) 7946-1234"
else
@phone_number = "+972 (052) 654-3210"

# puts(@phone_number)
end
end

def contact
# redirect_to(:action => 'contact_us')
render('contact_us')
end
end

# rubocop:enable Metrics/MethodLength
9 changes: 9 additions & 0 deletions app/views/guitars/contact_us.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<h1>Contact</h1>

<p>We are always happy to hear from our customers !</p>

Phone: <% @phone_number %>

<p>Press: <a href="mailto:[email protected]">[email protected]</a></p>

<%= link_to("Go to Welcome Page", {:action => 'welcome_page'}) %>
4 changes: 3 additions & 1 deletion app/views/guitars/welcome_page.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
<h1>Guitars#welcomePage</h1>
<h1>Welcome to My Guitar Store</h1>

<%= link_to("Go to Contact Us", {:action => 'contact'}) %>
3 changes: 3 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
get 'guitars/guitar_gallery'
get 'guitars/welcome_page'

# Challenge route:
get 'guitars/contact'

# route to get the mock data:
get '/guitars', to: 'guitars#index'

Expand Down

0 comments on commit fff3567

Please sign in to comment.