Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sample_app
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mai Hoang Thai Ha
sample_app
Commits
aec08413
Commit
aec08413
authored
Jun 01, 2021
by
Mai Hoang Thai Ha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish static pages
parent
17aaa6ab
Pipeline
#1201
failed with stages
in 0 seconds
Changes
8
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
66 additions
and
18 deletions
+66
-18
app/controllers/static_pages_controller.rb
+3
-0
app/views/layouts/application.html.erb
+1
-1
app/views/static_pages/about.html.erb
+16
-0
app/views/static_pages/contact.html.erb
+6
-0
app/views/static_pages/help.html.erb
+11
-5
app/views/static_pages/home.html.erb
+8
-10
config/routes.rb
+3
-2
test/controllers/static_pages_controller_test.rb
+18
-0
No files found.
app/controllers/static_pages_controller.rb
View file @
aec08413
...
...
@@ -4,4 +4,7 @@ class StaticPagesController < ApplicationController
def
help
end
def
about
end
end
app/views/layouts/application.html.erb
View file @
aec08413
<!DOCTYPE html>
<html>
<head>
<title>
Sample
App
</title>
<title>
<%=
yield
(
:title
)
%>
| Ruby on Rails Tutorial Sample
App
</title>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1"
>
<%=
csrf_meta_tags
%>
<%=
csp_meta_tag
%>
...
...
app/views/static_pages/about.html.erb
0 → 100644
View file @
aec08413
<%
provide
(
:title
,
"About"
)
%>
<h1>
About
</h1>
<p>
The
<a
href=
"https://www.railstutorial.org/"
><em>
Ruby on Rails Tutorial
</em></a
>
, part of the
<a
href=
"https://www.learnenough.com/"
>
Learn Enough
</a>
family of
tutorials, is a
<a
href=
"https://www.railstutorial.org/book"
>
book
</a>
and
<a
href=
"https://screencasts.railstutorial.org/"
>
screencast series
</a>
to teach web development with
<a
href=
"https://rubyonrails.org/"
>
Ruby on Rails
</a>
. This is the sample
app for the tutorial.
</p>
\ No newline at end of file
app/views/static_pages/contact.html.erb
0 → 100644
View file @
aec08413
<%
provide
(
:title
,
"Contact"
)
%>
<h1>
Contact
</h1>
<p>
Contact the Ruby on Rails Tutorial about the sample app at the
<a
href=
"https://www.railstutorial.org/contact"
>
contact page
</a>
.
</p>
app/views/static_pages/help.html.erb
View file @
aec08413
<h1>
StaticPages#help
</h1>
<p>
Find me in app/views/static_pages/help.html.erb
</p>
<%
provide
(
:title
,
"Help"
)
%>
<div
style=
"position: fixed; top: 10px; right: 100px"
>
hehe
</div>
<h1>
Help
</h1>
<p>
Get help on the Ruby on Rails Tutorial at the
<a
href=
"https://www.railstutorial.org/help"
>
Rails Tutorial help page
</a>
.
To get help on this sample app, see the
<a
href=
"https://www.railstutorial.org/book"
><em>
Ruby on Rails Tutorial
</em>
book
</a
>
.
</p>
\ No newline at end of file
app/views/static_pages/home.html.erb
View file @
aec08413
<
h1>
StaticPages#home
</h1
>
<
%
provide
(
:title
,
"Home"
)
%
>
<ul>
<li>
day la dong 1
</li>
<li>
day la dong 2
</li>
<li>
day la dong 3
</li>
<li>
day la dong 4
</li>
</ul>
<a
href=
"https://fb.com/hafmai"
>
Hà
</a>
<p>
Find me in app/views/static_pages/home.html.erb
</p>
<h1>
Sample App
</h1>
<p>
This is the home page for the
<a
href=
"https://www.railstutorial.org/"
>
Ruby on Rails Tutorial
</a>
sample application.
</p>
\ No newline at end of file
config/routes.rb
View file @
aec08413
Rails
.
application
.
routes
.
draw
do
root
'static_pages#home'
get
'static_pages/home'
get
'static_pages/help'
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
root
'application#hello
'
get
'static_pages/about'
get
'static_pages/contact
'
end
test/controllers/static_pages_controller_test.rb
View file @
aec08413
...
...
@@ -4,13 +4,31 @@ require "test_helper"
class
StaticPagesControllerTest
<
ActionDispatch
::
IntegrationTest
def
setup
@base_title
=
"Ruby on Rails Tutorial Sample App"
end
test
"should get home"
do
get
static_pages_home_url
assert_response
:success
assert_select
"title"
,
"Home |
#{
@base_title
}
"
end
test
"should get help"
do
get
static_pages_help_url
assert_response
:success
assert_select
"title"
,
"Help |
#{
@base_title
}
"
end
test
"should get about"
do
get
static_pages_about_url
assert_response
:success
assert_select
"title"
,
"About |
#{
@base_title
}
"
end
test
"should get contact"
do
get
static_pages_contact_url
assert_response
:success
assert_select
"title"
,
"Contact |
#{
@base_title
}
"
end
end
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