Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VeNJOB
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
Nguyen Ngoc Nghia
VeNJOB
Commits
eca18ec0
Commit
eca18ec0
authored
Dec 10, 2019
by
nnnghia98
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edit my page
parent
77947670
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
15 deletions
+50
-15
app/controllers/application_controller.rb
+2
-1
app/controllers/users/my_page_controller.rb
+4
-0
app/controllers/users/registrations_controller.rb
+14
-0
app/views/layouts/_header.html.erb
+1
-1
app/views/users/my_page/index.html.erb
+12
-0
app/views/users/registrations/edit.html.erb
+16
-13
config/routes.rb
+1
-0
No files found.
app/controllers/application_controller.rb
View file @
eca18ec0
...
...
@@ -4,10 +4,11 @@ class ApplicationController < ActionController::Base
before_action
:configure_permitted_parameters
,
if: :devise_controller?
protected
def
configure_permitted_parameters
added_attrs
=
[
:username
,
:email
,
:password
,
:password_confirmation
,
:remember_me
]
devise_parameter_sanitizer
.
permit
:sign_up
,
keys:
added_attrs
devise_parameter_sanitizer
.
permit
:account_update
,
keys:
added_attrs
end
def
after_sign_in_path_for
(
resource
)
...
...
app/controllers/users/my_page_controller.rb
0 → 100644
View file @
eca18ec0
class
Users
::
MyPageController
<
ApplicationController
def
index
end
end
app/controllers/users/registrations_controller.rb
0 → 100644
View file @
eca18ec0
class
Users
::
RegistrationsController
<
Devise
::
RegistrationsController
before_action
:sign_up_params
,
only: :create
before_action
:account_update_params
,
only: :update
private
def
sign_up_params
params
.
require
(
:user
).
permit
(
:first_name
,
:last_name
,
:email
,
:password
,
:password_confirmation
)
end
def
account_update_params
params
.
require
(
:user
).
permit
(
:first_name
,
:last_name
,
:email
,
:password
,
:password_confirmation
,
:current_password
)
end
end
app/views/layouts/_header.html.erb
View file @
eca18ec0
...
...
@@ -6,7 +6,7 @@
<ul
class=
"list"
>
<%
if
user_signed_in?
%>
Logged in as
<strong>
<%=
current_user
.
email
%>
</strong>
<li
class=
"list-inline-item"
></li>
<%=
link_to
"My Page"
,
"#"
%>
</li>
<li
class=
"list-inline-item"
></li>
<%=
link_to
"My Page"
,
my_path
%>
</li>
<li
class=
"list-inline-item"
></li>
<%=
link_to
"Logout"
,
destroy_user_session_path
,
method: :delete
%>
</li>
<%
else
%>
<li
class=
"list-inline-item"
>
<%=
link_to
"Login"
,
new_user_session_path
%>
</li>
...
...
app/views/users/my_page/index.html.erb
0 → 100644
View file @
eca18ec0
<h1>
My Page
</h1>
<div
class=
"jumbotron"
>
<h3>
Email:
<%=
current_user
.
email
%>
</h3>
<h3>
Full name:
<%=
current_user
.
first_name
%>
<%=
current_user
.
last_name
%>
</h3>
<h3>
My CV
</h3>
</div>
<div
class=
"container"
>
<%=
link_to
"Update"
,
edit_user_registration_path
,
class:
"btn btn-lg btn-primary"
%>
<%=
link_to
"My jobs"
,
"#"
,
class:
"btn btn-lg btn-primary"
%>
</div>
app/views/users/registrations/edit.html.erb
View file @
eca18ec0
<h
2>
Edit
<%=
resource_name
.
to_s
.
humanize
%>
</h2
>
<h
1>
My Page
</h1
>
<%=
form_for
(
resource
,
as:
resource_name
,
url:
registration_path
(
resource_name
),
html:
{
method: :put
})
do
|
f
|
%>
<%=
render
"users/shared/error_messages"
,
resource:
resource
%>
<div
class=
"form-group"
>
<%=
f
.
label
:email
%>
<br/>
<%=
f
.
email_field
:email
,
autofocus:
true
,
autocomplete:
"email"
,
class:
"form-control"
%>
<%=
f
.
email_field
:email
,
autofocus:
true
,
class:
"form-control"
%>
</div>
<%
if
devise_mapping
.
confirmable?
&&
resource
.
pending_reconfirmation?
%>
...
...
@@ -22,9 +22,14 @@
<%=
f
.
text_field
:last_name
,
class:
"form-control"
%>
</div>
<div
class=
"field"
>
<%=
f
.
label
:cv_path
%>
<br/>
<input
type=
"file"
class=
"form-control-file"
id=
"cv_path"
>
</div><br>
<div
class=
"form-group"
>
<%=
f
.
label
:password
%>
<i>
(leave blank if you don't want to change it)
</i><br/>
<%=
f
.
password_field
:password
,
autocomplete:
"
new-password
"
,
class:
"form-control"
%>
<%=
f
.
password_field
:password
,
autocomplete:
"
off
"
,
class:
"form-control"
%>
<%
if
@minimum_password_length
%>
<br/>
<em>
<%=
@minimum_password_length
%>
characters minimum
</em>
...
...
@@ -33,21 +38,19 @@
<div
class=
"form-group"
>
<%=
f
.
label
:password_confirmation
%>
<br/>
<%=
f
.
password_field
:password_confirmation
,
autocomplete:
"
new-password
"
,
class:
"form-control"
%>
<%=
f
.
password_field
:password_confirmation
,
autocomplete:
"
off
"
,
class:
"form-control"
%>
</div>
<div
class=
"f
ield
"
>
<%=
f
.
label
:c
v_path
%>
<br
/>
<
input
type=
"file"
class=
"form-control-file"
id=
"cv_path"
>
</div>
<br>
<div
class=
"f
orm-group
"
>
<%=
f
.
label
:c
urrent_password
%>
<i>
(we need your current password to confirm your changes)
</i><br
/>
<
%=
f
.
password_field
:current_password
,
autocomplete:
"off"
,
class:
"form-control"
%
>
</div>
<div
class=
"actions"
>
<%=
f
.
submit
"Update"
%>
<%=
f
.
submit
"Update"
,
class:
"btn btn-lg btn-primary"
%>
</div>
<%
end
%>
<h3>
Cancel my account
</h3>
<p>
Unhappy?
<%=
button_to
"Cancel my account"
,
registration_path
(
resource_name
),
data:
{
confirm:
"Are you sure?"
},
method: :delete
%>
</p>
<br>
<%=
button_to
"Delete my account"
,
registration_path
(
resource_name
),
data:
{
confirm:
"Are you sure?"
},
class:
"btn btn-danger"
,
method: :delete
%>
<%=
link_to
"Back"
,
:back
%>
config/routes.rb
View file @
eca18ec0
...
...
@@ -6,4 +6,5 @@ Rails.application.routes.draw do
devise_for
:users
root
"static_pages#index"
get
"static_pages/index"
get
"my"
,
to:
"users/my_page#index"
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