debian-mirror-gitlab/app/assets/javascripts/pages/profiles/index.js

21 lines
555 B
JavaScript
Raw Normal View History

2018-05-09 12:01:36 +05:30
import $ from 'jquery';
2018-03-27 19:54:05 +05:30
import '~/profile/gl_crop';
import Profile from '~/profile/profile';
document.addEventListener('DOMContentLoaded', () => {
2018-12-13 13:39:08 +05:30
// eslint-disable-next-line func-names
$(document).on('input.ssh_key', '#key_key', function() {
2018-03-27 19:54:05 +05:30
const $title = $('#key_title');
2018-12-13 13:39:08 +05:30
const comment = $(this)
.val()
.match(/^\S+ \S+ (.+)\n?$/);
2018-03-27 19:54:05 +05:30
// Extract the SSH Key title from its comment
if (comment && comment.length > 1) {
$title.val(comment[1]).change();
}
});
new Profile(); // eslint-disable-line no-new
});