mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 03:18:24 +00:00 
			
		
		
		
	Migrate gt-hidden to tw-hidden (#30046)
				
					
				
			We have to define this one in helpers.css because tailwind only generates a single class but certain things rely on this being double-class. Command ran: ```sh perl -p -i -e 's#gt-hidden#tw-hidden#g' web_src/js/**/* templates/**/* models/**/* web_src/css/**/* --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
		| @@ -15,14 +15,14 @@ function updateExclusiveLabelEdit(form) { | ||||
|     $exclusiveField.removeClass('muted'); | ||||
|     $exclusiveField.removeAttr('aria-disabled'); | ||||
|     if ($exclusiveCheckbox[0].checked && $exclusiveCheckbox.data('exclusive-warn')) { | ||||
|       $exclusiveWarning.removeClass('gt-hidden'); | ||||
|       $exclusiveWarning.removeClass('tw-hidden'); | ||||
|     } else { | ||||
|       $exclusiveWarning.addClass('gt-hidden'); | ||||
|       $exclusiveWarning.addClass('tw-hidden'); | ||||
|     } | ||||
|   } else { | ||||
|     $exclusiveField.addClass('muted'); | ||||
|     $exclusiveField.attr('aria-disabled', 'true'); | ||||
|     $exclusiveWarning.addClass('gt-hidden'); | ||||
|     $exclusiveWarning.addClass('tw-hidden'); | ||||
|   } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -35,7 +35,7 @@ async function receiveUpdateCount(event) { | ||||
|     const data = JSON.parse(event.data); | ||||
|  | ||||
|     for (const count of document.querySelectorAll('.notification_count')) { | ||||
|       count.classList.toggle('gt-hidden', data.Count === 0); | ||||
|       count.classList.toggle('tw-hidden', data.Count === 0); | ||||
|       count.textContent = `${data.Count}`; | ||||
|     } | ||||
|     await updateNotificationTable(); | ||||
| @@ -179,9 +179,9 @@ async function updateNotificationCount() { | ||||
|  | ||||
|     const $notificationCount = $('.notification_count'); | ||||
|     if (data.new === 0) { | ||||
|       $notificationCount.addClass('gt-hidden'); | ||||
|       $notificationCount.addClass('tw-hidden'); | ||||
|     } else { | ||||
|       $notificationCount.removeClass('gt-hidden'); | ||||
|       $notificationCount.removeClass('tw-hidden'); | ||||
|     } | ||||
|  | ||||
|     $notificationCount.text(`${data.new}`); | ||||
|   | ||||
| @@ -42,8 +42,8 @@ function initRepoDiffFileViewToggle() { | ||||
|     $this.addClass('active'); | ||||
|  | ||||
|     const $target = $($this.data('toggle-selector')); | ||||
|     $target.parent().children().addClass('gt-hidden'); | ||||
|     $target.removeClass('gt-hidden'); | ||||
|     $target.parent().children().addClass('tw-hidden'); | ||||
|     $target.removeClass('tw-hidden'); | ||||
|   }); | ||||
| } | ||||
|  | ||||
| @@ -118,7 +118,7 @@ export function initRepoDiffConversationNav() { | ||||
|   // Previous/Next code review conversation | ||||
|   $(document).on('click', '.previous-conversation', (e) => { | ||||
|     const $conversation = $(e.currentTarget).closest('.comment-code-cloud'); | ||||
|     const $conversations = $('.comment-code-cloud:not(.gt-hidden)'); | ||||
|     const $conversations = $('.comment-code-cloud:not(.tw-hidden)'); | ||||
|     const index = $conversations.index($conversation); | ||||
|     const previousIndex = index > 0 ? index - 1 : $conversations.length - 1; | ||||
|     const $previousConversation = $conversations.eq(previousIndex); | ||||
| @@ -127,7 +127,7 @@ export function initRepoDiffConversationNav() { | ||||
|   }); | ||||
|   $(document).on('click', '.next-conversation', (e) => { | ||||
|     const $conversation = $(e.currentTarget).closest('.comment-code-cloud'); | ||||
|     const $conversations = $('.comment-code-cloud:not(.gt-hidden)'); | ||||
|     const $conversations = $('.comment-code-cloud:not(.tw-hidden)'); | ||||
|     const index = $conversations.index($conversation); | ||||
|     const nextIndex = index < $conversations.length - 1 ? index + 1 : 0; | ||||
|     const $nextConversation = $conversations.eq(nextIndex); | ||||
|   | ||||
| @@ -57,9 +57,9 @@ export function initRepoGraphGit() { | ||||
|     ajaxUrl.searchParams.set('div-only', 'true'); | ||||
|     window.history.replaceState({}, '', queryString ? `?${queryString}` : window.location.pathname); | ||||
|     $('#pagination').empty(); | ||||
|     $('#rel-container').addClass('gt-hidden'); | ||||
|     $('#rev-container').addClass('gt-hidden'); | ||||
|     $('#loading-indicator').removeClass('gt-hidden'); | ||||
|     $('#rel-container').addClass('tw-hidden'); | ||||
|     $('#rev-container').addClass('tw-hidden'); | ||||
|     $('#loading-indicator').removeClass('tw-hidden'); | ||||
|     (async () => { | ||||
|       const response = await GET(String(ajaxUrl)); | ||||
|       const html = await response.text(); | ||||
| @@ -67,9 +67,9 @@ export function initRepoGraphGit() { | ||||
|       $('#pagination').html($div.find('#pagination').html()); | ||||
|       $('#rel-container').html($div.find('#rel-container').html()); | ||||
|       $('#rev-container').html($div.find('#rev-container').html()); | ||||
|       $('#loading-indicator').addClass('gt-hidden'); | ||||
|       $('#rel-container').removeClass('gt-hidden'); | ||||
|       $('#rev-container').removeClass('gt-hidden'); | ||||
|       $('#loading-indicator').addClass('tw-hidden'); | ||||
|       $('#rel-container').removeClass('tw-hidden'); | ||||
|       $('#rev-container').removeClass('tw-hidden'); | ||||
|     })(); | ||||
|   }; | ||||
|   const dropdownSelected = params.getAll('branch'); | ||||
|   | ||||
| @@ -18,7 +18,7 @@ function showContentHistoryDetail(issueBaseUrl, commentId, historyId, itemTitleH | ||||
|   ${svg('octicon-x', 16, 'close icon inside')} | ||||
|   <div class="header tw-flex tw-items-center tw-justify-between"> | ||||
|     <div>${itemTitleHtml}</div> | ||||
|     <div class="ui dropdown dialog-header-options tw-mr-8 gt-hidden"> | ||||
|     <div class="ui dropdown dialog-header-options tw-mr-8 tw-hidden"> | ||||
|       ${i18nTextOptions} | ||||
|       ${svg('octicon-triangle-down', 14, 'dropdown icon')} | ||||
|       <div class="menu"> | ||||
| @@ -76,7 +76,7 @@ function showContentHistoryDetail(issueBaseUrl, commentId, historyId, itemTitleH | ||||
|         $dialog.find('.comment-diff-data').removeClass('is-loading').html(resp.diffHtml); | ||||
|         // there is only one option "item[data-option-item=delete]", so the dropdown can be entirely shown/hidden. | ||||
|         if (resp.canSoftDelete) { | ||||
|           $dialog.find('.dialog-header-options').removeClass('gt-hidden'); | ||||
|           $dialog.find('.dialog-header-options').removeClass('tw-hidden'); | ||||
|         } | ||||
|       } catch (error) { | ||||
|         console.error('Error:', error); | ||||
|   | ||||
| @@ -222,7 +222,7 @@ export function initRepoIssueCodeCommentCancel() { | ||||
|   $(document).on('click', '.cancel-code-comment', (e) => { | ||||
|     const $form = $(e.currentTarget).closest('form'); | ||||
|     if ($form.length > 0 && $form.hasClass('comment-form')) { | ||||
|       $form.addClass('gt-hidden'); | ||||
|       $form.addClass('tw-hidden'); | ||||
|       showElem($form.closest('.comment-code-cloud').find('button.comment-form-reply')); | ||||
|     } else { | ||||
|       $form.closest('.comment-code-cloud').remove(); | ||||
| @@ -397,7 +397,7 @@ export function initRepoIssueComments() { | ||||
| export async function handleReply($el) { | ||||
|   hideElem($el); | ||||
|   const $form = $el.closest('.comment-code-cloud').find('.comment-form'); | ||||
|   $form.removeClass('gt-hidden'); | ||||
|   $form.removeClass('tw-hidden'); | ||||
|  | ||||
|   const $textarea = $form.find('textarea'); | ||||
|   let editor = getComboMarkdownEditor($textarea); | ||||
| @@ -433,10 +433,10 @@ export function initRepoPullRequestReview() { | ||||
|         if ($diffHeader[0]) { | ||||
|           offset += $('.diff-detail-box').outerHeight() + $diffHeader.outerHeight(); | ||||
|         } | ||||
|         $(`#show-outdated-${id}`).addClass('gt-hidden'); | ||||
|         $(`#code-comments-${id}`).removeClass('gt-hidden'); | ||||
|         $(`#code-preview-${id}`).removeClass('gt-hidden'); | ||||
|         $(`#hide-outdated-${id}`).removeClass('gt-hidden'); | ||||
|         $(`#show-outdated-${id}`).addClass('tw-hidden'); | ||||
|         $(`#code-comments-${id}`).removeClass('tw-hidden'); | ||||
|         $(`#code-preview-${id}`).removeClass('tw-hidden'); | ||||
|         $(`#hide-outdated-${id}`).removeClass('tw-hidden'); | ||||
|         // if the comment box is folded, expand it | ||||
|         if ($ancestorDiffBox.attr('data-folded') && $ancestorDiffBox.attr('data-folded') === 'true') { | ||||
|           setFileFolding($ancestorDiffBox[0], $ancestorDiffBox.find('.fold-file')[0], false); | ||||
| @@ -452,19 +452,19 @@ export function initRepoPullRequestReview() { | ||||
|   $(document).on('click', '.show-outdated', function (e) { | ||||
|     e.preventDefault(); | ||||
|     const id = $(this).data('comment'); | ||||
|     $(this).addClass('gt-hidden'); | ||||
|     $(`#code-comments-${id}`).removeClass('gt-hidden'); | ||||
|     $(`#code-preview-${id}`).removeClass('gt-hidden'); | ||||
|     $(`#hide-outdated-${id}`).removeClass('gt-hidden'); | ||||
|     $(this).addClass('tw-hidden'); | ||||
|     $(`#code-comments-${id}`).removeClass('tw-hidden'); | ||||
|     $(`#code-preview-${id}`).removeClass('tw-hidden'); | ||||
|     $(`#hide-outdated-${id}`).removeClass('tw-hidden'); | ||||
|   }); | ||||
|  | ||||
|   $(document).on('click', '.hide-outdated', function (e) { | ||||
|     e.preventDefault(); | ||||
|     const id = $(this).data('comment'); | ||||
|     $(this).addClass('gt-hidden'); | ||||
|     $(`#code-comments-${id}`).addClass('gt-hidden'); | ||||
|     $(`#code-preview-${id}`).addClass('gt-hidden'); | ||||
|     $(`#show-outdated-${id}`).removeClass('gt-hidden'); | ||||
|     $(this).addClass('tw-hidden'); | ||||
|     $(`#code-comments-${id}`).addClass('tw-hidden'); | ||||
|     $(`#code-preview-${id}`).addClass('tw-hidden'); | ||||
|     $(`#show-outdated-${id}`).removeClass('tw-hidden'); | ||||
|   }); | ||||
|  | ||||
|   $(document).on('click', 'button.comment-form-reply', async function (e) { | ||||
|   | ||||
| @@ -31,7 +31,7 @@ const {csrfToken} = window.config; | ||||
| // if there are draft comments, confirm before reloading, to avoid losing comments | ||||
| function reloadConfirmDraftComment() { | ||||
|   const commentTextareas = [ | ||||
|     document.querySelector('.edit-content-zone:not(.gt-hidden) textarea'), | ||||
|     document.querySelector('.edit-content-zone:not(.tw-hidden) textarea'), | ||||
|     document.querySelector('#comment-form textarea'), | ||||
|   ]; | ||||
|   for (const textarea of commentTextareas) { | ||||
| @@ -197,15 +197,15 @@ export function initRepoCommentForm() { | ||||
|       $(this).parent().find('.item').each(function () { | ||||
|         if ($(this).hasClass('checked')) { | ||||
|           listIds.push($(this).data('id')); | ||||
|           $($(this).data('id-selector')).removeClass('gt-hidden'); | ||||
|           $($(this).data('id-selector')).removeClass('tw-hidden'); | ||||
|         } else { | ||||
|           $($(this).data('id-selector')).addClass('gt-hidden'); | ||||
|           $($(this).data('id-selector')).addClass('tw-hidden'); | ||||
|         } | ||||
|       }); | ||||
|       if (listIds.length === 0) { | ||||
|         $noSelect.removeClass('gt-hidden'); | ||||
|         $noSelect.removeClass('tw-hidden'); | ||||
|       } else { | ||||
|         $noSelect.addClass('gt-hidden'); | ||||
|         $noSelect.addClass('tw-hidden'); | ||||
|       } | ||||
|       $($(this).parent().data('id')).val(listIds.join(',')); | ||||
|       return false; | ||||
| @@ -234,9 +234,9 @@ export function initRepoCommentForm() { | ||||
|       } | ||||
|  | ||||
|       $list.find('.item').each(function () { | ||||
|         $(this).addClass('gt-hidden'); | ||||
|         $(this).addClass('tw-hidden'); | ||||
|       }); | ||||
|       $noSelect.removeClass('gt-hidden'); | ||||
|       $noSelect.removeClass('tw-hidden'); | ||||
|       $($(this).parent().data('id')).val(''); | ||||
|     }); | ||||
|   } | ||||
| @@ -286,7 +286,7 @@ export function initRepoCommentForm() { | ||||
|         </a> | ||||
|       `); | ||||
|  | ||||
|       $(`.ui${select_id}.list .no-select`).addClass('gt-hidden'); | ||||
|       $(`.ui${select_id}.list .no-select`).addClass('tw-hidden'); | ||||
|       $(input_id).val($(this).data('id')); | ||||
|     }); | ||||
|     $menu.find('.no-select.item').on('click', function () { | ||||
| @@ -307,7 +307,7 @@ export function initRepoCommentForm() { | ||||
|       } | ||||
|  | ||||
|       $list.find('.selected').html(''); | ||||
|       $list.find('.no-select').removeClass('gt-hidden'); | ||||
|       $list.find('.no-select').removeClass('tw-hidden'); | ||||
|       $(input_id).val(''); | ||||
|     }); | ||||
|   } | ||||
|   | ||||
| @@ -49,7 +49,7 @@ export async function renderMermaid() { | ||||
|       iframe.srcdoc = `<html><head><style>${iframeCss}</style></head><body>${svg}</body></html>`; | ||||
|  | ||||
|       const mermaidBlock = document.createElement('div'); | ||||
|       mermaidBlock.classList.add('mermaid-block', 'is-loading', 'gt-hidden'); | ||||
|       mermaidBlock.classList.add('mermaid-block', 'is-loading', 'tw-hidden'); | ||||
|       mermaidBlock.append(iframe); | ||||
|  | ||||
|       const btn = makeCodeCopyButton(); | ||||
| @@ -58,7 +58,7 @@ export async function renderMermaid() { | ||||
|  | ||||
|       iframe.addEventListener('load', () => { | ||||
|         pre.replaceWith(mermaidBlock); | ||||
|         mermaidBlock.classList.remove('gt-hidden'); | ||||
|         mermaidBlock.classList.remove('tw-hidden'); | ||||
|         iframe.style.height = `${iframe.contentWindow.document.body.clientHeight}px`; | ||||
|         setTimeout(() => { // avoid flash of iframe background | ||||
|           mermaidBlock.classList.remove('is-loading'); | ||||
|   | ||||
| @@ -213,7 +213,7 @@ export const SvgIcon = { | ||||
|       classes.push(...this.className.split(/\s+/).filter(Boolean)); | ||||
|     } | ||||
|     if (this.symbolId) { | ||||
|       classes.push('gt-hidden', 'svg-symbol-container'); | ||||
|       classes.push('tw-hidden', 'svg-symbol-container'); | ||||
|       svgInnerHtml = `<symbol id="${this.symbolId}" viewBox="${attrs['^viewBox']}">${svgInnerHtml}</symbol>`; | ||||
|     } | ||||
|     // create VNode | ||||
|   | ||||
| @@ -22,11 +22,11 @@ function elementsCall(el, func, ...args) { | ||||
|  */ | ||||
| function toggleShown(el, force) { | ||||
|   if (force === true) { | ||||
|     el.classList.remove('gt-hidden'); | ||||
|     el.classList.remove('tw-hidden'); | ||||
|   } else if (force === false) { | ||||
|     el.classList.add('gt-hidden'); | ||||
|     el.classList.add('tw-hidden'); | ||||
|   } else if (force === undefined) { | ||||
|     el.classList.toggle('gt-hidden'); | ||||
|     el.classList.toggle('tw-hidden'); | ||||
|   } else { | ||||
|     throw new Error('invalid force argument'); | ||||
|   } | ||||
| @@ -46,7 +46,7 @@ export function toggleElem(el, force) { | ||||
|  | ||||
| export function isElemHidden(el) { | ||||
|   const res = []; | ||||
|   elementsCall(el, (e) => res.push(e.classList.contains('gt-hidden'))); | ||||
|   elementsCall(el, (e) => res.push(e.classList.contains('tw-hidden'))); | ||||
|   if (res.length > 1) throw new Error(`isElemHidden doesn't work for multiple elements`); | ||||
|   return res[0]; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user