Hide "Create Repo" option if limit is reached

This commit is contained in:
Sebastian Luino 2024-08-10 19:58:06 -04:00
parent df27846628
commit 9d3a2feeba
3 changed files with 17 additions and 2 deletions

View File

@ -105,7 +105,16 @@
<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"> <a
{{if not .SignedUser.CanCreateRepo}}
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()"
{{else}}
class="item" href="{{AppSubUrl}}/repo/create"
{{end}}
>
{{svg "octicon-plus"}} {{ctx.Locale.Tr "new_repo"}} {{svg "octicon-plus"}} {{ctx.Locale.Tr "new_repo"}}
</a> </a>
{{if not .DisableMigrations}} {{if not .DisableMigrations}}

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);
} }