2018-03-09 15:18:59 -05:00
|
|
|
import $ from 'jquery';
|
|
|
|
|
2017-10-23 09:05:53 -04:00
|
|
|
export default function groupAvatar() {
|
|
|
|
$('.js-choose-group-avatar-button').on('click', function onClickGroupAvatar() {
|
|
|
|
const form = $(this).closest('form');
|
|
|
|
return form.find('.js-group-avatar-input').click();
|
|
|
|
});
|
|
|
|
$('.js-group-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
|
2017-10-23 09:05:53 -04:00
|
|
|
return form.find('.js-avatar-filename').text(filename);
|
|
|
|
});
|
|
|
|
}
|