Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-29 05:06:11 +01:00

Fix JS error and improve error message styles (#29963)

Fixes: https://github.com/go-gitea/gitea/issues/29956. This error
exposed a existing bug in the code, it was just never noticed because
the jQuery expression evaluated without error before while the new one
doesn't.

Also improves error message styles:

Before:
<img width="1338" alt="Screenshot 2024-03-21 at 09 16 07"
src="https://github.com/go-gitea/gitea/assets/115237/1cc1ef89-ad94-491e-bbca-75387f7547a0">

After:
<img width="1335" alt="Screenshot 2024-03-21 at 09 15 44"
src="https://github.com/go-gitea/gitea/assets/115237/312efc79-5353-4e2a-a703-1bccd3c01736">

(cherry picked from commit 1a4f693f9f9723c181b747cb6d658aa37118005a)
This commit is contained in:
silverwind 2024-03-21 11:16:11 +01:00 committed by Earl Warren
parent cb656d1a43
commit faed93370f
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
2 changed files with 3 additions and 1 deletions

View file

@ -23,7 +23,7 @@ export function showGlobalErrorMessage(msg) {
let msgDiv = pageContent.querySelector(`.js-global-error[data-global-error-msg-compact="${msgCompact}"]`); let msgDiv = pageContent.querySelector(`.js-global-error[data-global-error-msg-compact="${msgCompact}"]`);
if (!msgDiv) { if (!msgDiv) {
const el = document.createElement('div'); const el = document.createElement('div');
el.innerHTML = `<div class="ui container negative message center aligned js-global-error" style="white-space: pre-line;"></div>`; el.innerHTML = `<div class="ui container negative message center aligned js-global-error tw-mt-[15px] tw-whitespace-pre-line"></div>`;
msgDiv = el.childNodes[0]; msgDiv = el.childNodes[0];
} }
// merge duplicated messages into "the message (count)" format // merge duplicated messages into "the message (count)" format

View file

@ -76,6 +76,8 @@ export function initRepoCommonBranchOrTagDropdown(selector) {
export function initRepoCommonFilterSearchDropdown(selector) { export function initRepoCommonFilterSearchDropdown(selector) {
const $dropdown = $(selector); const $dropdown = $(selector);
if (!$dropdown.length) return;
$dropdown.dropdown({ $dropdown.dropdown({
fullTextSearch: 'exact', fullTextSearch: 'exact',
selectOnKeydown: false, selectOnKeydown: false,