summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2016-03-22 11:45:37 -0500
committerAlfredo Sumaran <alfredo@gitlab.com>2016-03-22 11:45:37 -0500
commitf2ad7aabf90b4f5a97dd9dd329488f3aab7c6fcc (patch)
tree36f514212ac90a586937df747bc3dee12f8399fd
parent0a14de843c9f47482521e3f703956ba2a6c89f1c (diff)
downloadgitlab-ce-f2ad7aabf90b4f5a97dd9dd329488f3aab7c6fcc.tar.gz
Use _this instead of self
-rw-r--r--app/assets/javascripts/gl_crop.js.coffee23
1 files changed, 12 insertions, 11 deletions
diff --git a/app/assets/javascripts/gl_crop.js.coffee b/app/assets/javascripts/gl_crop.js.coffee
index 78dfe43d24e..3eb2eaa9a6d 100644
--- a/app/assets/javascripts/gl_crop.js.coffee
+++ b/app/assets/javascripts/gl_crop.js.coffee
@@ -44,9 +44,9 @@ class GitLabCrop
$(selector, @form)
bindEvents: ->
- self = @
+ _this = @
@fileInput.on 'change', (e) ->
- self.onFileInputChange(e, @)
+ _this.onFileInputChange(e, @)
@pickImageEl.on 'click', @onPickImageClick
@modalCrop.on 'shown.bs.modal', @onModalShow
@@ -54,14 +54,14 @@ class GitLabCrop
@uploadImageBtn.on 'click', @onUploadImageBtnClick
@cropActionsBtn.on 'click', (e) ->
btn = @
- self.onActionBtnClick(btn)
+ _this.onActionBtnClick(btn)
@croppedImageBlob = null
onPickImageClick: =>
@fileInput.trigger('click')
onModalShow: =>
- self = @
+ _this = @
@modalCropImg.cropper(
viewMode: 1
center: false
@@ -78,11 +78,12 @@ class GitLabCrop
cropBoxResizable: false
toggleDragModeOnDblclick: false
built: ->
- container = $(@).cropper 'getContainerData'
- cropBoxWidth = self.cropBoxWidth;
- cropBoxHeight = self.cropBoxHeight;
+ $image = $(@)
+ container = $image.cropper 'getContainerData'
+ cropBoxWidth = _this.cropBoxWidth;
+ cropBoxHeight = _this.cropBoxHeight;
- $(@).cropper('setCropBoxData',
+ $image.cropper('setCropBoxData',
width: cropBoxWidth,
height: cropBoxHeight,
left: (container.width - cropBoxWidth) / 2,
@@ -113,11 +114,11 @@ class GitLabCrop
@readFile(input)
readFile: (input) ->
- self = @
+ _this = @
reader = new FileReader
reader.onload = ->
- self.modalCropImg.attr('src', reader.result)
- self.modalCrop.modal('show')
+ _this.modalCropImg.attr('src', reader.result)
+ _this.modalCrop.modal('show')
reader.readAsDataURL(input.files[0])