Skip to content

Commit 79bc222

Browse files
authored
Merge branch 'release/v1.23' into backport-project-view
2 parents c605d74 + eee4a75 commit 79bc222

File tree

4 files changed

+23
-22
lines changed

4 files changed

+23
-22
lines changed

templates/repo/create.tmpl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@
1010
<div class="ui attached segment">
1111
{{template "base/alert" .}}
1212
{{template "repo/create_helper" .}}
13-
14-
{{if not .CanCreateRepo}}
15-
<div class="ui negative message">
16-
<p>{{ctx.Locale.TrN .MaxCreationLimit "repo.form.reach_limit_of_creation_1" "repo.form.reach_limit_of_creation_n" .MaxCreationLimit}}</p>
17-
</div>
18-
{{end}}
13+
<div id="create-repo-error-message" class="ui negative message tw-text-center tw-hidden"></div>
1914
<div class="inline required field {{if .Err_Owner}}error{{end}}">
2015
<label>{{ctx.Locale.Tr "repo.owner"}}</label>
2116
<div class="ui selection owner dropdown">
@@ -26,7 +21,11 @@
2621
</span>
2722
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
2823
<div class="menu">
29-
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}" title="{{.SignedUser.Name}}">
24+
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}" title="{{.SignedUser.Name}}"
25+
{{if not .CanCreateRepo}}
26+
data-create-repo-disallowed-prompt="{{ctx.Locale.TrN .MaxCreationLimit "repo.form.reach_limit_of_creation_1" "repo.form.reach_limit_of_creation_n" .MaxCreationLimit}}"
27+
{{end}}
28+
>
3029
{{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}}
3130
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
3231
</div>
@@ -209,7 +208,7 @@
209208
<br>
210209
<div class="inline field">
211210
<label></label>
212-
<button class="ui primary button{{if not .CanCreateRepo}} disabled{{end}}">
211+
<button class="ui primary button">
213212
{{ctx.Locale.Tr "repo.create_repo"}}
214213
</button>
215214
</div>

web_src/css/base.css

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,14 +1225,7 @@ table th[data-sortt-desc] .svg {
12251225
box-shadow: 0 0 0 1px var(--color-secondary) inset;
12261226
}
12271227

1228-
.emoji {
1229-
font-size: 1.25em;
1230-
line-height: var(--line-height-default);
1231-
font-style: normal !important;
1232-
font-weight: var(--font-weight-normal) !important;
1233-
vertical-align: -0.075em;
1234-
}
1235-
1228+
/* for "image" emojis like ":git:" ":gitea:" and ":github:" (see CUSTOM_EMOJIS config option) */
12361229
.emoji img {
12371230
border-width: 0 !important;
12381231
margin: 0 !important;

web_src/css/markup/content.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,6 @@
337337
padding-right: 28px;
338338
}
339339

340-
.markup .emoji {
341-
max-width: none;
342-
vertical-align: text-top;
343-
}
344-
345340
.markup span.frame {
346341
display: block;
347342
overflow: hidden;

web_src/js/features/repo-template.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import $ from 'jquery';
22
import {htmlEscape} from 'escape-goat';
3-
import {hideElem, showElem} from '../utils/dom.ts';
3+
import {hideElem, querySingleVisibleElem, showElem, toggleElem} from '../utils/dom.ts';
44

55
const {appSubUrl} = window.config;
66

@@ -21,6 +21,20 @@ export function initRepoTemplateSearch() {
2121
checkTemplate();
2222

2323
const changeOwner = function () {
24+
const elUid = document.querySelector<HTMLInputElement>('#uid');
25+
const elForm = elUid.closest('form');
26+
const elSubmitButton = querySingleVisibleElem<HTMLInputElement>(elForm, '.ui.primary.button');
27+
const elCreateRepoErrorMessage = elForm.querySelector('#create-repo-error-message');
28+
const elOwnerItem = document.querySelector(`.ui.selection.owner.dropdown .menu > .item[data-value="${CSS.escape(elUid.value)}"]`);
29+
hideElem(elCreateRepoErrorMessage);
30+
elSubmitButton.disabled = false;
31+
if (elOwnerItem) {
32+
elCreateRepoErrorMessage.textContent = elOwnerItem.getAttribute('data-create-repo-disallowed-prompt') ?? '';
33+
const hasError = Boolean(elCreateRepoErrorMessage.textContent);
34+
toggleElem(elCreateRepoErrorMessage, hasError);
35+
elSubmitButton.disabled = hasError;
36+
}
37+
2438
$('#repo_template_search')
2539
.dropdown({
2640
apiSettings: {

0 commit comments

Comments
 (0)