fix(ui): hide extra PR property labels on title edit (#6898)

* hide labels [AGit](https://codeberg.org/forgejo/forgejo/pulls/2444) and [Editable](https://codeberg.org/forgejo/forgejo/pulls/6863) on title edit mode: they make layout broken and are not really needed at edit state
* make the code slightly less boring

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6898
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net>
Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Co-committed-by: 0ko <0ko@noreply.codeberg.org>
This commit is contained in:
0ko 2025-02-12 08:31:20 +00:00 committed by Gusted
parent 90adede20b
commit a6e0d3e37c
3 changed files with 33 additions and 4 deletions

View file

@ -631,9 +631,11 @@ export function initRepoIssueTitleEdit() {
const issueTitleInput = issueTitleEditor.querySelector('input');
const oldTitle = issueTitleInput.getAttribute('data-old-title');
const normalModeElements = [issueTitleDisplay, '#pull-desc-display', '#agit-label', '#editable-label'];
issueTitleDisplay.querySelector('#issue-title-edit-show').addEventListener('click', () => {
hideElem(issueTitleDisplay);
hideElem('#pull-desc-display');
for (const element of normalModeElements) {
hideElem(element);
}
showElem(issueTitleEditor);
showElem('#pull-desc-editor');
if (!issueTitleInput.value.trim()) {
@ -644,8 +646,9 @@ export function initRepoIssueTitleEdit() {
issueTitleEditor.querySelector('.ui.cancel.button').addEventListener('click', () => {
hideElem(issueTitleEditor);
hideElem('#pull-desc-editor');
showElem(issueTitleDisplay);
showElem('#pull-desc-display');
for (const element of normalModeElements) {
showElem(element);
}
});
const pullDescEditor = document.querySelector('#pull-desc-editor'); // it may not exist for a merged PR