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
73b919d4
Commit
73b919d4
authored
Jun 02, 2021
by
Mai Hoang Thai Ha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a full_title helper
parent
63e83b0d
Pipeline
#1226
failed with stages
in 0 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
5 deletions
+14
-5
app/helpers/application_helper.rb
+11
-1
app/views/layouts/application.html.erb
+2
-2
app/views/static_pages/home.html.erb
+0
-1
test/controllers/static_pages_controller_test.rb
+1
-1
No files found.
app/helpers/application_helper.rb
View file @
73b919d4
module
ApplicationHelper
module
ApplicationHelper
end
# Returns the full title on a per-page basis
def
full_title
(
page_title
=
''
)
base_title
=
'Ruby on Rails Tutorial Sample App'
if
page_title
.
empty?
base_title
else
page_title
+
" | "
+
base_title
end
end
end
\ No newline at end of file
app/views/layouts/application.html.erb
View file @
73b919d4
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<html>
<head>
<head>
<title>
<%=
yield
(
:title
)
%>
| Ruby on Rails Tutorial Sample App
</title>
<title>
<%=
full_title
(
yield
(
:title
))
%>
</title>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1"
>
<meta
charset=
"utf-8"
name=
"viewport"
content=
"width=device-width,initial-scale=1"
>
<%=
csrf_meta_tags
%>
<%=
csrf_meta_tags
%>
<%=
csp_meta_tag
%>
<%=
csp_meta_tag
%>
...
...
app/views/static_pages/home.html.erb
View file @
73b919d4
<%
provide
(
:title
,
"Home"
)
%>
<h1>
Sample App
</h1>
<h1>
Sample App
</h1>
<p>
<p>
...
...
test/controllers/static_pages_controller_test.rb
View file @
73b919d4
...
@@ -11,7 +11,7 @@ class StaticPagesControllerTest < ActionDispatch::IntegrationTest
...
@@ -11,7 +11,7 @@ class StaticPagesControllerTest < ActionDispatch::IntegrationTest
test
"should get home"
do
test
"should get home"
do
get
static_pages_home_url
get
static_pages_home_url
assert_response
:success
assert_response
:success
assert_select
"title"
,
"
Home |
#{
@base_title
}
"
assert_select
"title"
,
"
#{
@base_title
}
"
end
end
test
"should get help"
do
test
"should get help"
do
...
...
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