Skip to content

Commit

Permalink
feat: fill in ssh key title automatically. (go-gitea#863)
Browse files Browse the repository at this point in the history
  • Loading branch information
appleboy authored and lunny committed Feb 9, 2017
1 parent a6751ce commit 40f4377
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions public/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1486,4 +1486,13 @@ $(function () {
$('.list-search-style').html('.search-list li:not([data-title*="' + value + '"]) {display: none;}');
}
});

// 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]);
}
});
});
4 changes: 2 additions & 2 deletions templates/user/settings/sshkeys.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@
{{.CsrfTokenHtml}}
<div class="field {{if .Err_Title}}error{{end}}">
<label for="title">{{.i18n.Tr "settings.key_name"}}</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 "settings.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 "settings.add_key"}}
Expand Down

0 comments on commit 40f4377

Please sign in to comment.