This commit is contained in:
Sebastian Luino 2024-09-01 22:18:06 +08:00 committed by GitHub
commit ad974b397b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 33 additions and 6 deletions

View File

@ -105,9 +105,20 @@
<span class="only-mobile">{{ctx.Locale.Tr "create_new"}}</span> <span class="only-mobile">{{ctx.Locale.Tr "create_new"}}</span>
</span> </span>
<div class="menu"> <div class="menu">
<a class="item" href="{{AppSubUrl}}/repo/create"> {{if .SignedUser.CanCreateRepo}}
{{svg "octicon-plus"}} {{ctx.Locale.Tr "new_repo"}} <a class="item" href="{{AppSubUrl}}/repo/create">
</a> {{svg "octicon-plus"}} {{ctx.Locale.Tr "new_repo"}}
</a>
{{else}}
<a
class="disabled-with-tooltip item"
data-tooltip-content="{{ctx.Locale.TrN .SignedUser.MaxCreationLimit "repo.form.reach_limit_of_creation_1" "repo.form.reach_limit_of_creation_n" .SignedUser.MaxCreationLimit}}"
href="/"
onclick="event.stopPropagation(); event.preventDefault()"
>
{{svg "octicon-plus"}} {{ctx.Locale.Tr "new_repo"}}
</a>
{{end}}
{{if not .DisableMigrations}} {{if not .DisableMigrations}}
<a class="item" href="{{AppSubUrl}}/repo/migrate"> <a class="item" href="{{AppSubUrl}}/repo/migrate">
{{svg "octicon-repo-push"}} {{ctx.Locale.Tr "new_migrate"}} {{svg "octicon-repo-push"}} {{ctx.Locale.Tr "new_migrate"}}

View File

@ -15,7 +15,7 @@
{{if .ShowMemberAndTeamTab}} {{if .ShowMemberAndTeamTab}}
<div class="ui five wide column"> <div class="ui five wide column">
{{if .CanCreateOrgRepo}} {{if and .CanCreateOrgRepo .SignedUser.CanCreateRepo}}
<div class="center aligned tw-mb-4"> <div class="center aligned tw-mb-4">
<a class="ui primary button" href="{{AppSubUrl}}/repo/create?org={{.Org.ID}}">{{ctx.Locale.Tr "new_repo"}}</a> <a class="ui primary button" href="{{AppSubUrl}}/repo/create?org={{.Org.ID}}">{{ctx.Locale.Tr "new_repo"}}</a>
{{if not .DisableNewPullMirrors}} {{if not .DisableNewPullMirrors}}

View File

@ -13,6 +13,7 @@ const data = {
textFilter: {{ctx.Locale.Tr "home.filter"}}, textFilter: {{ctx.Locale.Tr "home.filter"}},
textShowArchived: {{ctx.Locale.Tr "home.show_archived"}}, textShowArchived: {{ctx.Locale.Tr "home.show_archived"}},
textShowPrivate: {{ctx.Locale.Tr "home.show_private"}}, textShowPrivate: {{ctx.Locale.Tr "home.show_private"}},
textRepoReachLimitOfCreation: {{ctx.Locale.TrN .SignedUser.MaxCreationLimit "repo.form.reach_limit_of_creation_1" "repo.form.reach_limit_of_creation_n" .SignedUser.MaxCreationLimit}},
textShowBothArchivedUnarchived: {{ctx.Locale.Tr "home.show_both_archived_unarchived"}}, textShowBothArchivedUnarchived: {{ctx.Locale.Tr "home.show_both_archived_unarchived"}},
textShowOnlyUnarchived: {{ctx.Locale.Tr "home.show_only_unarchived"}}, textShowOnlyUnarchived: {{ctx.Locale.Tr "home.show_only_unarchived"}},
@ -49,6 +50,7 @@ data.organizations = [{{range .Orgs}}{'name': {{.Name}}, 'num_repos': {{.NumRepo
data.isOrganization = false; data.isOrganization = false;
data.organizationsTotalCount = {{.UserOrgsCount}}; data.organizationsTotalCount = {{.UserOrgsCount}};
data.canCreateOrganization = {{.SignedUser.CanCreateOrganization}}; data.canCreateOrganization = {{.SignedUser.CanCreateOrganization}};
data.canCreateRepo = {{.SignedUser.CanCreateRepo}};
{{else}} {{else}}
data.organizationId = {{.ContextUser.ID}}; data.organizationId = {{.ContextUser.ID}};
{{end}} {{end}}

View File

@ -1393,6 +1393,12 @@ table th[data-sortt-desc] .svg {
min-width: 0; min-width: 0;
} }
.ui.dropdown .menu > .disabled-with-tooltip.item {
cursor: default;
opacity: var(--opacity-disabled);
background: inherit;
}
.ui.dropdown.ellipsis-items-nowrap > .text { .ui.dropdown.ellipsis-items-nowrap > .text {
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;

View File

@ -51,7 +51,7 @@
justify-content: stretch; justify-content: stretch;
} }
#navbar a.item:hover, #navbar a.item:hover:not(.disabled-with-tooltip),
#navbar button.item:hover { #navbar button.item:hover {
background: var(--color-nav-hover-bg); background: var(--color-nav-hover-bg);
} }

View File

@ -350,9 +350,12 @@ export default sfc; // activate the IDE's Vue plugin
{{ textMyRepos }} {{ textMyRepos }}
<span class="ui grey label tw-ml-2">{{ reposTotalCount }}</span> <span class="ui grey label tw-ml-2">{{ reposTotalCount }}</span>
</div> </div>
<a class="tw-flex tw-items-center muted" :href="subUrl + '/repo/create' + (isOrganization ? '?org=' + organizationId : '')" :data-tooltip-content="textNewRepo"> <a v-if="canCreateRepo" class="tw-flex tw-items-center muted" :href="subUrl + '/repo/create' + (isOrganization ? '?org=' + organizationId : '')" :data-tooltip-content="textNewRepo">
<svg-icon name="octicon-plus"/> <svg-icon name="octicon-plus"/>
</a> </a>
<span v-else class="tw-flex tw-items-center disabled" :data-tooltip-content="textRepoReachLimitOfCreation">
<svg-icon name="octicon-plus"/>
</span>
</h4> </h4>
<div class="ui attached segment repos-search"> <div class="ui attached segment repos-search">
<div class="ui small fluid action left icon input"> <div class="ui small fluid action left icon input">
@ -546,4 +549,9 @@ ul li:not(:last-child) {
.repo-owner-name-list li.active { .repo-owner-name-list li.active {
background: var(--color-hover); background: var(--color-hover);
} }
span.disabled {
opacity: var(--opacity-disabled);
}
</style> </style>