mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 11:28:24 +00:00 
			
		
		
		
	Forbid variables containing jQuery collections not having the $ prefix (#29839)
				
					
				
			See https://github.com/wikimedia/eslint-plugin-no-jquery/blob/master/docs/rules/variable-pattern.md --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
		| @@ -6,23 +6,23 @@ function isExclusiveScopeName(name) { | ||||
| } | ||||
|  | ||||
| function updateExclusiveLabelEdit(form) { | ||||
|   const nameInput = $(`${form} .label-name-input`); | ||||
|   const exclusiveField = $(`${form} .label-exclusive-input-field`); | ||||
|   const exclusiveCheckbox = $(`${form} .label-exclusive-input`); | ||||
|   const exclusiveWarning = $(`${form} .label-exclusive-warning`); | ||||
|   const $nameInput = $(`${form} .label-name-input`); | ||||
|   const $exclusiveField = $(`${form} .label-exclusive-input-field`); | ||||
|   const $exclusiveCheckbox = $(`${form} .label-exclusive-input`); | ||||
|   const $exclusiveWarning = $(`${form} .label-exclusive-warning`); | ||||
|  | ||||
|   if (isExclusiveScopeName(nameInput.val())) { | ||||
|     exclusiveField.removeClass('muted'); | ||||
|     exclusiveField.removeAttr('aria-disabled'); | ||||
|     if (exclusiveCheckbox.prop('checked') && exclusiveCheckbox.data('exclusive-warn')) { | ||||
|       exclusiveWarning.removeClass('gt-hidden'); | ||||
|   if (isExclusiveScopeName($nameInput.val())) { | ||||
|     $exclusiveField.removeClass('muted'); | ||||
|     $exclusiveField.removeAttr('aria-disabled'); | ||||
|     if ($exclusiveCheckbox.prop('checked') && $exclusiveCheckbox.data('exclusive-warn')) { | ||||
|       $exclusiveWarning.removeClass('gt-hidden'); | ||||
|     } else { | ||||
|       exclusiveWarning.addClass('gt-hidden'); | ||||
|       $exclusiveWarning.addClass('gt-hidden'); | ||||
|     } | ||||
|   } else { | ||||
|     exclusiveField.addClass('muted'); | ||||
|     exclusiveField.attr('aria-disabled', 'true'); | ||||
|     exclusiveWarning.addClass('gt-hidden'); | ||||
|     $exclusiveField.addClass('muted'); | ||||
|     $exclusiveField.attr('aria-disabled', 'true'); | ||||
|     $exclusiveWarning.addClass('gt-hidden'); | ||||
|   } | ||||
| } | ||||
|  | ||||
| @@ -46,18 +46,18 @@ export function initCompLabelEdit(selector) { | ||||
|     $('.edit-label .color-picker').minicolors('value', $(this).data('color')); | ||||
|     $('#label-modal-id').val($(this).data('id')); | ||||
|  | ||||
|     const nameInput = $('.edit-label .label-name-input'); | ||||
|     nameInput.val($(this).data('title')); | ||||
|     const $nameInput = $('.edit-label .label-name-input'); | ||||
|     $nameInput.val($(this).data('title')); | ||||
|  | ||||
|     const isArchivedCheckbox = $('.edit-label .label-is-archived-input'); | ||||
|     isArchivedCheckbox.prop('checked', this.hasAttribute('data-is-archived')); | ||||
|     const $isArchivedCheckbox = $('.edit-label .label-is-archived-input'); | ||||
|     $isArchivedCheckbox.prop('checked', this.hasAttribute('data-is-archived')); | ||||
|  | ||||
|     const exclusiveCheckbox = $('.edit-label .label-exclusive-input'); | ||||
|     exclusiveCheckbox.prop('checked', this.hasAttribute('data-exclusive')); | ||||
|     const $exclusiveCheckbox = $('.edit-label .label-exclusive-input'); | ||||
|     $exclusiveCheckbox.prop('checked', this.hasAttribute('data-exclusive')); | ||||
|     // Warn when label was previously not exclusive and used in issues | ||||
|     exclusiveCheckbox.data('exclusive-warn', | ||||
|     $exclusiveCheckbox.data('exclusive-warn', | ||||
|       $(this).data('num-issues') > 0 && | ||||
|       (!this.hasAttribute('data-exclusive') || !isExclusiveScopeName(nameInput.val()))); | ||||
|       (!this.hasAttribute('data-exclusive') || !isExclusiveScopeName($nameInput.val()))); | ||||
|     updateExclusiveLabelEdit('.edit-label'); | ||||
|  | ||||
|     $('.edit-label .label-desc-input').val($(this).data('description')); | ||||
|   | ||||
| @@ -17,21 +17,21 @@ export function initCompReactionSelector($parent) { | ||||
|  | ||||
|     const data = await res.json(); | ||||
|     if (data && (data.html || data.empty)) { | ||||
|       const content = $(this).closest('.content'); | ||||
|       let react = content.find('.segment.reactions'); | ||||
|       if ((!data.empty || data.html === '') && react.length > 0) { | ||||
|         react.remove(); | ||||
|       const $content = $(this).closest('.content'); | ||||
|       let $react = $content.find('.segment.reactions'); | ||||
|       if ((!data.empty || data.html === '') && $react.length > 0) { | ||||
|         $react.remove(); | ||||
|       } | ||||
|       if (!data.empty) { | ||||
|         const attachments = content.find('.segment.bottom:first'); | ||||
|         react = $(data.html); | ||||
|         if (attachments.length > 0) { | ||||
|           react.insertBefore(attachments); | ||||
|         const $attachments = $content.find('.segment.bottom:first'); | ||||
|         $react = $(data.html); | ||||
|         if ($attachments.length > 0) { | ||||
|           $react.insertBefore($attachments); | ||||
|         } else { | ||||
|           react.appendTo(content); | ||||
|           $react.appendTo($content); | ||||
|         } | ||||
|         react.find('.dropdown').dropdown(); | ||||
|         initCompReactionSelector(react); | ||||
|         $react.find('.dropdown').dropdown(); | ||||
|         initCompReactionSelector($react); | ||||
|       } | ||||
|     } | ||||
|   }); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user