Skip to content

Commit

Permalink
fix: fill in ssh key title on setting of repo (go-gitea#950)
Browse files Browse the repository at this point in the history
* fix: fill in ssh key title on setting of repo

* fix: Don't overwrite ssh key title if exist.
  • Loading branch information
appleboy authored and bkcsoft committed Feb 16, 2017
1 parent 7fd14bf commit 4c12e2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions public/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
});
});
4 changes: 2 additions & 2 deletions templates/repo/settings/deploy_keys.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@
</div>
<div class="field {{if .Err_Title}}error{{end}}">
<label for="title">{{.i18n.Tr "repo.settings.title"}}</label>
<input id="title" name="title" value="{{.title}}" autofocus required>
<input id="ssh-key-title" name="title" value="{{.title}}" autofocus required>
</div>
<div class="field {{if .Err_Content}}error{{end}}">
<label for="content">{{.i18n.Tr "repo.settings.deploy_key_content"}}</label>
<textarea id="content" name="content" required>{{.content}}</textarea>
<textarea id="ssh-key-content" name="content" required>{{.content}}</textarea>
</div>
<button class="ui green button">
{{.i18n.Tr "repo.settings.add_deploy_key"}}
Expand Down

0 comments on commit 4c12e2a

Please sign in to comment.