From 0c14feee194a584912f7f9cac5a0abcf0b5492d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 5 Oct 2023 21:21:48 +0200 Subject: [PATCH] Open proposals dashboard links in the same window Out of the usability issues I've experienced when using Consul Democracy, the biggest one has arguably been the fact that the link to edit a proposal opens in a new tab. I guess the reasoning behind it is that the page to edit a proposal is not part of the proposals dashboard, but what the hell! Imagine if every link to edit something opened in a new tab... So we're reducing the impact of this nonsense by opening most dashboard links in the same window; for now, we're still opening in a new window links to download files and links that might point to external websites. We'll address those ones in the future. --- app/views/dashboard/community.html.erb | 3 +-- app/views/dashboard/mailer/forward.html.erb | 3 +-- ...ew_actions_notification_on_create.html.erb | 3 +-- ...actions_notification_on_published.html.erb | 3 +-- app/views/dashboard/polls/_poll.html.erb | 8 ++------ app/views/dashboard/show.html.erb | 4 +--- .../dashboard/_proposal_header.html.erb | 2 +- .../dashboard/_proposal_totals.html.erb | 4 ++-- spec/system/dashboard/polls_spec.rb | 6 +++--- spec/system/proposals_spec.rb | 20 +++++++++---------- 10 files changed, 23 insertions(+), 33 deletions(-) diff --git a/app/views/dashboard/community.html.erb b/app/views/dashboard/community.html.erb index cdf57a365..e114abeeb 100644 --- a/app/views/dashboard/community.html.erb +++ b/app/views/dashboard/community.html.erb @@ -4,8 +4,7 @@
<%= link_to t("dashboard.community.access_community"), community_path(proposal.community), - class: "button hollow", - target: "_blank" %> + class: "button hollow" %> <% if proposal.community.latest_activity.present? %>

