Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
heymanong
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Raphael Alampay
heymanong
Commits
bcd7ea80
Commit
bcd7ea80
authored
Jun 21, 2016
by
Raphael Alampay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tatlong bibe
parent
0575f2b5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
65 additions
and
2 deletions
+65
-2
pages_controller.rb
app/controllers/pages_controller.rb
+6
-1
products_controller.rb
app/controllers/products_controller.rb
+23
-0
application.html.erb
app/views/layouts/application.html.erb
+7
-0
contact.html.erb
app/views/pages/contact.html.erb
+1
-0
index.html.erb
app/views/products/index.html.erb
+24
-0
routes.rb
config/routes.rb
+4
-1
No files found.
app/controllers/pages_controller.rb
View file @
bcd7ea80
...
@@ -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
app/controllers/products_controller.rb
0 → 100644
View file @
bcd7ea80
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
app/views/layouts/application.html.erb
View file @
bcd7ea80
...
@@ -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>
app/views/pages/contact.html.erb
0 → 100644
View file @
bcd7ea80
<h1>
Contact Page
</h1>
\ No newline at end of file
app/views/products/index.html.erb
0 → 100644
View file @
bcd7ea80
<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
config/routes.rb
View file @
bcd7ea80
...
@@ -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"
)
end
get
(
"/contact"
,
to:
"pages#contact"
)
get
(
"/products"
,
to:
"products#index"
)
end
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment