Commit f2ad7aab authored by Alfredo Sumaran's avatar Alfredo Sumaran

Use _this instead of self

parent 0a14de84
...@@ -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])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment