gitlab-org--gitlab-foss/app/assets/javascripts/avatar_picker.js

17 lines
536 B
JavaScript
Raw Normal View History

import $ from 'jquery';
export default function initAvatarPicker() {
$('.js-choose-avatar-button').on('click', function onClickAvatar() {
const form = $(this).closest('form');
return form.find('.js-avatar-input').click();
});
$('.js-avatar-input').on('change', function onChangeAvatarInput() {
const form = $(this).closest('form');
2018-10-24 15:17:03 -04:00
const filename = $(this)
.val()
.replace(/^.*[\\\/]/, ''); // eslint-disable-line no-useless-escape
return form.find('.js-avatar-filename').text(filename);
});
}