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

bug-fix: duplicating copy right year #1385

Closed

Conversation

Gabe-Torres
Copy link
Contributor

add: "data: { turbo: "false" }" on adoptable pet link.

🔗 Issue

(#1367)

✍️ Description

After looking into this bug, I found that Turbo caches previous pages for faster navigation/refreshes, which was causing the duplication problem I think. Adding data: { turbo: "false" } to the adoptable pet link in the organization home index view fixed this by forcing a full page refresh when navigating back.

If this is the approach we want to take, there may be other instances where this is needed. I’m also curious about the extent to which the application relies on Turbo. Could disabling Turbo in this way cause any unintended issues?

📷 Screenshots/Demos

https://jam.dev/c/09dca437-db81-46da-ab55-1fce93fb9bdd

add: "data: { turbo: "false" }" on adoptable pet link.
@jmilljr24
Copy link
Collaborator

@Gabe-Torres I think the issue is going to come up anywhere the footer partial is used (which link you click and go back from shouldn't matter). We should leave turbo enabled.

Can you take a look at the two partials where the copyright is. layouts/shared/_footer and _no_tenant_footer. The append is probably the problem.

<span id="copyright"> <script>document.getElementById('copyright').appendChild(document.createTextNode(new Date().getFullYear()))</script> </span>

Maybe something like this will do the trick:
document.getElementById('copyright').innerHTML = new Date().getFullYear()

@MooseCowBear
Copy link
Collaborator

@jmilljr24 Maybe there's something I'm missing but is there a reason to prefer a script here? Couldn't we use Time.now.year to display the current year?

@jmilljr24
Copy link
Collaborator

jmilljr24 commented Mar 1, 2025

@jmilljr24 Maybe there's something I'm missing but is there a reason to prefer a script here? Couldn't we use Time.now.year to display the current year?

That's definitely better! The script was already being used and I didn't look into it further. I can't think of a good reason to use the inline script. Thanks for pointing it out.

@Gabe-Torres
Copy link
Contributor Author

@jmilljr24 Maybe there's something I'm missing but is there a reason to prefer a script here? Couldn't we use Time.now.year to display the current year?

Thank you @MooseCowBear. That does indeed fix the issue! 👍🏽

Remove script and update with <%= Time.now.year %> to get current year for copyright.
add: "data: { turbo: "false" }" on adoptable pet link.
Remove script and update with <%= Time.now.year %> to get current year for copyright.
@Gabe-Torres Gabe-Torres force-pushed the 1367_copyright_year_duplication branch from 8583028 to f58dd20 Compare March 4, 2025 00:10
Copy link
Collaborator

@jmilljr24 jmilljr24 left a comment

Choose a reason for hiding this comment

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

Just some leftover changes from your previous troubleshooting that we don't need.

@@ -37,7 +37,7 @@
<!--//? bootstrap cards -->
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-4 mt-4 w-100 justify-content-center">
<% @pets.each do |pet| %>
<%= link_to adoptable_pet_path(pet) do %>
<%= link_to adoptable_pet_path(pet), data: { turbo: "false" } do %>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<%= link_to adoptable_pet_path(pet), data: { turbo: "false" } do %>
<%= link_to adoptable_pet_path(pet) do %>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought I took it out! Sorry about that. I’ve just removed it, and I believe everything is updated now. My commit history is a bit messy on this branch. For future reference, what is the best way to clean it up? I’d like to make sure that only the relevant commits are included in the push, with any unnecessary ones removed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@Gabe-Torres for this repo we do a squash and merge into main so it really doesn't matter. You can take a look at the commit history for main and see what is actually in there. Other organizations may have a different policies on what commits that want to in the history.

From your end, look up interactive rebase if you really want to clean up your commits before opening a PR. After the PR is open I generally wouldn't changing your commit history.

…hub.com/Gabe-Torres/homeward-tails into 1367_copyright_year_duplication"

This reverts commit 8583028, reversing
changes made to 8e9278f.
Remove script and update with <%= Time.now.year %> to get current year for copyright.
@Gabe-Torres Gabe-Torres requested a review from jmilljr24 March 4, 2025 03:16
cassieemb and others added 4 commits March 3, 2025 22:09
author Cassie <58792902+cassieemb@users.noreply.github.com> 1740690506 -0600
committer Gabriel Torres <127896538+Gabe-Torres@users.noreply.github.com> 1741061319 -0600

add start and end date to foster card (rubyforgood#1381)

bug-fix: duplicating copy right year

Remove script and update with <%= Time.now.year %> to get current year for copyright.

bug-fix: duplicating copy right year

add: "data: { turbo: "false" }" on adoptable pet link.

Revert "Merge branch '1367_copyright_year_duplication' of https://github.com/Gabe-Torres/homeward-tails into 1367_copyright_year_duplication"

This reverts commit 8583028, reversing
changes made to 8e9278f.
Bumps [kamal](https://github.com/basecamp/kamal) from 2.5.2 to 2.5.3.
- [Release notes](https://github.com/basecamp/kamal/releases)
- [Commits](basecamp/kamal@v2.5.2...v2.5.3)

---
updated-dependencies:
- dependency-name: kamal
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
)

* display upcoming fosters

modify controller method to display upcoming and current fosters, add tests, modify card to show badge with the status of the foster

* change name from h3 to h4

* stack badge under photo

* increase name size and orient badge under name

bug-fix: duplicating copy right year

add: "data: { turbo: "false" }" on adoptable pet link.
@Gabe-Torres
Copy link
Contributor Author

Gabe-Torres commented Mar 4, 2025

I'm going to close this branch and make a new one. I got into a bit of a Git mess and think it'll be better to start over for such a small change. 😨

EDIT - new pr that looks much cleaner - #1388

@jmilljr24 jmilljr24 closed this Mar 4, 2025
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.

4 participants