Skip to content

Commit 6496b3c

Browse files
committed
Add hint for public and private profile repo name
1 parent ef826a1 commit 6496b3c

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

options/locale/locale_en-US.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,8 @@ new_repo_helper = A repository contains all project files, including revision hi
10151015
owner = Owner
10161016
owner_helper = Some organizations may not show up in the dropdown due to a maximum repository count limit.
10171017
repo_name = Repository Name
1018+
repo_name_public_profile_hint=.profile is a special repository that you can use to add a README.md to your personal or organization publiv profile. Make sure it's public and initialize it with a README to get started.
1019+
repo_name_private_profile_hint=.profile-private is a special repository that you can use to add a README.md to your organization member profile. Make sure it's private and initialize it with a README to get started.
10181020
repo_name_helper = Good repository names use short, memorable and unique keywords.
10191021
repo_size = Repository Size
10201022
template = Template

templates/repo/create.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
<div class="inline required field {{if .Err_RepoName}}error{{end}}">
4545
<label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label>
4646
<input id="repo_name" name="repo_name" value="{{.repo_name}}" autofocus required maxlength="100">
47+
<span id="repo_name_public_profile_hint" style="display:none" class="help">{{ctx.Locale.Tr "repo.repo_name_public_profile_hint"}}</span>
48+
<span id="repo_name_private_profile_hint" style="display:none" class="help">{{ctx.Locale.Tr "repo.repo_name_private_profile_hint"}}</span>
4749
<span class="help">{{ctx.Locale.Tr "repo.repo_name_helper"}}</span>
4850
</div>
4951
<div class="inline field">

web_src/js/features/repo-create.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const repoName = document.querySelector<HTMLInputElement>('#repo_name');
2+
const repoPublicHint = document.querySelector<HTMLInputElement>('#repo_name_public_profile_hint');
3+
const repoPrivateHint = document.querySelector<HTMLInputElement>('#repo_name_private_profile_hint');
4+
5+
export function initRepoCreate() {
6+
repoName?.addEventListener('input', () => {
7+
if (repoName?.value === '.profile') {
8+
repoPublicHint.style.display = 'inline-block';
9+
} else {
10+
repoPublicHint.style.display = 'none';
11+
}
12+
if (repoName?.value === '.profile-private') {
13+
repoPrivateHint.style.display = 'inline-block';
14+
} else {
15+
repoPrivateHint.style.display = 'none';
16+
}
17+
});
18+
}

web_src/js/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {initRepoEllipsisButton, initCommitStatuses} from './features/repo-commit
3535
import {initRepoTopicBar} from './features/repo-home.ts';
3636
import {initAdminCommon} from './features/admin/common.ts';
3737
import {initRepoTemplateSearch} from './features/repo-template.ts';
38+
import {initRepoCreate} from './features/repo-create.ts';
3839
import {initRepoCodeView} from './features/repo-code.ts';
3940
import {initSshKeyFormParser} from './features/sshkey-helper.ts';
4041
import {initUserSettings} from './features/user-settings.ts';
@@ -173,6 +174,7 @@ onDomReady(() => {
173174
initRepoActivityTopAuthorsChart,
174175
initRepoArchiveLinks,
175176
initRepoBranchButton,
177+
initRepoCreate,
176178
initRepoCodeView,
177179
initBranchSelectorTabs,
178180
initRepoEllipsisButton,

0 commit comments

Comments
 (0)