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
647f28bd
Commit
647f28bd
authored
Mar 17, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make it generic
parent
bc705979
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
12 deletions
+24
-12
app/assets/javascripts/gl_crop.js.coffee
app/assets/javascripts/gl_crop.js.coffee
+15
-11
app/assets/javascripts/profile.js.coffee
app/assets/javascripts/profile.js.coffee
+9
-1
No files found.
app/assets/javascripts/gl_crop.js.coffee
View file @
647f28bd
...
...
@@ -10,28 +10,32 @@ class GitLabCrop
# Set defaults
{
@
form
=
@
fileInput
.
parents
(
'form'
)
@
filename
=
'.js-avatar-filename'
@
previewImage
=
$
(
'.avatar-image .avatar'
)
@
modalCrop
=
'.modal-profile-crop'
@
exportWidth
=
200
@
exportHeight
=
200
@
cropBoxWidth
=
200
@
cropBoxHeight
=
200
@
form
=
@
fileInput
.
parents
(
'form'
)
# Button where user clicks to open file dialog
# If not passed as argument let's pick a default one
@
pickImageEl
=
@
fileInput
.
parent
().
find
(
'.js-choose-user-avatar-button'
)
@
uploadImageBtn
=
$
(
'.js-upload-user-avatar'
)
# Required params
@
filename
@
previewImage
@
modalCrop
@
pickImageEl
@
uploadImageBtn
@
modalCropImg
}
=
opts
# Ensure needed elements are jquery objects
@
filename
=
if
_
.
isString
(
@
filename
)
then
@
$
(
@
filename
)
else
@
filename
# If selector is provided we will convert them to a jQuery Object
@
filename
=
@
$
(
@
filename
)
@
previewImage
=
@
$
(
@
previewImage
)
@
pickImageEl
=
@
$
(
@
pickImageEl
)
# Modal
usually is outside the wrapper
element
# Modal
elements usually are outside the @form
element
@
modalCrop
=
if
_
.
isString
(
@
modalCrop
)
then
$
(
@
modalCrop
)
else
@
modalCrop
@
uploadImageBtn
=
if
_
.
isString
(
@
uploadImageBtn
)
then
$
(
@
uploadImageBtn
)
else
@
uploadImageBtn
@
modalCropImg
=
if
_
.
isString
(
@
modalCropImg
)
then
$
(
@
modalCropImg
)
else
@
modalCropImg
@
modalCropImg
=
$
(
'.modal-profile-crop-image'
)
@
cropActionsBtn
=
@
modalCrop
.
find
(
'[data-method]'
)
@
bindEvents
()
...
...
app/assets/javascripts/profile.js.coffee
View file @
647f28bd
...
...
@@ -23,7 +23,15 @@ class @Profile
@
bindEvents
()
@
avatarGlCrop
=
$
(
'.js-user-avatar-input'
).
glCrop
().
data
'glcrop'
cropOpts
=
filename
:
'.js-avatar-filename'
previewImage
:
'.avatar-image .avatar'
modalCrop
:
'.modal-profile-crop'
pickImageEl
:
'.js-choose-user-avatar-button'
uploadImageBtn
:
'.js-upload-user-avatar'
modalCropImg
:
'.modal-profile-crop-image'
@
avatarGlCrop
=
$
(
'.js-user-avatar-input'
).
glCrop
(
cropOpts
).
data
'glcrop'
bindEvents
:
->
@
form
.
on
'submit'
,
@
onSubmitForm
...
...
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