BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
78588cfc
Commit
78588cfc
authored
Feb 16, 2016
by
Johann Pardanaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve user experience for avatar cropping
- Avoid incomprehensible errors on non-integer cropping values - Set the default cropping area to 80%
parent
3ca16ec2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
profile.js.coffee
app/assets/javascripts/profile.js.coffee
+0
-1
avatar_uploader.rb
app/uploaders/avatar_uploader.rb
+8
-1
No files found.
app/assets/javascripts/profile.js.coffee
View file @
78588cfc
...
...
@@ -31,7 +31,6 @@ class @Profile
setTimeout
(
->
# The cropper must be asynchronously initialized
$modalCropImg
.
cropper
aspectRatio
:
1
autoCropArea
:
1
modal
:
false
scalable
:
false
rotatable
:
false
...
...
app/uploaders/avatar_uploader.rb
View file @
78588cfc
...
...
@@ -10,8 +10,15 @@ class AvatarUploader < CarrierWave::Uploader::Base
process
:cropper
def
is_integer?
string
true
if
Integer
(
string
)
rescue
false
end
def
cropper
if
model
.
instance_of?
User
is_compliant
=
model
.
kind_of?
(
User
)
&&
is_integer?
(
model
.
avatar_crop_size
)
is_compliant
=
is_compliant
&&
is_integer?
(
model
.
avatar_crop_x
)
&&
is_integer?
(
model
.
avatar_crop_y
)
if
is_compliant
manipulate!
do
|
img
|
img
.
crop
"
#{
model
.
avatar_crop_size
}
x
#{
model
.
avatar_crop_size
}
+
#{
model
.
avatar_crop_x
}
+
#{
model
.
avatar_crop_y
}
"
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