Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Replace spaces with - in a newly created repo name and display how it will look like #26757

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

redve-dev
Copy link

Implemented quality-of-life feature known from Github

In the current state when user attempts to create repository with space in name, he gets an error.
With this template changes, the repository is created with dashes in place of spaces. The dashes can be changed by editing line "const char_in_repo_name = '-'", which can be easily moved to the config in the future. Moreover user gets live-preview of the repo name while creating repo.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 27, 2023
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 27, 2023
@yardenshoham
Copy link
Member

Don't put style and script tags in HTML templates

@delvh delvh changed the title implement replacing spaces with dashes in newly created repo title Replace spaces with - in a newly created repo name and display how it will look like Aug 28, 2023
@silverwind
Copy link
Member

Yes, put that stuff in web_src/css and web_src/js. The only valid reason for inline CSS/JS is for render-critical code, this is not such code.

@silverwind
Copy link
Member

silverwind commented Sep 1, 2023

Regarding the feature itself, it needs to handle more than just spaces, in fact on GitHub, every invalid character is replaced, and it also applies to org creation (where github seems to have a slightly different algorithm as it does not add the trailing -, but I'd use the org algo):

Screenshot 2023-09-01 at 09 47 19 Screenshot 2023-09-01 at 09 50 22

This is something that should have some unit tests which will are also easy to write, just a function that takes a string and returns a string.

IIRC, Gitea allows more special characters then GitHub, so that will likely need to be taken into account.

@techknowlogick techknowlogick added type/enhancement An improvement of existing functionality topic/ui Change the appearance of the Gitea UI labels Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. topic/ui Change the appearance of the Gitea UI type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants