Skip to content

Commit 63a0256

Browse files
committed
Auto-init repo on license, .gitignore select
When a .gitignore or LICENSE file is added, the user is expecting the repository to be auto-initialized. However, nothing sets the auto_init value, so it remains at its default. We should set it to checked when a .gitignore or LICENSE file is added, matching user expectations. If the user clears .gitignore or LICENSE, it will leave repository creation enabled. If the user changes the value again, it will re-check the box if the user has since de-checked it. This behavior is at least consistent. Resolves: #11071 Signed-off-by: Alexander Scheel <[email protected]>
1 parent 6a62884 commit 63a0256

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

web_src/js/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,23 @@ async function initRepository() {
754754
});
755755
}
756756

757+
// Repo Creation
758+
if ($('.repository.new.repo').length > 0) {
759+
const markAutoInitialize = function (element) {
760+
if (element.value.length > 0) {
761+
$('input[name="auto_init"]')[0].checked = true;
762+
}
763+
};
764+
765+
$('input[name="gitignores"]').on('change', (evt) => {
766+
markAutoInitialize(evt.target);
767+
});
768+
769+
$('input[name="license"]').on('change', (evt) => {
770+
markAutoInitialize(evt.target);
771+
});
772+
}
773+
757774
// Issues
758775
if ($('.repository.view.issue').length > 0) {
759776
// Edit issue title

0 commit comments

Comments
 (0)