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
Boxiang Sun
gitlab-ce
Commits
9ed1cbf2
Commit
9ed1cbf2
authored
Mar 17, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show filename after setting a cropped image
parent
358545b8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
app/assets/javascripts/gl_crop.js.coffee
app/assets/javascripts/gl_crop.js.coffee
+13
-4
No files found.
app/assets/javascripts/gl_crop.js.coffee
View file @
9ed1cbf2
...
@@ -5,9 +5,9 @@ class GitLabCrop
...
@@ -5,9 +5,9 @@ class GitLabCrop
# Set defaults
# Set defaults
{
{
@
filename
@
previewImage
=
$
(
'.avatar-image .avatar'
)
@
form
=
@
fileInput
.
parents
(
'form'
)
@
form
=
@
fileInput
.
parents
(
'form'
)
@
filename
=
'.js-avatar-filename'
@
previewImage
=
$
(
'.avatar-image .avatar'
)
@
modalCrop
=
'.modal-profile-crop'
@
modalCrop
=
'.modal-profile-crop'
@
exportWidth
=
200
@
exportWidth
=
200
@
exportHeight
=
200
@
exportHeight
=
200
...
@@ -20,13 +20,20 @@ class GitLabCrop
...
@@ -20,13 +20,20 @@ class GitLabCrop
@
uploadImageBtn
=
$
(
'.js-upload-user-avatar'
)
@
uploadImageBtn
=
$
(
'.js-upload-user-avatar'
)
}
=
opts
}
=
opts
# Ensure @modalCrop is a jQuery Object
# Ensure needed elements are jquery objects
@
modalCrop
=
$
(
@
modalCrop
)
@
filename
=
if
_
.
isString
(
@
filename
)
then
@
$
(
@
filename
)
else
@
filename
# Modal usually is outside the wrapper element
@
modalCrop
=
if
_
.
isString
(
@
modalCrop
)
then
$
(
@
modalCrop
)
else
@
modalCrop
@
modalCropImg
=
$
(
'.modal-profile-crop-image'
)
@
modalCropImg
=
$
(
'.modal-profile-crop-image'
)
@
cropActionsBtn
=
@
modalCrop
.
find
(
'[data-method]'
)
@
cropActionsBtn
=
@
modalCrop
.
find
(
'[data-method]'
)
@
bindEvents
()
@
bindEvents
()
$
:
(
selector
)
->
$
(
selector
,
@
form
)
bindEvents
:
->
bindEvents
:
->
self
=
@
self
=
@
@
fileInput
.
on
'change'
,
(
e
)
->
@
fileInput
.
on
'change'
,
(
e
)
->
...
@@ -114,6 +121,8 @@ class GitLabCrop
...
@@ -114,6 +121,8 @@ class GitLabCrop
setPreview
:
->
setPreview
:
->
@
previewImage
.
attr
(
'src'
,
@
dataURL
)
@
previewImage
.
attr
(
'src'
,
@
dataURL
)
filename
=
@
fileInput
.
val
().
replace
(
/^.*[\\\/]/
,
''
)
@
filename
.
text
(
filename
)
setBlob
:
->
setBlob
:
->
@
dataURL
=
@
modalCropImg
.
cropper
(
'getCroppedCanvas'
,
@
dataURL
=
@
modalCropImg
.
cropper
(
'getCroppedCanvas'
,
...
...
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