Files
nairobi/app/views/dashboard/_proposed_action.html.erb
Javi Martín f21eca4ccc Open custom dashboard links in the same window
We were opening these links in a new tab/window because we assume they
were external links.

But, on the one hand, we don't even know whether these links are
external, since they could also point to URLs from our site. And, on the
other hand, opening external links in new windows results in usability
issues as well [1, 2].

On top of that, old browsers have security issues when opening links in
new tabs unless we add `rel="noopener"` [3], and we aren't doing so.

[1] https://www.nngroup.com/articles/new-browser-windows-and-tabs
[2] https://css-tricks.com/use-target_blank
[3] https://mathiasbynens.github.io/rel-noopener/
2023-10-24 16:31:39 +02:00

58 lines
2.3 KiB
Plaintext

<div id="<%= dom_id(proposed_action) %>">
<div class="action">
<% if proposed_action.proposals.where(id: proposal.id).any? %>
<%= link_to unexecute_proposal_dashboard_action_path(proposal, proposed_action),
id: "#{dom_id(proposed_action)}_unexecute",
method: :post,
class: "checked-link" do %>
<span class="icon-check"></span>
<% end %>
<% else %>
<%= link_to execute_proposal_dashboard_action_path(proposal, proposed_action),
id: "#{dom_id(proposed_action)}_execute",
method: :post,
class: "unchecked-link" do %>
<span class="unchecked"></span>
<% end %>
<% end %>
<div class="action-content">
<h4><%= proposed_action.title %></h4>
<% if is_new_action_since_last_login?(proposed_action, @new_actions_since_last_login) %>
<span class="label"><%= t("dashboard.progress.new_action") %></span>
<% end %>
<% if proposed_action.proposals.where(id: proposal.id).any? %>
<p class="inline">
<%= l(proposed_action.executed_actions.find_by(proposal: proposal).executed_at.to_date) %>
</p>
<% end %>
<% if proposed_action.description.present? %>
<% if proposed_action_long_description?(proposed_action) %>
<div id="truncated_description_<%= dom_id(proposed_action) %>"
data-toggler=".hide">
<%= proposed_action_description(proposed_action) %>
</div>
<button type="button" data-toggle="proposed_action_description_<%= dom_id(proposed_action) %>
truncated_description_<%= dom_id(proposed_action) %>">
<small><%= t("dashboard.recommended_actions.show_description") %></small>
</button>
<div id="proposed_action_description_<%= dom_id(proposed_action) %>" class="hide" data-toggler=".hide">
<%= wysiwyg(proposed_action.description) %>
</div>
<% else %>
<%= wysiwyg(proposed_action.description) %>
<% end %>
<% end %>
<% proposed_action.links.each do |link| %>
<p><%= link_to link.label, link.url %></p>
<% end %>
<% proposed_action.documents.each do |document| %>
<%= render Documents::DocumentComponent.new(document) %>
<% end %>
</div>
</div>
</div>