[feature request - ui tweak] ssh key adding form UI usability #3037

Closed
opened 2025-11-02 04:58:16 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @mateusza on GitHub (Mar 10, 2019).

Description

When adding new SSH key, key title should be automatically populated from public key comment field.

Additionally, in my personal opinion, swapping order of these two fields (making the key content textarea go above the title) would make it more intuitive. I often just paste the key into the first field available before realizing it's the "title" and the key should go into the other one.

The JS code:

var $sshKeyContent = $('#ssh-key-content')
$sshKeyContent.change(function() {
	var $sshKeyTitle = $('#ssh-key-title');
	if ( $sshKeyContent.val().length > 0 && $sshKeyTitle.val() === "" ){
		$sshKeyTitle.val( $sshKeyContent.val().trimRight().match( /^ssh-[^ ]* [^ ]* (.*)$/ )[1] );
	}
} );

Screenshots

image

Originally created by @mateusza on GitHub (Mar 10, 2019). ## Description When adding new SSH key, key title should be automatically populated from public key comment field. Additionally, in my personal opinion, swapping order of these two fields (making the key content textarea go above the title) would make it more intuitive. I often just paste the key into the first field available before realizing it's the "title" and the key should go into the other one. The JS code: ``` var $sshKeyContent = $('#ssh-key-content') $sshKeyContent.change(function() { var $sshKeyTitle = $('#ssh-key-title'); if ( $sshKeyContent.val().length > 0 && $sshKeyTitle.val() === "" ){ $sshKeyTitle.val( $sshKeyContent.val().trimRight().match( /^ssh-[^ ]* [^ ]* (.*)$/ )[1] ); } } ); ``` ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** --> ![image](https://user-images.githubusercontent.com/7002/54085765-cb0be380-4341-11e9-85fd-c2de68481b48.png)
GiteaMirror added the type/enhancementissue/stale labels 2025-11-02 04:58:16 -06:00
Author
Owner

@lunny commented on GitHub (Mar 11, 2019):

Please send a PR to fix that.

@lunny commented on GitHub (Mar 11, 2019): Please send a PR to fix that.
Author
Owner

@mateusza commented on GitHub (Mar 15, 2019):

I just noticed this was already implemented 2 YEARS AGO in #950 but it only works when the key comment does not contain any spaces. I will fix that.

@mateusza commented on GitHub (Mar 15, 2019): I just noticed this was already implemented 2 YEARS AGO in #950 but it only works when the key comment does not contain any spaces. I will fix that.
Author
Owner

@Piraty commented on GitHub (Mar 18, 2019):

please don't swap the textboxes. Since their purpose is clearly stated, it makes sense they way it is. And yes, the comment is inserted automatically into the "key name" field

@Piraty commented on GitHub (Mar 18, 2019): please don't swap the textboxes. Since their purpose is clearly stated, it makes sense they way it is. And yes, the comment is inserted automatically into the "key name" field
Author
Owner

@stale[bot] commented on GitHub (May 17, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (May 17, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@lunny commented on GitHub (May 19, 2019):

This has been resolved.

@lunny commented on GitHub (May 19, 2019): This has been resolved.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3037