Skip to content
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
Comment on lines +761 to +762
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized that these are not checkboxes :D These lines should have been:

      const gitignores = $('input[name="gitignores"]').val() !== '';
      const license = $('input[name="license"]').val() !== '';

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right I missed it too. .val() should be sufficient and possible more future-proof just in case the value of a empty select box ever changes to null or undefined.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for PR. I don't think jQuery would return null or undefined but not sure. Have not used jQuery for quite some time already 😂

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing to do with jQuery, but I guess DOM <input> value is probably guaranteed to be a string (even for type=number 😆).

if (gitignores || license) {
$('input[name="auto_init"]').prop('checked', true);
}
});
}

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