Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of template.visibility #3420

Closed
wants to merge 1 commit into from
Closed

Conversation

aaronskiba
Copy link
Contributor

Fixes #3419

Changes proposed in this PR:

  • app/views/org_admin/templates/_show.html.erb

    • Prior to this commit, if template.visibility == 'organisationally_visible', would always evaluate to false. This is because template.visibility returns an integer value.
  • app/views/org_admin/templates/_form.html.erb

    • f.object.visibility == 'organisationally_visible' always evaluates to false. Thus, prior to this commit, the checkbox would always initially render as unchecked.
    • Also, prior to this commit, the default checked/unchecked values were used (i.e. "1" would be returned when checked, and "0" would be returned when unchecked), and the box is meant to be checked when selecting 'organisationally_visible' ('for internal %{org_name} use only'), which makes the default checked/unchecked values opposite to the mapping of our enums (i.e. {"organisationally_visible"=>0, "publicly_visible"=>1}).

app/views/org_admin/templates/_show.html.erb
- Prior to this commit, `if template.visibility == 'organisationally_visible'`, would always evaluate to false. This is because `template.visibility` returns an integer value.

app/views/org_admin/templates/_form.html.erb
- `f.object.visibility == 'organisationally_visible'` always evaluates to false. Thus, prior to this commit, the checkbox would always initially render as unchecked.
- Also, prior to this commit, the default checked/unchecked values were used (i.e. "1" would be returned when checked, and "0" would be returned when unchecked), and the box is meant to be checked when selecting 'organisationally_visible' ('for internal %{org_name} use only'), which makes the default checked/unchecked values opposite to the mapping of our enums (i.e. `{"organisationally_visible"=>0, "publicly_visible"=>1}`).
Copy link

</tr>
1 Error
🚫

Please include a CHANGELOG entry.

You can find it at [CHANGELOG.md](https://github.com/DMPRoadmap/roadmap/blob/main/CHANGELOG.md).

Generated by 🚫 Danger

@aaronskiba
Copy link
Contributor Author

Closing this because the behaviour of Template.visibility will change with the upgrade to Rails 7. The changes within this PR have been adapted to the following PR: #3435.

@aaronskiba aaronskiba closed this Jul 10, 2024
@aaronskiba aaronskiba deleted the aaron/issues/3419 branch July 11, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant