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
Jérome Perrin
gitlab-ce
Commits
d793bceb
Commit
d793bceb
authored
Dec 02, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5733 from bke-drewb/issue-5716
Issue 5716 - Allow removal of avatar
parents
aa69e29e
b08608b2
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
66 additions
and
4 deletions
+66
-4
CHANGELOG
CHANGELOG
+1
-0
app/assets/stylesheets/sections/profile.scss
app/assets/stylesheets/sections/profile.scss
+4
-0
app/controllers/profiles/avatars_controller.rb
app/controllers/profiles/avatars_controller.rb
+11
-0
app/views/profiles/show.html.haml
app/views/profiles/show.html.haml
+11
-4
config/routes.rb
config/routes.rb
+1
-0
features/profile/profile.feature
features/profile/profile.feature
+8
-0
features/steps/profile/profile.rb
features/steps/profile/profile.rb
+23
-0
spec/routing/routing_spec.rb
spec/routing/routing_spec.rb
+7
-0
No files found.
CHANGELOG
View file @
d793bceb
...
@@ -6,6 +6,7 @@ v 6.4.0
...
@@ -6,6 +6,7 @@ v 6.4.0
- Minimal password length increased to 8 symbols
- Minimal password length increased to 8 symbols
- Side-by-side diff view (Steven Thonus)
- Side-by-side diff view (Steven Thonus)
- Internal projects (Jason Hollingsworth)
- Internal projects (Jason Hollingsworth)
- Allow removal of avatar (Drew Blessing)
v 6.3.0
v 6.3.0
- API for adding gitlab-ci service
- API for adding gitlab-ci service
...
...
app/assets/stylesheets/sections/profile.scss
View file @
d793bceb
...
@@ -42,3 +42,7 @@
...
@@ -42,3 +42,7 @@
margin-right
:
12px
;
margin-right
:
12px
;
}
}
.remove_avatar
{
margin-top
:
10px
;
}
app/controllers/profiles/avatars_controller.rb
0 → 100644
View file @
d793bceb
class
Profiles::AvatarsController
<
ApplicationController
layout
"profile"
def
destroy
@user
=
current_user
@user
.
remove_avatar!
@user
.
save
redirect_to
profile_path
end
end
app/views/profiles/show.html.haml
View file @
d793bceb
...
@@ -59,9 +59,14 @@
...
@@ -59,9 +59,14 @@
.clearfix
.clearfix
.profile-avatar-form-option
.profile-avatar-form-option
%p
.light
%p
.light
You can upload an avatar here
-
if
@user
.
avatar?
%br
You can change your avatar here
or change it at
#{
link_to
"gravatar.com"
,
"http://gravatar.com"
}
%br
or remove the current avatar to revert to
#{
link_to
"gravatar.com"
,
"http://gravatar.com"
}
-
else
You can upload an avatar here
%br
or change it at
#{
link_to
"gravatar.com"
,
"http://gravatar.com"
}
%hr
%hr
%a
.choose-btn.btn.btn-small.js-choose-user-avatar-button
%a
.choose-btn.btn.btn-small.js-choose-user-avatar-button
%i
.icon-paper-clip
%i
.icon-paper-clip
...
@@ -70,6 +75,8 @@
...
@@ -70,6 +75,8 @@
%span
.file_name.js-avatar-filename
File name...
%span
.file_name.js-avatar-filename
File name...
=
f
.
file_field
:avatar
,
class:
"js-user-avatar-input hide"
=
f
.
file_field
:avatar
,
class:
"js-user-avatar-input hide"
%span
.help-block
The maximum file size allowed is 100KB.
%span
.help-block
The maximum file size allowed is 100KB.
-
if
@user
.
avatar?
=
link_to
'Remove avatar'
,
profile_avatar_path
,
confirm:
"Avatar will be removed. Are you sure?"
,
method: :delete
,
class:
"btn btn-remove remove_avatar"
.form-actions
.form-actions
=
f
.
submit
'Save changes'
,
class:
"btn btn-save"
=
f
.
submit
'Save changes'
,
class:
"btn btn-save"
\ No newline at end of file
config/routes.rb
View file @
d793bceb
...
@@ -127,6 +127,7 @@ Gitlab::Application.routes.draw do
...
@@ -127,6 +127,7 @@ Gitlab::Application.routes.draw do
delete
:leave
delete
:leave
end
end
end
end
resource
:avatar
,
only:
[
:destroy
]
end
end
end
end
...
...
features/profile/profile.feature
View file @
d793bceb
...
@@ -26,6 +26,14 @@ Feature: Profile
...
@@ -26,6 +26,14 @@ Feature: Profile
Given
I visit profile page
Given
I visit profile page
Then
I change my avatar
Then
I change my avatar
And
I should see new avatar
And
I should see new avatar
And
I should see the
"Remove avatar"
button
Scenario
:
I
remove my avatar
Given
I visit profile page
And
I have an avatar
When
I remove my avatar
Then
I should see my gravatar
And
I should not see the
"Remove avatar"
button
Scenario
:
My password is expired
Scenario
:
My password is expired
Given
my password is expired
Given
my password is expired
...
...
features/steps/profile/profile.rb
View file @
d793bceb
...
@@ -31,6 +31,29 @@ class Profile < Spinach::FeatureSteps
...
@@ -31,6 +31,29 @@ class Profile < Spinach::FeatureSteps
@user
.
avatar
.
url
.
should
==
"/uploads/user/avatar/
#{
@user
.
id
}
/gitlab_logo.png"
@user
.
avatar
.
url
.
should
==
"/uploads/user/avatar/
#{
@user
.
id
}
/gitlab_logo.png"
end
end
step
'I should see the "Remove avatar" button'
do
page
.
should
have_link
(
"Remove avatar"
)
end
step
'I have an avatar'
do
attach_file
(
:user_avatar
,
File
.
join
(
Rails
.
root
,
'public'
,
'gitlab_logo.png'
))
click_button
"Save changes"
@user
.
reload
end
step
'I remove my avatar'
do
click_link
"Remove avatar"
@user
.
reload
end
step
'I should see my gravatar'
do
@user
.
avatar?
.
should
be_false
end
step
'I should not see the "Remove avatar" button'
do
page
.
should_not
have_link
(
"Remove avatar"
)
end
step
'I try change my password w/o old one'
do
step
'I try change my password w/o old one'
do
within
'.update-password'
do
within
'.update-password'
do
fill_in
"user_password"
,
with:
"22233344"
fill_in
"user_password"
,
with:
"22233344"
...
...
spec/routing/routing_spec.rb
View file @
d793bceb
...
@@ -185,6 +185,13 @@ describe Profiles::KeysController, "routing" do
...
@@ -185,6 +185,13 @@ describe Profiles::KeysController, "routing" do
end
end
end
end
# profile_avatar DELETE /profile/avatar(.:format) profiles/avatars#destroy
describe
Profiles
::
AvatarsController
,
"routing"
do
it
"to #destroy"
do
delete
(
"/profile/avatar"
).
should
route_to
(
'profiles/avatars#destroy'
)
end
end
# dashboard GET /dashboard(.:format) dashboard#show
# dashboard GET /dashboard(.:format) dashboard#show
# dashboard_issues GET /dashboard/issues(.:format) dashboard#issues
# dashboard_issues GET /dashboard/issues(.:format) dashboard#issues
# dashboard_merge_requests GET /dashboard/merge_requests(.:format) dashboard#merge_requests
# dashboard_merge_requests GET /dashboard/merge_requests(.:format) dashboard#merge_requests
...
...
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