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
1
Merge Requests
1
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
Tô Ngọc Ánh
sample_app
Commits
827cff4a
Commit
827cff4a
authored
Jul 02, 2020
by
Tô Ngọc Ánh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finsh user signup
parent
6f3c19a3
Pipeline
#667
canceled with stages
in 0 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
2 deletions
+40
-2
app/assets/stylesheets/custom.css.scss
+14
-0
app/controllers/users_controller.rb
+9
-2
app/views/layouts/application.html.erb
+3
-0
app/views/shared/_error_messages.html.erb
+13
-0
app/views/users/new.html.erb
+1
-0
No files found.
app/assets/stylesheets/custom.css.scss
View file @
827cff4a
...
...
@@ -160,4 +160,17 @@ input, textarea, select, .uneditable-input {
input
{
height
:
auto
!
important
;
}
#error_explanation
{
color
:
#f00
;
ul
{
list-style
:
none
;
margin
:
0
0
18px
0
;
}
}
.field_with_errors
{
@extend
.control-group
;
@extend
.error
;
}
\ No newline at end of file
app/controllers/users_controller.rb
View file @
827cff4a
...
...
@@ -8,11 +8,18 @@ class UsersController < ApplicationController
end
def
create
@user
=
User
.
new
(
params
[
:user
]
)
@user
=
User
.
new
(
user_params
)
if
@user
.
save
#Handle a successful save
flash
[
:success
]
=
"Welcome to the Sample App"
redirect_to
@user
else
render
'new'
end
end
private
def
user_params
params
.
require
(
:user
).
permit
(
:name
,
:email
,
:password
,
:password_confirmation
)
end
end
app/views/layouts/application.html.erb
View file @
827cff4a
...
...
@@ -13,6 +13,9 @@
<body>
<%=
render
'layouts/header'
%>
<div
class=
"container"
>
<%
flash
.
each
do
|
key
,
value
|
%>
<div
class=
"alert alert-
<%=
key
%>
"
>
<%=
value
%>
</div>
<%
end
%>
<%=
yield
%>
<%=
render
'layouts/footer'
%>
<%=
debug
(
params
)
if
Rails
.
env
.
development?
%>
...
...
app/views/shared/_error_messages.html.erb
0 → 100644
View file @
827cff4a
<%
if
@user
.
errors
.
any?
%>
<div
id=
"error_explanation"
>
<div
class=
"alert alert-error"
>
The form contains
<%=
pluralize
(
@user
.
errors
.
count
,
"error"
)
%>
.
</div>
<ul>
<%
@user
.
errors
.
full_messages
.
each
do
|
msg
|
%>
<li>
*
<%=
msg
%>
</li>
<%
end
%>
</ul>
</div>
<%
end
%>
\ No newline at end of file
app/views/users/new.html.erb
View file @
827cff4a
...
...
@@ -4,6 +4,7 @@
<div
class=
"row"
>
<div
class=
"span6 offset3"
>
<%=
form_for
(
@user
)
do
|
f
|
%>
<%=
render
'shared/error_messages'
%>
<%=
f
.
label
:name
%>
<%=
f
.
text_field
:name
%>
...
...
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