Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Reduce the icon size a bit

Roland Geiderbcad09bb9916
diff --git a/wger/core/templates/forms/password_with_toggle.html b/wger/core/templates/forms/password_with_toggle.html
index f7052aede..1b8ffa477 100644
--- a/wger/core/templates/forms/password_with_toggle.html
+++ b/wger/core/templates/forms/password_with_toggle.html
@@ -2,8 +2,8 @@
<div class="password-wrapper" style="position: relative; display: block;">
<input type="{{ widget.type }}" name="{{ widget.name }}"{% if widget.value %} value="{{ widget.value }}"{% endif %}{% if widget.attrs.id %} id="{{ widget.attrs.id }}"{% endif %}{% if widget.attrs.class %} class="{{ widget.attrs.class }}"{% endif %}{% if widget.attrs.placeholder %} placeholder="{{ widget.attrs.placeholder }}"{% endif %}{% if widget.attrs.required %} required{% endif %}{% if widget.attrs.maxlength %} maxlength="{{ widget.attrs.maxlength }}"{% endif %}{% if widget.attrs.autocomplete %} autocomplete="{{ widget.attrs.autocomplete }}"{% endif %} style="width: 100%; padding-right: 40px;">
<button type="button" class="password-toggle-btn" aria-label="Toggle password visibility" style="position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; padding: 5px; z-index: 10;">
- <i class="fas fa-eye-slash eye-closed p-2 fa-2x" style="color: #245daf;"></i>
- <i class="fas fa-eye eye-open p-2 fa-2x" style="color: #245daf; display: none;"></i>
+ <i class="fas fa-eye-slash eye-closed p-2" style="color: #245daf;"></i>
+ <i class="fas fa-eye eye-open p-2" style="color: #245daf; display: none;"></i>
</button>
</div>
@@ -11,23 +11,23 @@
(function() {
function initPasswordToggle() {
const passwordWrappers = document.querySelectorAll('.password-wrapper');
-
+
passwordWrappers.forEach(function(wrapper) {
// Check if already initialized
if (wrapper.hasAttribute('data-toggle-initialized')) {
return;
}
-
+
const passwordInput = wrapper.querySelector('input');
const toggleBtn = wrapper.querySelector('.password-toggle-btn');
const eyeOpen = wrapper.querySelector('.eye-open');
const eyeClosed = wrapper.querySelector('.eye-closed');
-
+
if (toggleBtn && passwordInput && eyeOpen && eyeClosed) {
toggleBtn.addEventListener('click', function(e) {
e.preventDefault();
e.stopPropagation();
-
+
if (passwordInput.type === 'password') {
passwordInput.type = 'text';
eyeOpen.style.display = 'none';
@@ -38,20 +38,20 @@
eyeClosed.style.display = 'none';
}
});
-
+
// Mark as initialized
wrapper.setAttribute('data-toggle-initialized', 'true');
}
});
}
-
+
// Initialize on DOM ready
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initPasswordToggle);
} else {
initPasswordToggle();
}
-
+
// Also initialize after a short delay to catch late-rendered elements
setTimeout(initPasswordToggle, 100);
setTimeout(initPasswordToggle, 500);
@@ -81,4 +81,4 @@
outline: 2px solid #007bff;
outline-offset: 2px;
}
-</style>
\ No newline at end of file
+</style>