-
Notifications
You must be signed in to change notification settings - Fork 1
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
1492: Synchronizations follow up #303
Conversation
19dd795
to
ca71666
Compare
<% if status == :in_progress %> | ||
<div class="grid-row in-progress"> | ||
<svg class="in-progress usa-icon border-05 rotate border-base-light radius-pill padding-1 usa-icon--size-5" aria-hidden="true" focusable="false" role="img"> | ||
<use | ||
xlink:href="<%= asset_path("@uswds/uswds/dist/img/sprite.svg#autorenew") %>" | ||
></use> | ||
</svg> | ||
</div> | ||
<div class="grid-row in-progress"> | ||
<span class="margin-top-05 text-thin"><%= label %></span> | ||
</div> | ||
<% end %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These could probably be turned into partials but eh
031e046
to
e389c9a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Some ideas for refactoring that you can take if you agree that they would be simpler.
app/app/models/pinwheel_account.rb
Outdated
@@ -1,6 +1,10 @@ | |||
class PinwheelAccount < ApplicationRecord | |||
belongs_to :cbv_flow | |||
|
|||
after_update_commit { | |||
broadcast_replace target: self, partial: "cbv/synchronizations/indicators", locals: { pinwheel_account: self } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably rendering in the default locale because there's no connection to the locale the current user is using.
You may be able to get the partial to render in the right locale by surrounding this in:
I18n.with_locale(cbv_flow.cbv_flow_invitation.language) do
broadcast_replace # ...
end
but that won't take into account any locale change during the flow. We could store the locale on the Cbv Flow as well (updating it every time it changes), which would be more resilient to this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try that!
Someone has a PR up that should fix it. Is there anything in there we could use? I assume we infer the current locale through params /es/some-path
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, it's set on every request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the problem with that is it's set on the controller action, and these view updates are streamed through websockets, which I believe aren't flowing through controller logic...
I'm still surprised turbo doesn't support this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The manual fix here works fine except in cases when locale is switched during the session. Then the user will see flashes of translated content in some other locale.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a branch showing how the PR linked above fixes the issue: https://github.com/DSACMS/iv-cbv-payroll/tree/wmg/try-turbo-locale-patch
fb2b8ef
to
4b90dd0
Compare
Co-authored-by: Tom Dooner <[email protected]>
# Conflicts: # app/config/locales/en.yml # app/config/locales/es.yml
8872915
to
faa1cf1
Compare
Ticket
https://jiraent.cms.gov/browse/FFS-1492
Changes
Switches to Turbo Streams for indicator views. Shows job statuses
Context for reviewers
Test manually with https://docs.pinwheelapi.com/public/docs/sandbox#income-and-employment-job-errors
Testing