<%= t("dashboard.community.latest_activity", diff --git a/app/views/dashboard/mailer/forward.html.erb b/app/views/dashboard/mailer/forward.html.erb index d8ff79bc0..553ce766a 100644 --- a/app/views/dashboard/mailer/forward.html.erb +++ b/app/views/dashboard/mailer/forward.html.erb @@ -33,8 +33,7 @@ border-radius: 6px; color: #fff !important; font-weight: bold; padding: 17px 20px; text-align: center; text-decoration: none; font-size: 20px; min-width: 200px; display: inline-block; - box-shadow: -4px 18px 45px -19px rgba(0,0,0,0.75);", - target: "_blank" do %> + box-shadow: -4px 18px 45px -19px rgba(0,0,0,0.75);" do %> <%= t("dashboard.mailer.forward.support_button") %> <% end %> diff --git a/app/views/dashboard/mailer/new_actions_notification_on_create.html.erb b/app/views/dashboard/mailer/new_actions_notification_on_create.html.erb index 0f1df7ddd..58ebb342e 100644 --- a/app/views/dashboard/mailer/new_actions_notification_on_create.html.erb +++ b/app/views/dashboard/mailer/new_actions_notification_on_create.html.erb @@ -35,8 +35,7 @@ style: "font-family: 'Open Sans',arial,sans-serif; background: #3700fd; border-radius: 6px; color: #fff !important; font-weight: bold; padding: 17px 20px; text-align: center; text-decoration: none; - font-size: 20px; min-width: 200px; display: inline-block;", - target: "_blank" do %> + font-size: 20px; min-width: 200px; display: inline-block;" do %> <%= t("mailers.new_actions_notification_on_create.dashboard_button") %> <% end %> diff --git a/app/views/dashboard/mailer/new_actions_notification_on_published.html.erb b/app/views/dashboard/mailer/new_actions_notification_on_published.html.erb index 287899d12..3b5bec18b 100644 --- a/app/views/dashboard/mailer/new_actions_notification_on_published.html.erb +++ b/app/views/dashboard/mailer/new_actions_notification_on_published.html.erb @@ -52,8 +52,7 @@ style: "font-family: 'Open Sans',arial,sans-serif; background: #3700fd;" \ "border-radius: 6px; color: #fff !important; font-weight: bold;" \ "padding: 17px 20px; text-align: center; text-decoration: none;" \ - "font-size: 20px; min-width: 200px; display: inline-block;", - target: "_blank" do %> + "font-size: 20px; min-width: 200px; display: inline-block;" do %> <%= t("mailers.new_actions_notification_on_published.dashboard_button") %> <% end %> diff --git a/app/views/dashboard/polls/_poll.html.erb b/app/views/dashboard/polls/_poll.html.erb index d858b1914..26fe74c28 100644 --- a/app/views/dashboard/polls/_poll.html.erb +++ b/app/views/dashboard/polls/_poll.html.erb @@ -1,10 +1,6 @@

-

- <%= link_to poll.title, - proposal_poll_path(proposal, poll), - target: "_blank" %> -

+

<%= link_to poll.title, proposal_poll_path(proposal, poll) %>

<%= l(poll.starts_at.to_date) %> - <%= l(poll.ends_at.to_date) %> @@ -20,7 +16,7 @@ <% else %> <%= link_to t("dashboard.polls.poll.view_results"), results_proposal_poll_path(proposal, poll), - class: "button", target: "_blank" %> + class: "button" %> <% end %>
diff --git a/app/views/dashboard/show.html.erb b/app/views/dashboard/show.html.erb index 952922517..f698f1ca1 100644 --- a/app/views/dashboard/show.html.erb +++ b/app/views/dashboard/show.html.erb @@ -3,15 +3,13 @@ <% if current_editable?(proposal) %> <%= link_to t("dashboard.index.edit_proposal_link"), edit_proposal_path(proposal), - target: "_blank", class: "button hollow" %> <% end %> <% unless proposal.retired? %> <%= link_to t("dashboard.index.retire"), retire_form_proposal_path(proposal), - class: "button hollow alert", - target: "_blank" %> + class: "button hollow alert" %> <% end %> <% if can?(:publish, proposal) %> diff --git a/app/views/layouts/dashboard/_proposal_header.html.erb b/app/views/layouts/dashboard/_proposal_header.html.erb index 58a2693ab..d5a944d82 100644 --- a/app/views/layouts/dashboard/_proposal_header.html.erb +++ b/app/views/layouts/dashboard/_proposal_header.html.erb @@ -1,5 +1,5 @@

- <%= link_to proposal.title, proposal, target: "_blank" %> + <%= link_to proposal.title, proposal %>

<% if proposal.retired? %> diff --git a/app/views/layouts/dashboard/_proposal_totals.html.erb b/app/views/layouts/dashboard/_proposal_totals.html.erb index b828d44ad..b8ffa94dd 100644 --- a/app/views/layouts/dashboard/_proposal_totals.html.erb +++ b/app/views/layouts/dashboard/_proposal_totals.html.erb @@ -47,9 +47,9 @@
diff --git a/spec/system/dashboard/polls_spec.rb b/spec/system/dashboard/polls_spec.rb index 1ab62211b..66a8e5fc6 100644 --- a/spec/system/dashboard/polls_spec.rb +++ b/spec/system/dashboard/polls_spec.rb @@ -256,9 +256,9 @@ describe "Polls" do visit proposal_dashboard_polls_path(proposal) - within_window(window_opened_by { click_link "View results" }) do - expect(page).to have_current_path(results_proposal_poll_path(proposal, poll)) - end + click_link "View results" + + expect(page).to have_current_path(results_proposal_poll_path(proposal, poll)) end scenario "Enable and disable results" do diff --git a/spec/system/proposals_spec.rb b/spec/system/proposals_spec.rb index 9c63bbb8c..eff9755a4 100644 --- a/spec/system/proposals_spec.rb +++ b/spec/system/proposals_spec.rb @@ -423,9 +423,9 @@ describe "Proposals" do click_link "Dashboard" click_link "Edit my proposal" - within_window(window_opened_by { click_link "Edit proposal" }) do - expect(page).to have_field "Full name of the person submitting the proposal", with: "Isabel Garcia" - end + click_link "Edit proposal" + + expect(page).to have_field "Full name of the person submitting the proposal", with: "Isabel Garcia" end scenario "Responsible name field is not shown for verified users" do @@ -628,15 +628,15 @@ describe "Proposals" do click_link "Edit my proposal" end - within_window(window_opened_by { click_link "Withdraw proposal" }) do - expect(page).to have_current_path(retire_form_proposal_path(proposal)) + click_link "Withdraw proposal" - select "Duplicated", from: "proposal_retired_reason" - fill_in "Explanation", with: "There are three other better proposals with the same subject" - click_button "Withdraw proposal" + expect(page).to have_current_path(retire_form_proposal_path(proposal)) - expect(page).to have_content "The proposal has been withdrawn" - end + select "Duplicated", from: "proposal_retired_reason" + fill_in "Explanation", with: "There are three other better proposals with the same subject" + click_button "Withdraw proposal" + + expect(page).to have_content "The proposal has been withdrawn" visit proposal_path(proposal)