diff options
author | Alexander Scheel <alexander.m.scheel@gmail.com> | 2020-07-23 06:46:41 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-23 13:46:41 +0300 |
commit | 4497db96e0590c16b254c76657fbc13d703cb139 (patch) | |
tree | 726487b3760b12e1ca4fbff4107e268e577fca1d /web_src | |
parent | d25f44285ae4e701a2ad9c97fbd22320a23a81eb (diff) | |
download | gitea-4497db96e0590c16b254c76657fbc13d703cb139.tar.gz gitea-4497db96e0590c16b254c76657fbc13d703cb139.zip |
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 <alexander.m.scheel@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'web_src')
-rw-r--r-- | web_src/js/index.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/web_src/js/index.js b/web_src/js/index.js index 57258b7175..344bcbcdbd 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -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 |