Skip to content

Commit 4497db9

Browse files
cipherboysilverwindlafriks
authored
Auto-init repo on license, .gitignore select (#12202)
* 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]> Co-authored-by: silverwind <[email protected]> Co-authored-by: Lauris BH <[email protected]>
1 parent d25f442 commit 4497db9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

web_src/js/index.js

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

758+
// Repo Creation
759+
if ($('.repository.new.repo').length > 0) {
760+
$('input[name="gitignores"], input[name="license"]').on('change', () => {
761+
const gitignores = $('input[name="gitignores"]').prop('checked');
762+
const license = $('input[name="license"]').prop('checked');
763+
if (gitignores || license) {
764+
$('input[name="auto_init"]').prop('checked', true);
765+
}
766+
});
767+
}
768+
758769
// Issues
759770
if ($('.repository.view.issue').length > 0) {
760771
// Edit issue title

0 commit comments

Comments
 (0)