Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: fill in ssh key title on setting of repo #950

Merged
merged 4 commits into from
Feb 16, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion public/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,8 @@ $(function () {
$("#ssh-key-content").on('change paste keyup',function(){
var value = $(this).val();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? Why not var arrays = $(this).val().split(" ") ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bkcsoft Done

var arrays = value.split(" ");
if (arrays.length === 3 && arrays[2] !== "") {
var $title = $("#ssh-key-title")
if ($title.val() === "" && arrays.length === 3 && arrays[2] !== "") {
$("#ssh-key-title").val(arrays[2]);
}
});
Expand Down
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