Commit bcd7ea80 authored by Raphael Alampay's avatar Raphael Alampay

tatlong bibe

parent 0575f2b5
......@@ -3,10 +3,15 @@ class PagesController < ApplicationController
# relative to app/views
# app/views/pages/index.html.erb
render "pages/index.html.erb"
render("pages/index.html.erb")
end
def about
render "pages/about.html.erb"
end
def contact
render "pages/contact.html.erb"
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 @@
</head>
<body>
<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 %>
<h2>Footer</h2>
</body>
</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
root(to: "pages#index")
get("/about", to: "pages#about")
get("/contact", to: "pages#contact")
get("/products", to: "products#index")
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