gitlab-org--gitlab-foss/app/assets/javascripts/pages/profiles/index.js

21 lines
555 B
JavaScript
Raw Normal View History

import $ from 'jquery';
2018-02-23 11:18:24 -05:00
import '~/profile/gl_crop';
import Profile from '~/profile/profile';
document.addEventListener('DOMContentLoaded', () => {
2018-10-10 02:41:22 -04:00
// eslint-disable-next-line func-names
$(document).on('input.ssh_key', '#key_key', function() {
2018-02-23 11:18:24 -05:00
const $title = $('#key_title');
2018-10-10 02:41:22 -04:00
const comment = $(this)
.val()
.match(/^\S+ \S+ (.+)\n?$/);
2018-02-23 11:18:24 -05:00
// Extract the SSH Key title from its comment
if (comment && comment.length > 1) {
$title.val(comment[1]).change();
}
});
2018-02-26 11:37:08 -05:00
new Profile(); // eslint-disable-line no-new
2018-02-23 11:18:24 -05:00
});