mirror of
https://github.com/go-gitea/gitea
synced 2024-10-15 01:09:55 +02:00
moving the js to a seperated file in web_src/js/features/
Signed-off-by: Alex Lau(AvengerMoJo) <avengermojo@gmail.com>
This commit is contained in:
parent
32cb52662f
commit
c4b923886c
@ -124,6 +124,7 @@
|
||||
{{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}}
|
||||
</form>
|
||||
</div>
|
||||
<!--
|
||||
<script>
|
||||
window.addEventListener('DOMContentLoaded', function() {
|
||||
var checkboxes = document.querySelectorAll('.ui.radio.checkbox');
|
||||
@ -143,3 +144,4 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
-->
|
||||
|
19
web_src/js/features/require-actions-select.js
Normal file
19
web_src/js/features/require-actions-select.js
Normal file
@ -0,0 +1,19 @@
|
||||
export function initRequireActionsSelect() {
|
||||
const raselect = document.getElementById('add-require-actions-modal');
|
||||
if (!raselect) return;
|
||||
const checkboxes = document.querySelectorAll('.ui.radio.checkbox');
|
||||
checkboxes.forEach(function(checkbox) {
|
||||
checkbox.addEventListener('change', function() {
|
||||
var hiddenInput = this.nextElementSibling;
|
||||
var isChecked = this.querySelector('input[type="radio"]').checked;
|
||||
hiddenInput.disabled = !isChecked;
|
||||
// Disable other hidden inputs
|
||||
checkboxes.forEach(function(otherCheckbox) {
|
||||
var otherHiddenInput = otherCheckbox.nextElementSibling;
|
||||
if (otherCheckbox !== checkbox) {
|
||||
otherHiddenInput.disabled = isChecked;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
@ -54,6 +54,7 @@ import {initRepoCodeView} from './features/repo-code.js';
|
||||
import {initSshKeyFormParser} from './features/sshkey-helper.js';
|
||||
import {initUserSettings} from './features/user-settings.js';
|
||||
import {initRepoArchiveLinks} from './features/repo-common.js';
|
||||
import {initRequireActionsSelect} from './features/require-actions-select.js';
|
||||
import {initRepoMigrationStatusChecker} from './features/repo-migrate.js';
|
||||
import {
|
||||
initRepoSettingGitHook,
|
||||
@ -143,6 +144,7 @@ onDomReady(() => {
|
||||
|
||||
initRepoActivityTopAuthorsChart();
|
||||
initRepoArchiveLinks();
|
||||
initRequireActionsSelect();
|
||||
initRepoBranchButton();
|
||||
initRepoCodeView();
|
||||
initRepoCommentForm();
|
||||
|
Loading…
Reference in New Issue
Block a user