Files
nairobi/app/views/dashboard/_recommended_actions_by_status.html.erb
Javi Martín 6ea9383743 Allow toggling elements with the keyboard
Using `<a>` tags with no `href` means these elements cannot be activated
by keyboard users, so we're replacing them with buttons.

In the future we probably want to add more consistency so all toggle
buttons use the same code. We might also add styles depending on the
`aria-expanded` property.
2021-03-31 13:38:38 +02:00

36 lines
1.6 KiB
Plaintext

<h3 class="title"><%= t("dashboard.recommended_actions.#{status}_title") %></h3>
<% if actions.any? %>
<div id="proposed_actions_<%= status %>" class="proposed-actions">
<% actions.first(4).each do |proposed_action| %>
<%= render "proposed_action", proposed_action: proposed_action %>
<% end %>
<% if actions.count > 4 %>
<div class="margin small" id="proposed_actions_<%= status %>_link" data-toggler=".hide">
<% if toggle == true %>
<button type="button" id="see_proposed_actions_link_<%= status %>" data-toggle="last_proposed_actions_<%= status %> proposed_actions_<%= status %>_link">
<strong><%= t("dashboard.recommended_actions.see_proposed_actions") %></strong>
</button>
<% else %>
<%= link_to recommended_actions_proposal_dashboard_path(proposal.to_param) do %>
<strong><%= t("dashboard.recommended_actions.goto_proposed_actions") %></strong>
<% end %>
<% end %>
</div>
<% end %>
</div>
<% if toggle == true %>
<% if actions.count > 4 %>
<div id="last_proposed_actions_<%= status %>" class="hide proposed-actions" data-toggler=".hide">
<%= render partial: "proposed_action", collection: actions - actions.first(4) %>
<div class="margin small">
<button type="button" data-toggle="last_proposed_actions_<%= status %> proposed_actions_<%= status %>_link">
<strong><%= t("dashboard.recommended_actions.hide_proposed_actions") %></strong>
</button>
</div>
</div>
<% end %>
<% end %>
<% else %>
<%= t("dashboard.recommended_actions.without_#{status}_actions") %>
<% end %>