mirror of
https://github.com/go-gitea/gitea.git
synced 2025-04-27 20:08:49 +03:00
Backport #34030
This commit is contained in:
@ -10,12 +10,7 @@
|
|||||||
<div class="ui attached segment">
|
<div class="ui attached segment">
|
||||||
{{template "base/alert" .}}
|
{{template "base/alert" .}}
|
||||||
{{template "repo/create_helper" .}}
|
{{template "repo/create_helper" .}}
|
||||||
|
<div id="create-repo-error-message" class="ui negative message tw-text-center tw-hidden"></div>
|
||||||
{{if not .CanCreateRepo}}
|
|
||||||
<div class="ui negative message">
|
|
||||||
<p>{{ctx.Locale.TrN .MaxCreationLimit "repo.form.reach_limit_of_creation_1" "repo.form.reach_limit_of_creation_n" .MaxCreationLimit}}</p>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
<div class="inline required field {{if .Err_Owner}}error{{end}}">
|
<div class="inline required field {{if .Err_Owner}}error{{end}}">
|
||||||
<label>{{ctx.Locale.Tr "repo.owner"}}</label>
|
<label>{{ctx.Locale.Tr "repo.owner"}}</label>
|
||||||
<div class="ui selection owner dropdown">
|
<div class="ui selection owner dropdown">
|
||||||
@ -26,7 +21,11 @@
|
|||||||
</span>
|
</span>
|
||||||
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}" title="{{.SignedUser.Name}}">
|
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}" title="{{.SignedUser.Name}}"
|
||||||
|
{{if not .CanCreateRepo}}
|
||||||
|
data-create-repo-disallowed-prompt="{{ctx.Locale.TrN .MaxCreationLimit "repo.form.reach_limit_of_creation_1" "repo.form.reach_limit_of_creation_n" .MaxCreationLimit}}"
|
||||||
|
{{end}}
|
||||||
|
>
|
||||||
{{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}}
|
{{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}}
|
||||||
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
|
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
|
||||||
</div>
|
</div>
|
||||||
@ -209,7 +208,7 @@
|
|||||||
<br>
|
<br>
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label></label>
|
<label></label>
|
||||||
<button class="ui primary button{{if not .CanCreateRepo}} disabled{{end}}">
|
<button class="ui primary button">
|
||||||
{{ctx.Locale.Tr "repo.create_repo"}}
|
{{ctx.Locale.Tr "repo.create_repo"}}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import {htmlEscape} from 'escape-goat';
|
import {htmlEscape} from 'escape-goat';
|
||||||
import {hideElem, showElem} from '../utils/dom.ts';
|
import {hideElem, querySingleVisibleElem, showElem, toggleElem} from '../utils/dom.ts';
|
||||||
|
|
||||||
const {appSubUrl} = window.config;
|
const {appSubUrl} = window.config;
|
||||||
|
|
||||||
@ -21,6 +21,20 @@ export function initRepoTemplateSearch() {
|
|||||||
checkTemplate();
|
checkTemplate();
|
||||||
|
|
||||||
const changeOwner = function () {
|
const changeOwner = function () {
|
||||||
|
const elUid = document.querySelector<HTMLInputElement>('#uid');
|
||||||
|
const elForm = elUid.closest('form');
|
||||||
|
const elSubmitButton = querySingleVisibleElem<HTMLInputElement>(elForm, '.ui.primary.button');
|
||||||
|
const elCreateRepoErrorMessage = elForm.querySelector('#create-repo-error-message');
|
||||||
|
const elOwnerItem = document.querySelector(`.ui.selection.owner.dropdown .menu > .item[data-value="${CSS.escape(elUid.value)}"]`);
|
||||||
|
hideElem(elCreateRepoErrorMessage);
|
||||||
|
elSubmitButton.disabled = false;
|
||||||
|
if (elOwnerItem) {
|
||||||
|
elCreateRepoErrorMessage.textContent = elOwnerItem.getAttribute('data-create-repo-disallowed-prompt') ?? '';
|
||||||
|
const hasError = Boolean(elCreateRepoErrorMessage.textContent);
|
||||||
|
toggleElem(elCreateRepoErrorMessage, hasError);
|
||||||
|
elSubmitButton.disabled = hasError;
|
||||||
|
}
|
||||||
|
|
||||||
$('#repo_template_search')
|
$('#repo_template_search')
|
||||||
.dropdown({
|
.dropdown({
|
||||||
apiSettings: {
|
apiSettings: {
|
||||||
|
Reference in New Issue
Block a user