Skip to content

Commit

Permalink
fix: org name input field not displaying when checkbox is checked in …
Browse files Browse the repository at this point in the history
…pro pl… (#10588)

…atform

<!-- IMPORTANT CHECKLIST
Make sure you've done all the following (You can delete the checklist
before submitting)
- [ ] PR title is prefixed by one of the following: feat, fix, docs,
style, refactor, test, build, ci, chore, revert, l10n, taxonomy
- [ ] Code is well documented
- [ ] Include unit tests for new functionality
- [ ] Code passes GitHub workflow checks in your branch
- [ ] If you have multiple commits please combine them into one commit
by squashing them.
- [ ] Read and understood the [contribution
guidelines](https://github.com/openfoodfacts/openfoodfacts-server/blob/main/CONTRIBUTING.md)
-->
### What

This pr fixes that issue:
The org name input field is not displaying on pro platform even if the
checkbox is checked.


### Screenshot
![Peek 2024-07-24
11-23](https://github.com/user-attachments/assets/d1fa5b6b-3e32-4bef-9ad0-144474d90102)
  • Loading branch information
4nt0ineB authored Jul 24, 2024
1 parent b815a4e commit 9dfcf29
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
17 changes: 7 additions & 10 deletions templates/web/pages/user_form/user_form.tt.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

\$(document).ready( function () {

\$('#pro').change(function() {
if (\$(this).prop('checked')) {
function checkboxChange(checkbox) {
if (checkbox.checked) {
\$('.pro_org_display').show();
\$('#teams_section').hide();
if ( ! \$('#pro-email-warning').length ) {
Expand All @@ -13,12 +11,11 @@
\$('.pro_org_display').hide();
\$('#teams_section').show();
}
\$(document).foundation('equalizer', 'reflow');
});

if (\$('#pro').prop('checked')) {
\$('.pro_org_display').show();
\$('#teams_section').hide();
}

var proCheckbox = document.getElementById('pro');
checkboxChange(proCheckbox);

proCheckbox.addEventListener('change', function() {
checkboxChange(this);
});
Original file line number Diff line number Diff line change
Expand Up @@ -1658,10 +1658,8 @@ <h3 class="title-5 text-medium">Discover the project</h3>
<script>
$(function() {

$(document).ready( function () {

$('#pro').change(function() {
if ($(this).prop('checked')) {
function checkboxChange(checkbox) {
if (checkbox.checked) {
$('.pro_org_display').show();
$('#teams_section').hide();
if ( ! $('#pro-email-warning').length ) {
Expand All @@ -1672,14 +1670,13 @@ <h3 class="title-5 text-medium">Discover the project</h3>
$('.pro_org_display').hide();
$('#teams_section').show();
}
$(document).foundation('equalizer', 'reflow');
});

if ($('#pro').prop('checked')) {
$('.pro_org_display').show();
$('#teams_section').hide();
}

var proCheckbox = document.getElementById('pro');
checkboxChange(proCheckbox);

proCheckbox.addEventListener('change', function() {
checkboxChange(this);
});

});
Expand Down

0 comments on commit 9dfcf29

Please sign in to comment.