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
f2ad7aab
Commit
f2ad7aab
authored
Mar 22, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use _this instead of self
parent
0a14de84
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
app/assets/javascripts/gl_crop.js.coffee
app/assets/javascripts/gl_crop.js.coffee
+12
-11
No files found.
app/assets/javascripts/gl_crop.js.coffee
View file @
f2ad7aab
...
@@ -44,9 +44,9 @@ class GitLabCrop
...
@@ -44,9 +44,9 @@ class GitLabCrop
$
(
selector
,
@
form
)
$
(
selector
,
@
form
)
bindEvents
:
->
bindEvents
:
->
self
=
@
_this
=
@
@
fileInput
.
on
'change'
,
(
e
)
->
@
fileInput
.
on
'change'
,
(
e
)
->
self
.
onFileInputChange
(
e
,
@
)
_this
.
onFileInputChange
(
e
,
@
)
@
pickImageEl
.
on
'click'
,
@
onPickImageClick
@
pickImageEl
.
on
'click'
,
@
onPickImageClick
@
modalCrop
.
on
'shown.bs.modal'
,
@
onModalShow
@
modalCrop
.
on
'shown.bs.modal'
,
@
onModalShow
...
@@ -54,14 +54,14 @@ class GitLabCrop
...
@@ -54,14 +54,14 @@ class GitLabCrop
@
uploadImageBtn
.
on
'click'
,
@
onUploadImageBtnClick
@
uploadImageBtn
.
on
'click'
,
@
onUploadImageBtnClick
@
cropActionsBtn
.
on
'click'
,
(
e
)
->
@
cropActionsBtn
.
on
'click'
,
(
e
)
->
btn
=
@
btn
=
@
self
.
onActionBtnClick
(
btn
)
_this
.
onActionBtnClick
(
btn
)
@
croppedImageBlob
=
null
@
croppedImageBlob
=
null
onPickImageClick
:
=>
onPickImageClick
:
=>
@
fileInput
.
trigger
(
'click'
)
@
fileInput
.
trigger
(
'click'
)
onModalShow
:
=>
onModalShow
:
=>
self
=
@
_this
=
@
@
modalCropImg
.
cropper
(
@
modalCropImg
.
cropper
(
viewMode
:
1
viewMode
:
1
center
:
false
center
:
false
...
@@ -78,11 +78,12 @@ class GitLabCrop
...
@@ -78,11 +78,12 @@ class GitLabCrop
cropBoxResizable
:
false
cropBoxResizable
:
false
toggleDragModeOnDblclick
:
false
toggleDragModeOnDblclick
:
false
built
:
->
built
:
->
container
=
$
(
@
).
cropper
'getContainerData'
$image
=
$
(
@
)
cropBoxWidth
=
self
.
cropBoxWidth
;
container
=
$image
.
cropper
'getContainerData'
cropBoxHeight
=
self
.
cropBoxHeight
;
cropBoxWidth
=
_this
.
cropBoxWidth
;
cropBoxHeight
=
_this
.
cropBoxHeight
;
$
(
@
)
.
cropper
(
'setCropBoxData'
,
$
image
.
cropper
(
'setCropBoxData'
,
width
:
cropBoxWidth
,
width
:
cropBoxWidth
,
height
:
cropBoxHeight
,
height
:
cropBoxHeight
,
left
:
(
container
.
width
-
cropBoxWidth
)
/
2
,
left
:
(
container
.
width
-
cropBoxWidth
)
/
2
,
...
@@ -113,11 +114,11 @@ class GitLabCrop
...
@@ -113,11 +114,11 @@ class GitLabCrop
@
readFile
(
input
)
@
readFile
(
input
)
readFile
:
(
input
)
->
readFile
:
(
input
)
->
self
=
@
_this
=
@
reader
=
new
FileReader
reader
=
new
FileReader
reader
.
onload
=
->
reader
.
onload
=
->
self
.
modalCropImg
.
attr
(
'src'
,
reader
.
result
)
_this
.
modalCropImg
.
attr
(
'src'
,
reader
.
result
)
self
.
modalCrop
.
modal
(
'show'
)
_this
.
modalCrop
.
modal
(
'show'
)
reader
.
readAsDataURL
(
input
.
files
[
0
])
reader
.
readAsDataURL
(
input
.
files
[
0
])
...
...
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