Appease the dog overlords

This commit is contained in:
Andreas Nedbal 2023-01-22 17:58:23 +01:00
parent f0df18ce87
commit fe156a38d3
2 changed files with 5 additions and 5 deletions

View File

@ -18,18 +18,18 @@ export default class extends Controller {
declare readonly aspectRatioValue: string; declare readonly aspectRatioValue: string;
readImage(file, callback) { readImage(file: File, callback: (string) => void): void {
callback((window.URL || window.webkitURL).createObjectURL(file)); callback((window.URL || window.webkitURL).createObjectURL(file));
} }
updateValues(data) { updateValues(data: Record<string, string>): void {
this.xTarget.value = data.x; this.xTarget.value = data.x;
this.yTarget.value = data.y; this.yTarget.value = data.y;
this.wTarget.value = data.width; this.wTarget.value = data.width;
this.hTarget.value = data.height; this.hTarget.value = data.height;
} }
change() { change(): void {
this.controlsTarget.classList.toggle('d-none'); this.controlsTarget.classList.toggle('d-none');
if (this.inputTarget.files && this.inputTarget.files[0]) { if (this.inputTarget.files && this.inputTarget.files[0]) {

View File

@ -2,7 +2,7 @@
.card-body .card-body
= bootstrap_form_for(current_user, url: settings_profile_picture_path, html: { multipart: true }, method: :patch, data: { turbo: false }) do |f| = bootstrap_form_for(current_user, url: settings_profile_picture_path, html: { multipart: true }, method: :patch, data: { turbo: false }) do |f|
%div{ data: { controller: "cropper", cropper_aspect_ratio_value: "1"}} %div{ data: { controller: "cropper", cropper_aspect_ratio_value: "1" } }
.d-flex .d-flex
.flex-shrink-0 .flex-shrink-0
%img.avatar-lg.me-3{ src: current_user.profile_picture.url(:medium) } %img.avatar-lg.me-3{ src: current_user.profile_picture.url(:medium) }
@ -17,7 +17,7 @@
- %i[profile_picture_x profile_picture_y profile_picture_w profile_picture_h].each do |attrib| - %i[profile_picture_x profile_picture_y profile_picture_w profile_picture_h].each do |attrib|
= f.hidden_field attrib, id: attrib, data: { cropper_target: attrib.to_s.split("_").last } = f.hidden_field attrib, id: attrib, data: { cropper_target: attrib.to_s.split("_").last }
%div{ data: { controller: "cropper", cropper_aspect_ratio_value: "0.23"}} %div{ data: { controller: "cropper", cropper_aspect_ratio_value: "0.23" } }
.row.mb-2 .row.mb-2
.col-xs-12.col-md-6 .col-xs-12.col-md-6
%img.mw-100.me-3{ src: current_user.profile_header.url(:mobile) } %img.mw-100.me-3{ src: current_user.profile_header.url(:mobile) }