Skip to content

Commit

Permalink
Auto-init repo on license, .gitignore select (#12202)
Browse files Browse the repository at this point in the history
* 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 <alexander.m.scheel@gmail.com>

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
  • Loading branch information
3 people committed Jul 23, 2020
1 parent d25f442 commit 4497db9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions web_src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,17 @@ async function initRepository() {
});
}

// Repo Creation
if ($('.repository.new.repo').length > 0) {
$('input[name="gitignores"], input[name="license"]').on('change', () => {
const gitignores = $('input[name="gitignores"]').prop('checked');
const license = $('input[name="license"]').prop('checked');
if (gitignores || license) {
$('input[name="auto_init"]').prop('checked', true);
}
});
}

// Issues
if ($('.repository.view.issue').length > 0) {
// Edit issue title
Expand Down

0 comments on commit 4497db9

Please sign in to comment.