Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
4c3412c3
Commit
4c3412c3
authored
Feb 28, 2017
by
Mark Fletcher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update profiles/account view to display new username
parent
7733f285
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
12 deletions
+26
-12
app/controllers/profiles_controller.rb
app/controllers/profiles_controller.rb
+7
-4
app/views/profiles/accounts/show.html.haml
app/views/profiles/accounts/show.html.haml
+1
-1
app/views/profiles/update_username.js.haml
app/views/profiles/update_username.js.haml
+0
-7
changelogs/unreleased/28655-current-path-text-is-not-updated-after-setting-the-new-username.yml
...th-text-is-not-updated-after-setting-the-new-username.yml
+4
-0
spec/features/profile_spec.rb
spec/features/profile_spec.rb
+14
-0
No files found.
app/controllers/profiles_controller.rb
View file @
4c3412c3
...
...
@@ -47,11 +47,14 @@ class ProfilesController < Profiles::ApplicationController
end
def
update_username
@user
.
update_attributes
(
username:
user_params
[
:username
])
respond_to
do
|
format
|
format
.
js
if
@user
.
update_attributes
(
username:
user_params
[
:username
])
options
=
{
notice:
"Username successfully changed"
}
else
message
=
@user
.
errors
.
full_messages
.
uniq
.
join
(
'. '
)
options
=
{
alert:
"Username change failed -
#{
message
}
"
}
end
redirect_back_or_default
(
default:
{
action:
'show'
},
options:
options
)
end
private
...
...
app/views/profiles/accounts/show.html.haml
View file @
4c3412c3
...
...
@@ -93,7 +93,7 @@
%p
Changing your username will change path to all personal projects!
.col-lg-9
=
form_for
@user
,
url:
update_username_profile_path
,
method: :put
,
remote:
true
,
html:
{
class:
"update-username"
}
do
|
f
|
=
form_for
@user
,
url:
update_username_profile_path
,
method: :put
,
html:
{
class:
"update-username"
}
do
|
f
|
.form-group
=
f
.
label
:username
,
"Path"
,
class:
"label-light"
.input-group
...
...
app/views/profiles/update_username.js.haml
deleted
100644 → 0
View file @
7733f285
-
if
@user
.
valid?
:plain
new Flash("Username successfully changed", "notice")
-
else
-
error
=
@user
.
errors
.
full_messages
.
first
:plain
new Flash("Username change failed -
#{
escape_javascript
error
.
html_safe
}
", "alert")
changelogs/unreleased/28655-current-path-text-is-not-updated-after-setting-the-new-username.yml
0 → 100644
View file @
4c3412c3
---
title
:
Update account view to display new username
merge_request
:
author
:
spec/features/profile_spec.rb
View file @
4c3412c3
...
...
@@ -61,4 +61,18 @@ describe 'Profile account page', feature: true do
expect
(
find
(
'#incoming-email-token'
).
value
).
not_to
eq
(
previous_token
)
end
end
describe
'when I change my username'
do
before
do
visit
profile_account_path
end
it
'changes my username'
do
fill_in
'user_username'
,
with:
'new-username'
click_button
(
'Update username'
)
expect
(
page
).
to
have_content
(
'new-username'
)
end
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