Merge pull request #4637 from aignatov-bio/ai-sci-7233-fix-show-password-for-edit-settings

Fix show password for edit settings [SCI-7233]
This commit is contained in:
aignatov-bio 2022-11-22 16:23:36 +01:00 committed by GitHub
commit 176f3c48e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -1,4 +1,5 @@
$(document).on('turbolinks:load', function() { function initShowPassword() {
$('.fas.fa-eye.show-password').remove();
$.each($('input[type="password"]'), function(i, e) { $.each($('input[type="password"]'), function(i, e) {
$(`<i class="fas fa-eye show-password" $(`<i class="fas fa-eye show-password"
style=" style="
@ -8,6 +9,10 @@ $(document).on('turbolinks:load', function() {
"></i>`).insertAfter(e); "></i>`).insertAfter(e);
$(e).parent().addClass('right-icon'); $(e).parent().addClass('right-icon');
}); });
}
$(document).on('turbolinks:load', function() {
initShowPassword()
}); });
$(document).on('click', '.show-password', function() { $(document).on('click', '.show-password', function() {

View file

@ -8,7 +8,7 @@
* false to set form to view mode. * false to set form to view mode.
*/ */
/* global _ filesValidator animateSpinner FileTypeEnum */ /* global _ filesValidator animateSpinner FileTypeEnum initShowPassword */
var forms = $('form[data-for]'); var forms = $('form[data-for]');
@ -18,6 +18,7 @@
form.find("[data-part='view']").hide(); form.find("[data-part='view']").hide();
form.find("[data-part='edit']").show(); form.find("[data-part='edit']").show();
form.find("[data-part='edit'] input:not([type='file']):not([type='submit']):first").focus(); form.find("[data-part='edit'] input:not([type='file']):not([type='submit']):first").focus();
initShowPassword();
} else { } else {
form.find("[data-part='view']").show(); form.find("[data-part='view']").show();
form.find("[data-part='edit'] input").blur(); form.find("[data-part='edit'] input").blur();