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
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
Đường Sỹ Hoàng
VenJob
Commits
8610e37c
Commit
8610e37c
authored
Jan 02, 2020
by
Đường Sỹ Hoàng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update user_login/my_page/my_info_page
parent
e2042cdf
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
78 additions
and
16 deletions
+78
-16
app/controllers/application_controller.rb
+4
-0
app/controllers/users_controller.rb
+11
-0
app/views/devise/registrations/edit.html.erb
+17
-10
app/views/devise/registrations/new.html.erb
+0
-0
app/views/devise/shared/_links.html.erb
+1
-1
app/views/layouts/_header.html.erb
+6
-3
app/views/users/show.html.erb
+27
-0
config/routes.rb
+3
-1
db/migrate/20200102012922_add_reset_password_to_user.rb
+6
-0
db/schema.rb
+3
-1
No files found.
app/controllers/application_controller.rb
View file @
8610e37c
...
@@ -11,4 +11,8 @@ class ApplicationController < ActionController::Base
...
@@ -11,4 +11,8 @@ class ApplicationController < ActionController::Base
devise_parameter_sanitizer
.
permit
:sign_up
,
keys:
added_attrs
devise_parameter_sanitizer
.
permit
:sign_up
,
keys:
added_attrs
devise_parameter_sanitizer
.
permit
:account_update
,
keys:
added_attrs
devise_parameter_sanitizer
.
permit
:account_update
,
keys:
added_attrs
end
end
def
after_sign_in_path_for
(
resource
)
stored_location_for
(
resource
)
||
my_path
end
end
end
app/controllers/users_controller.rb
0 → 100644
View file @
8610e37c
class
UsersController
<
ApplicationController
def
show
@user
=
User
.
find_by
(
params
[
:id
])
end
private
def
user_params
params
.
require
(
:user
).
permit
(
:username
,
:email
,
:password
,
:password_confirmation
)
end
end
app/views/devise/registrations/edit.html.erb
View file @
8610e37c
<
h2>
Edit
<%=
resource_name
.
to_s
.
humanize
%>
</h2
>
<
/br
>
<%=
form_for
(
resource
,
as:
resource_name
,
url:
registration_path
(
resource_name
),
html:
{
method: :put
})
do
|
f
|
%>
<div
class=
"container"
>
<div
class=
"d-flex justify-content-center h-100"
>
<div
class=
"card"
>
<div
class=
"card-header text-center"
>
<h2>
Edit
<%=
resource_name
.
to_s
.
humanize
%>
</h2>
</div>
<%=
form_for
(
resource
,
as:
resource_name
,
url:
registration_path
(
resource_name
),
html:
{
method: :put
})
do
|
f
|
%>
<%=
render
"devise/shared/error_messages"
,
resource:
resource
%>
<%=
render
"devise/shared/error_messages"
,
resource:
resource
%>
<div
class=
"field"
>
<div
class=
"field"
>
...
@@ -31,13 +37,14 @@
...
@@ -31,13 +37,14 @@
<%=
f
.
password_field
:current_password
,
autocomplete:
"current-password"
%>
<%=
f
.
password_field
:current_password
,
autocomplete:
"current-password"
%>
</div>
</div>
<div
class=
"actions"
>
</br>
<%=
f
.
submit
"Update"
%>
</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>
<div
class=
"actions text-center"
>
<%=
f
.
submit
"Update"
,
class:
"btn btn-primary"
%>
</div>
<%
end
%>
</div>
</div>
</div>
<
%=
link_to
"Back"
,
:back
%
>
<
/br
>
app/views/devise/registrations/new.html.erb
View file @
8610e37c
app/views/devise/shared/_links.html.erb
View file @
8610e37c
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<%
end
%>
<%
end
%>
<%-
if
devise_mapping
.
registerable?
&&
controller_name
!=
'registrations'
%>
<%-
if
devise_mapping
.
registerable?
&&
controller_name
!=
'registrations'
%>
<%=
link_to
"Register"
,
new_registration_path
(
resource_name
),
class:
"btn float-right login_btn"
%>
<br
/
>
<%=
link_to
"Register"
,
registration_path
,
class
:" btn float-right login_btn"
%
>
<%
end
%>
<%
end
%>
<%-
if
devise_mapping
.
recoverable?
&&
controller_name
!=
'passwords'
&&
controller_name
!=
'registrations'
%>
<%-
if
devise_mapping
.
recoverable?
&&
controller_name
!=
'passwords'
&&
controller_name
!=
'registrations'
%>
...
...
app/views/layouts/_header.html.erb
View file @
8610e37c
...
@@ -2,15 +2,18 @@
...
@@ -2,15 +2,18 @@
<div
class=
"container"
>
<div
class=
"container"
>
<%=
link_to
image_tag
(
"zigexn_logo.png"
,
id:
"logo"
,
alt:
"Venjob logo"
)
%>
<%=
link_to
image_tag
(
"zigexn_logo.png"
,
id:
"logo"
,
alt:
"Venjob logo"
)
%>
<nav
class=
"navbar navbar-light bg-light"
>
<nav
class=
"navbar navbar-light bg-light"
>
<%
if
user_signed_in?
%>
<%=
link_to
"Log out"
,
destroy_user_session_path
,
method: :delete
,
class:
"btn btn-outline-success"
%>
<button
class=
"btn btn-outline-success"
type=
"button"
>
Favorite
</button>
<button
class=
"btn btn-outline-success"
type=
"button"
>
History
</button>
<%
else
%>
<form
class=
"form-inline"
>
<form
class=
"form-inline"
>
<%=
link_to
"Login"
,
login_path
,
class
:"btn btn-outline-success"
%>
<%=
link_to
"Login"
,
login_path
,
class
:"btn btn-outline-success"
%>
<%=
link_to
"Register"
,
registration_path
,
class
:"btn btn-outline-success"
%>
<%=
link_to
"Register"
,
registration_path
,
class
:"btn btn-outline-success"
%>
<button
class=
"btn btn-outline-success"
type=
"button"
>
Favorite
</button>
<button
class=
"btn btn-outline-success"
type=
"button"
>
Favorite
</button>
<button
class=
"btn btn-outline-success"
type=
"button"
>
History
</button>
<button
class=
"btn btn-outline-success"
type=
"button"
>
History
</button>
<%
if
user_signed_in?
%>
<%=
link_to
"Log out"
,
destroy_user_session_path
,
method: :delete
,
class:
"btn btn-outline-success"
%>
<%
end
%>
</form>
</form>
<%
end
%>
</nav>
</nav>
<%=
link_to
image_tag
(
"banner.jpg"
,
id:
"banner"
,
alt:
"Venjob banner"
)
%>
<%=
link_to
image_tag
(
"banner.jpg"
,
id:
"banner"
,
alt:
"Venjob banner"
)
%>
</div>
</div>
...
...
app/views/users/show.html.erb
0 → 100644
View file @
8610e37c
</br>
<div
class=
"container"
>
<div
class=
"d-flex justify-content-center h-100"
>
<div
class=
"card"
>
<div>
<label>
Email Address:
</label>
<%=
current_user
.
email
%>
</div>
<div>
<label>
Full Name:
</label>
<%=
current_user
.
username
%>
</div>
</br>
<div
class=
"actions"
>
<%=
form_for
(
@user
,
url:
my_path
(
params
[
:id
]))
do
|
f
|
%>
<%=
f
.
submit
"Update"
,
class:
"btn btn-primary"
%>
<%=
f
.
submit
"My Jobs"
,
class:
"btn btn-primary"
%>
<%
end
%>
</div>
</div>
</div>
</div>
</br>
config/routes.rb
View file @
8610e37c
...
@@ -8,7 +8,9 @@ Rails.application.routes.draw do
...
@@ -8,7 +8,9 @@ Rails.application.routes.draw do
as
:user
do
as
:user
do
get
"login"
,
to:
"devise/sessions#new"
get
"login"
,
to:
"devise/sessions#new"
get
"registration/"
,
to:
"devise/registrations#new"
get
"registration/"
,
to:
"devise/registrations#new"
post
"registration.user/"
,
to:
"devise/registrations#create"
put
"registration.user/"
,
to:
"devise/registrations#update"
get
"my/info"
,
to:
"devise/registrations#edit"
get
"my/info"
,
to:
"devise/registrations#edit"
get
"my/
:id
"
,
to:
"users#show"
get
"my/"
,
to:
"users#show"
end
end
end
end
db/migrate/20200102012922_add_reset_password_to_user.rb
0 → 100644
View file @
8610e37c
class
AddResetPasswordTouser
<
ActiveRecord
::
Migration
[
6.0
]
def
change
add_column
:users
,
:reset_password_token
,
:string
add_column
:users
,
:reset_password_sent_at
,
:datetime
end
end
db/schema.rb
View file @
8610e37c
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
#
#
# It's strongly recommended that you check this file into your version control system.
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
20
19_12_26_070737
)
do
ActiveRecord
::
Schema
.
define
(
version:
20
20_01_02_012922
)
do
create_table
"cities"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8"
,
force: :cascade
do
|
t
|
create_table
"cities"
,
options:
"ENGINE=InnoDB DEFAULT CHARSET=utf8"
,
force: :cascade
do
|
t
|
t
.
string
"name"
t
.
string
"name"
...
@@ -100,6 +100,8 @@ ActiveRecord::Schema.define(version: 2019_12_26_070737) do
...
@@ -100,6 +100,8 @@ ActiveRecord::Schema.define(version: 2019_12_26_070737) do
t
.
datetime
"updated_at"
,
precision:
6
,
null:
false
t
.
datetime
"updated_at"
,
precision:
6
,
null:
false
t
.
string
"encrypted_password"
t
.
string
"encrypted_password"
t
.
datetime
"remember_created_at"
t
.
datetime
"remember_created_at"
t
.
string
"reset_password_token"
t
.
datetime
"reset_password_sent_at"
t
.
index
[
"email"
],
name:
"index_users_on_email"
,
unique:
true
t
.
index
[
"email"
],
name:
"index_users_on_email"
,
unique:
true
t
.
index
[
"reset_digest"
],
name:
"index_users_on_reset_digest"
,
unique:
true
t
.
index
[
"reset_digest"
],
name:
"index_users_on_reset_digest"
,
unique:
true
t
.
index
[
"username"
],
name:
"index_users_on_username"
,
unique:
true
t
.
index
[
"username"
],
name:
"index_users_on_username"
,
unique:
true
...
...
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