Skip to content

Commit 58d4d68

Browse files
maze-runnarkushthedude
authored andcommitted
chore: migrating cropper-modal to ES6 (#3682)
Co-authored-by: Kush Trivedi <kushthedude@gmail.com>
1 parent f40338a commit 58d4d68

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed
+17-17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import ModalBase from 'open-event-frontend/components/modals/modal-base';
2-
3-
export default ModalBase.extend({
2+
import { action } from '@ember/object';
3+
export default class extends ModalBase {
44
onVisible() {
55
let viewport = {};
66
let factor = 150;
@@ -16,27 +16,27 @@ export default ModalBase.extend({
1616
height: 250
1717
}
1818
});
19-
},
19+
}
2020

2121
onHide() {
2222
this.$('img').croppie('destroy');
2323
const $img = this.$('img');
2424
if ($img.parent().is('div.croppie')) {
2525
$img.unwrap();
2626
}
27-
},
2827

29-
actions: {
30-
resetImage() {
31-
this.onHide();
32-
this.onVisible();
33-
},
34-
cropImage() {
35-
this.$('img').croppie('result', { type: 'base64', size: 'original', quality: 1, format: 'jpeg' }).then(result => {
36-
if (this.onImageCrop) {
37-
this.onImageCrop(result);
38-
}
39-
});
40-
}
4128
}
42-
});
29+
@action
30+
resetImage() {
31+
this.onHide();
32+
this.onVisible();
33+
}
34+
@action
35+
cropImage() {
36+
this.$('img').croppie('result', { type: 'base64', size: 'original', quality: 1, format: 'jpeg' }).then(result => {
37+
if (this.onImageCrop) {
38+
this.onImageCrop(result);
39+
}
40+
});
41+
}
42+
}

0 commit comments

Comments
 (0)