Files
nairobi/app/components/officing/menu_component.html.erb
Javi Martín 985d3da032 Move officing menu partial to a component
This way we can move some system tests to component tests and stop
creating records after starting the browser with a `visit`.

We could also split the system test in two, but since these tests
aren't checking any user interactions, moving the to component tests we
check the same things while making the tests faster.

Since the partial was using an instance variable, we're passing it to
the component. We're naming it `voter_user` instead of `user` because
passing something named `user` could make us think that we're passing
the `current_user`. I wasn't sure about naming it `voter` because it's a
`User` record and not a `Poll::Voter` record, but naming it `voter`
would definitely be an option.
2025-04-01 15:08:55 +02:00

18 lines
767 B
Plaintext

<div class="admin-sidebar">
<ul id="officing_menu">
<% if vote_collection_shift? %>
<li class="<%= "js-vote-collection" %>
<%= " is-active" if controller_name == "voters" %>
<%= " is-hidden" if controller_name == "voters" && Poll.votable_by(voter_user).any? %>">
<%= link_to t("officing.menu.voters"), new_officing_residence_path, class: "users-link" %>
</li>
<% end %>
<% if final_recount_shift? %>
<li <%= "class=is-active" if ["results", "ballot_sheets"].include?(controller_name) || (controller_name == "polls" && action_name == "final") %>>
<%= link_to t("officing.menu.total_recounts"), final_officing_polls_path, class: "users-link" %>
</li>
<% end %>
</ul>
</div>