0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-25 10:52:47 +01:00

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.
This commit is contained in:
Bo-Yi Wu 2017-02-16 12:16:42 +08:00 committed by Kim "BKC" Carlbäcker
parent 7fd14bf7bd
commit 4c12e2a4b9
2 changed files with 6 additions and 6 deletions

View file

@ -1491,10 +1491,10 @@ $(function () {
// Parse SSH Key // Parse SSH Key
$("#ssh-key-content").on('change paste keyup',function(){ $("#ssh-key-content").on('change paste keyup',function(){
var value = $(this).val(); var arrays = $(this).val().split(" ");
var arrays = value.split(" "); var $title = $("#ssh-key-title")
if (arrays.length === 3 && arrays[2] !== "") { if ($title.val() === "" && arrays.length === 3 && arrays[2] !== "") {
$("#ssh-key-title").val(arrays[2]); $title.val(arrays[2]);
} }
}); });
}); });

View file

@ -57,11 +57,11 @@
</div> </div>
<div class="field {{if .Err_Title}}error{{end}}"> <div class="field {{if .Err_Title}}error{{end}}">
<label for="title">{{.i18n.Tr "repo.settings.title"}}</label> <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>
<div class="field {{if .Err_Content}}error{{end}}"> <div class="field {{if .Err_Content}}error{{end}}">
<label for="content">{{.i18n.Tr "repo.settings.deploy_key_content"}}</label> <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> </div>
<button class="ui green button"> <button class="ui green button">
{{.i18n.Tr "repo.settings.add_deploy_key"}} {{.i18n.Tr "repo.settings.add_deploy_key"}}