diff options
author | Robert Speicher <rspeicher@gmail.com> | 2016-03-03 15:10:15 -0500 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-03-03 16:13:56 -0500 |
commit | 9db57bc65a53b19714e7b867bdb75c85058013cf (patch) | |
tree | 70b37f54c71302d4bada6d502c939cd187a0dc3c /app | |
parent | 2c760487be653a3cc4f9214a72d9c9149147263e (diff) | |
download | gitlab-ce-9db57bc65a53b19714e7b867bdb75c85058013cf.tar.gz |
Move SSH key JS to Profile CS class
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/profile.js.coffee | 9 | ||||
-rw-r--r-- | app/views/profiles/keys/new.html.haml | 11 |
2 files changed, 9 insertions, 11 deletions
diff --git a/app/assets/javascripts/profile.js.coffee b/app/assets/javascripts/profile.js.coffee index 15fd9e99ce9..9110b732adc 100644 --- a/app/assets/javascripts/profile.js.coffee +++ b/app/assets/javascripts/profile.js.coffee @@ -62,3 +62,12 @@ class @Profile $modalCropImg.attr('src', event.target.result) fileData = reader.readAsDataURL(this.files[0]) + +$ -> + # Extract the SSH Key title from its comment + $(document).on 'focusout.ssh_key', '#key_key', -> + $title = $('#key_title') + comment = $(@).val().match(/^\S+ \S+ (.+)\n?$/) + + if comment && comment.length > 1 && $title.val() == '' + $title.val(comment[1]).change() diff --git a/app/views/profiles/keys/new.html.haml b/app/views/profiles/keys/new.html.haml index 13a18269d11..3470b83def5 100644 --- a/app/views/profiles/keys/new.html.haml +++ b/app/views/profiles/keys/new.html.haml @@ -4,14 +4,3 @@ Paste your public key here. Read more about how to generate a key on #{link_to "the SSH help page", help_page_path("ssh", "README")}. %hr = render 'form' - -:javascript - $('#key_key').on('focusout', function(){ - var title = $('#key_title'), - val = $('#key_key').val(), - comment = val.match(/^\S+ \S+ (.+)\n?$/); - - if( comment && comment.length > 1 && title.val() == '' ){ - $('#key_title').val( comment[1] ).change(); - } - }); |