This commit is contained in:
neo773
2025-04-12 00:08:43 +05:30
parent cbaaee1257
commit c6fcaa2a11
2 changed files with 7 additions and 2 deletions

View File

@@ -22,7 +22,10 @@ export default class extends Controller {
this.deleteProfileImageTarget.value = "1";
this.uploadTextTarget.classList.remove("hidden");
this.changeTextTarget.classList.add("hidden");
this.changeTextTarget.setAttribute("aria-hidden", "true");
this.uploadTextTarget.setAttribute("aria-hidden", "false");
this.cameraIconTarget.classList.remove("!hidden");
}
showFileInputPreview(event) {
@@ -36,6 +39,8 @@ export default class extends Controller {
this.deleteProfileImageTarget.value = "0";
this.uploadTextTarget.classList.add("hidden");
this.changeTextTarget.classList.remove("hidden");
this.changeTextTarget.setAttribute("aria-hidden", "false");
this.uploadTextTarget.setAttribute("aria-hidden", "true");
this.cameraIconTarget.classList.add("!hidden");
this.previewImageTarget.querySelector("img").src =
URL.createObjectURL(file);

View File

@@ -40,10 +40,10 @@
<%= form.label :profile_image, class: "btn btn--outline inline-block", data: { profile_image_preview_target: "uploadButton" } do %>
<%= lucide_icon "camera", class: "w-5 h-5 mr-2 inline-block", data: { profile_image_preview_target: "cameraIcon" } %>
<span data-profile-image-preview-target="uploadText" class="<%= user.profile_image.attached? ? 'hidden' : '' %>" aria-hidden="<%= user.profile_image.attached? ? 'true' : 'false' %>">
<span data-profile-image-preview-target="uploadText">
<%= t(".choose") %> <span class="text-secondary"><%= t(".choose_label") %></span>
</span>
<span data-profile-image-preview-target="changeText" class="<%= user.profile_image.attached? ? '' : 'hidden' %>" aria-hidden="<%= user.profile_image.attached? ? 'false' : 'true' %>">
<span data-profile-image-preview-target="changeText" class="hidden" aria-hidden="true">
<%= t(".change") %>
</span>
<% end %>