Commit bcd7ea80 authored by Raphael Alampay's avatar Raphael Alampay

tatlong bibe

parent 0575f2b5
...@@ -3,10 +3,15 @@ class PagesController < ApplicationController ...@@ -3,10 +3,15 @@ class PagesController < ApplicationController
# relative to app/views # relative to app/views
# app/views/pages/index.html.erb # app/views/pages/index.html.erb
render "pages/index.html.erb" render("pages/index.html.erb")
end end
def about def about
render "pages/about.html.erb" render "pages/about.html.erb"
end end
def contact
render "pages/contact.html.erb"
end
end end
\ No newline at end of file
class ProductsController < ApplicationController
def index
@products = [
{
name: "Bibe Wholesale",
image_url: "https://i.ytimg.com/vi/MGRAmQrpBKU/maxresdefault.jpg",
cost: 4000.00
},
{
name: "Cats",
image_url: "https://i.ytimg.com/vi/tntOCGkgt98/maxresdefault.jpg",
cost: 2000.00
},
{
name: "Dogs",
image_url: "https://i.kinja-img.com/gawker-media/image/upload/xqkbwkexcl7udc5va7pn.jpg",
cost: 10000.00
},
]
render "products/index.html.erb"
end
end
\ No newline at end of file
...@@ -7,6 +7,13 @@ ...@@ -7,6 +7,13 @@
</head> </head>
<body> <body>
<h1>MY HEADER!!!!</h1> <h1>MY HEADER!!!!</h1>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/about">About</a></li>
<li><a href="/contact">Contact</a></li>
<li><a href="/products">Products</a></li>
</ul>
<%= yield %> <%= yield %>
<h2>Footer</h2>
</body> </body>
</html> </html>
<h1>Contact Page</h1>
\ No newline at end of file
<h1>Hey Manong's Awesome Products!</h1>
<table>
<thead>
<tr>
<th>Name</th>
<th>Picture</th>
<th>Cost</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% @products.each do |product| %>
<tr>
<td><%= product[:name] %></td>
<td><img height="200" width="200" src="<%= product[:image_url] %>"></td>
<td><%= product[:cost] %></td>
<td>
<button>Buy Now!</button>
</td>
</tr>
<% end %>
</tbody>
</table>
\ No newline at end of file
...@@ -5,4 +5,7 @@ Rails.application.routes.draw do ...@@ -5,4 +5,7 @@ Rails.application.routes.draw do
root(to: "pages#index") root(to: "pages#index")
get("/about", to: "pages#about") get("/about", to: "pages#about")
get("/contact", to: "pages#contact")
get("/products", to: "products#index")
end end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment