Skip to content

Commit 4c12e2a

Browse files
appleboybkcsoft
authored andcommitted
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.
1 parent 7fd14bf commit 4c12e2a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

public/js/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,10 +1491,10 @@ $(function () {
14911491

14921492
// Parse SSH Key
14931493
$("#ssh-key-content").on('change paste keyup',function(){
1494-
var value = $(this).val();
1495-
var arrays = value.split(" ");
1496-
if (arrays.length === 3 && arrays[2] !== "") {
1497-
$("#ssh-key-title").val(arrays[2]);
1494+
var arrays = $(this).val().split(" ");
1495+
var $title = $("#ssh-key-title")
1496+
if ($title.val() === "" && arrays.length === 3 && arrays[2] !== "") {
1497+
$title.val(arrays[2]);
14981498
}
14991499
});
15001500
});

templates/repo/settings/deploy_keys.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@
5757
</div>
5858
<div class="field {{if .Err_Title}}error{{end}}">
5959
<label for="title">{{.i18n.Tr "repo.settings.title"}}</label>
60-
<input id="title" name="title" value="{{.title}}" autofocus required>
60+
<input id="ssh-key-title" name="title" value="{{.title}}" autofocus required>
6161
</div>
6262
<div class="field {{if .Err_Content}}error{{end}}">
6363
<label for="content">{{.i18n.Tr "repo.settings.deploy_key_content"}}</label>
64-
<textarea id="content" name="content" required>{{.content}}</textarea>
64+
<textarea id="ssh-key-content" name="content" required>{{.content}}</textarea>
6565
</div>
6666
<button class="ui green button">
6767
{{.i18n.Tr "repo.settings.add_deploy_key"}}

0 commit comments

Comments
 (0)