From 4c12e2a4b90237a8687b497ae14a402346b0406d Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Thu, 16 Feb 2017 12:16:42 +0800 Subject: [PATCH] fix: fill in ssh key title on setting of repo (#950) * fix: fill in ssh key title on setting of repo * fix: Don't overwrite ssh key title if exist. --- public/js/index.js | 8 ++++---- templates/repo/settings/deploy_keys.tmpl | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/public/js/index.js b/public/js/index.js index 2e0e26f55..f443e5243 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1491,10 +1491,10 @@ $(function () { // Parse SSH Key $("#ssh-key-content").on('change paste keyup',function(){ - var value = $(this).val(); - var arrays = value.split(" "); - if (arrays.length === 3 && arrays[2] !== "") { - $("#ssh-key-title").val(arrays[2]); + var arrays = $(this).val().split(" "); + var $title = $("#ssh-key-title") + if ($title.val() === "" && arrays.length === 3 && arrays[2] !== "") { + $title.val(arrays[2]); } }); }); diff --git a/templates/repo/settings/deploy_keys.tmpl b/templates/repo/settings/deploy_keys.tmpl index 1f6b26a6d..6f419c894 100644 --- a/templates/repo/settings/deploy_keys.tmpl +++ b/templates/repo/settings/deploy_keys.tmpl @@ -57,11 +57,11 @@
- +
- +