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.
This commit is contained in:
Javi Martín
2023-10-05 21:21:48 +02:00
parent ef7486ddc6
commit 0c14feee19
10 changed files with 23 additions and 33 deletions

View File

@@ -4,8 +4,7 @@
<div class="small-12 medium-9 column"> <div class="small-12 medium-9 column">
<%= link_to t("dashboard.community.access_community"), <%= link_to t("dashboard.community.access_community"),
community_path(proposal.community), community_path(proposal.community),
class: "button hollow", class: "button hollow" %>
target: "_blank" %>
<% if proposal.community.latest_activity.present? %> <% if proposal.community.latest_activity.present? %>
<p class="help-text"> <p class="help-text">
<%= t("dashboard.community.latest_activity", <%= t("dashboard.community.latest_activity",

View File

@@ -33,8 +33,7 @@
border-radius: 6px; color: #fff !important; font-weight: bold; border-radius: 6px; color: #fff !important; font-weight: bold;
padding: 17px 20px; text-align: center; text-decoration: none; padding: 17px 20px; text-align: center; text-decoration: none;
font-size: 20px; min-width: 200px; display: inline-block; font-size: 20px; min-width: 200px; display: inline-block;
box-shadow: -4px 18px 45px -19px rgba(0,0,0,0.75);", box-shadow: -4px 18px 45px -19px rgba(0,0,0,0.75);" do %>
target: "_blank" do %>
<%= t("dashboard.mailer.forward.support_button") %> <%= t("dashboard.mailer.forward.support_button") %>
<% end %> <% end %>
</td> </td>

View File

@@ -35,8 +35,7 @@
style: "font-family: 'Open Sans',arial,sans-serif; background: #3700fd; style: "font-family: 'Open Sans',arial,sans-serif; background: #3700fd;
border-radius: 6px; color: #fff !important; font-weight: bold; border-radius: 6px; color: #fff !important; font-weight: bold;
padding: 17px 20px; text-align: center; text-decoration: none; padding: 17px 20px; text-align: center; text-decoration: none;
font-size: 20px; min-width: 200px; display: inline-block;", font-size: 20px; min-width: 200px; display: inline-block;" do %>
target: "_blank" do %>
<%= t("mailers.new_actions_notification_on_create.dashboard_button") %> <%= t("mailers.new_actions_notification_on_create.dashboard_button") %>
<% end %> <% end %>
</td> </td>

View File

@@ -52,8 +52,7 @@
style: "font-family: 'Open Sans',arial,sans-serif; background: #3700fd;" \ style: "font-family: 'Open Sans',arial,sans-serif; background: #3700fd;" \
"border-radius: 6px; color: #fff !important; font-weight: bold;" \ "border-radius: 6px; color: #fff !important; font-weight: bold;" \
"padding: 17px 20px; text-align: center; text-decoration: none;" \ "padding: 17px 20px; text-align: center; text-decoration: none;" \
"font-size: 20px; min-width: 200px; display: inline-block;", "font-size: 20px; min-width: 200px; display: inline-block;" do %>
target: "_blank" do %>
<%= t("mailers.new_actions_notification_on_published.dashboard_button") %> <%= t("mailers.new_actions_notification_on_published.dashboard_button") %>
<% end %> <% end %>
</td> </td>

View File

@@ -1,10 +1,6 @@
<div id="<%= dom_id(poll) %>" class="small-12 medium-6 large-4 column end"> <div id="<%= dom_id(poll) %>" class="small-12 medium-6 large-4 column end">
<div class="poll-card" data-equalizer-watch="poll-cards"> <div class="poll-card" data-equalizer-watch="poll-cards">
<h4> <h4><%= link_to poll.title, proposal_poll_path(proposal, poll) %></h4>
<%= link_to poll.title,
proposal_poll_path(proposal, poll),
target: "_blank" %>
</h4>
<span class="small"> <span class="small">
<%= l(poll.starts_at.to_date) %> - <%= l(poll.ends_at.to_date) %> <%= l(poll.starts_at.to_date) %> - <%= l(poll.ends_at.to_date) %>
</span> </span>
@@ -20,7 +16,7 @@
<% else %> <% else %>
<%= link_to t("dashboard.polls.poll.view_results"), <%= link_to t("dashboard.polls.poll.view_results"),
results_proposal_poll_path(proposal, poll), results_proposal_poll_path(proposal, poll),
class: "button", target: "_blank" %> class: "button" %>
<% end %> <% end %>
</div> </div>

View File

@@ -3,15 +3,13 @@
<% if current_editable?(proposal) %> <% if current_editable?(proposal) %>
<%= link_to t("dashboard.index.edit_proposal_link"), <%= link_to t("dashboard.index.edit_proposal_link"),
edit_proposal_path(proposal), edit_proposal_path(proposal),
target: "_blank",
class: "button hollow" %> class: "button hollow" %>
<% end %> <% end %>
<% unless proposal.retired? %> <% unless proposal.retired? %>
<%= link_to t("dashboard.index.retire"), <%= link_to t("dashboard.index.retire"),
retire_form_proposal_path(proposal), retire_form_proposal_path(proposal),
class: "button hollow alert", class: "button hollow alert" %>
target: "_blank" %>
<% end %> <% end %>
<% if can?(:publish, proposal) %> <% if can?(:publish, proposal) %>

View File

@@ -1,5 +1,5 @@
<h3 class="proposal-title"> <h3 class="proposal-title">
<%= link_to proposal.title, proposal, target: "_blank" %> <%= link_to proposal.title, proposal %>
</h3> </h3>
<% if proposal.retired? %> <% if proposal.retired? %>

View File

@@ -47,9 +47,9 @@
<div class="small-12 column"> <div class="small-12 column">
<div class="proposal-link"> <div class="proposal-link">
<% if proposal.draft? %> <% if proposal.draft? %>
<%= link_to t("layouts.dashboard.proposal_totals.preview_proposal"), proposal_path(proposal), class: "button success expanded", target: "_blank" %> <%= link_to t("layouts.dashboard.proposal_totals.preview_proposal"), proposal_path(proposal), class: "button success expanded" %>
<% else %> <% else %>
<%= link_to t("layouts.dashboard.proposal_totals.show_proposal"), proposal_path(proposal), class: "button success expanded", target: "_blank" %> <%= link_to t("layouts.dashboard.proposal_totals.show_proposal"), proposal_path(proposal), class: "button success expanded" %>
<% end %> <% end %>
</div> </div>
</div> </div>

View File

@@ -256,10 +256,10 @@ describe "Polls" do
visit proposal_dashboard_polls_path(proposal) visit proposal_dashboard_polls_path(proposal)
within_window(window_opened_by { click_link "View results" }) do click_link "View results"
expect(page).to have_current_path(results_proposal_poll_path(proposal, poll)) expect(page).to have_current_path(results_proposal_poll_path(proposal, poll))
end end
end
scenario "Enable and disable results" do scenario "Enable and disable results" do
create(:poll, related: proposal) create(:poll, related: proposal)

View File

@@ -423,10 +423,10 @@ describe "Proposals" do
click_link "Dashboard" click_link "Dashboard"
click_link "Edit my proposal" click_link "Edit my proposal"
within_window(window_opened_by { click_link "Edit proposal" }) do click_link "Edit proposal"
expect(page).to have_field "Full name of the person submitting the proposal", with: "Isabel Garcia" expect(page).to have_field "Full name of the person submitting the proposal", with: "Isabel Garcia"
end end
end
scenario "Responsible name field is not shown for verified users" do scenario "Responsible name field is not shown for verified users" do
author = create(:user, :level_two) author = create(:user, :level_two)
@@ -628,7 +628,8 @@ describe "Proposals" do
click_link "Edit my proposal" click_link "Edit my proposal"
end end
within_window(window_opened_by { click_link "Withdraw proposal" }) do click_link "Withdraw proposal"
expect(page).to have_current_path(retire_form_proposal_path(proposal)) expect(page).to have_current_path(retire_form_proposal_path(proposal))
select "Duplicated", from: "proposal_retired_reason" select "Duplicated", from: "proposal_retired_reason"
@@ -636,7 +637,6 @@ describe "Proposals" do
click_button "Withdraw proposal" click_button "Withdraw proposal"
expect(page).to have_content "The proposal has been withdrawn" expect(page).to have_content "The proposal has been withdrawn"
end
visit proposal_path(proposal) visit proposal_path(proposal)