diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-04-17 23:35:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-17 11:35:57 -0400 |
commit | f20057271def2240474d64c57eeba8b365642c08 (patch) | |
tree | 4b7b081a4ab7b5ba8a593b651fc199d1d59732b4 /web_src/js/features | |
parent | 4b1c6cd8e5745a945df0f72233964f6aede8a3a6 (diff) | |
download | gitea-f20057271def2240474d64c57eeba8b365642c08.tar.gz gitea-f20057271def2240474d64c57eeba8b365642c08.zip |
Fix Org edit page bugs: renaming detection, maxlength (#24161)
## Before
* The renaming detection is wrong (eg: pasting a new name into the input
doesn't trigger the detection)
* The renaming prompt layout is not good
* Some MaxSize/maxlength rules is missing
![image](https://user-images.githubusercontent.com/2114189/232379191-5d0f6d10-56ca-4cec-ac52-7f77b9cb4a8a.png)
![image](https://user-images.githubusercontent.com/2114189/232379234-3289373b-9ddb-4627-ae86-f4d74589fa0c.png)
## After
* Fix these problems
![image](https://user-images.githubusercontent.com/2114189/232379098-31c6fa21-c210-4e7f-a337-b38b99670835.png)
Diffstat (limited to 'web_src/js/features')
-rw-r--r-- | web_src/js/features/common-organization.js | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/web_src/js/features/common-organization.js b/web_src/js/features/common-organization.js index 1796efc6a8..352e824b05 100644 --- a/web_src/js/features/common-organization.js +++ b/web_src/js/features/common-organization.js @@ -1,25 +1,16 @@ import $ from 'jquery'; import {initCompLabelEdit} from './comp/LabelEdit.js'; -import {hideElem, showElem} from '../utils/dom.js'; +import {toggleElem} from '../utils/dom.js'; export function initCommonOrganization() { if ($('.organization').length === 0) { return; } - if ($('.organization.settings.options').length > 0) { - $('#org_name').on('keyup', function () { - const $prompt = $('#org-name-change-prompt'); - const $prompt_redirect = $('#org-name-change-redirect-prompt'); - if ($(this).val().toString().toLowerCase() !== $(this).data('org-name').toString().toLowerCase()) { - showElem($prompt); - showElem($prompt_redirect); - } else { - hideElem($prompt); - hideElem($prompt_redirect); - } - }); - } + $('.organization.settings.options #org_name').on('input', function () { + const nameChanged = $(this).val().toLowerCase() !== $(this).attr('data-org-name').toLowerCase(); + toggleElem('#org-name-change-prompt', nameChanged); + }); // Labels initCompLabelEdit('.organization.settings.labels'); |