Remove redundant links in admin tables

There were places where we had two links pointing to the same place; one
link would be the name/title of a record, and one link would be under
the "actions" column.

This is confusing, since users would probably expect these links to
point to different places (which is what happens in other tables in the
admin section) and might try to click one of them and then the other
one and be surprised when they found out both of them go to the same
page.
This commit is contained in:
Javi Martín
2020-07-06 20:45:48 +02:00
parent 7cb0a4135b
commit 48db31cd6b
12 changed files with 12 additions and 20 deletions

View File

@@ -22,7 +22,7 @@
<tbody> <tbody>
<% @groups.each do |group| %> <% @groups.each do |group| %>
<tr id="<%= dom_id(group) %>"> <tr id="<%= dom_id(group) %>">
<td><%= link_to group.name, edit_admin_budget_group_path(@budget, group) %></td> <td><%= group.name %></td>
<td><%= group.max_votable_headings %></td> <td><%= group.max_votable_headings %></td>
<td><%= group.headings.count %></td> <td><%= group.headings.count %></td>
<td> <td>

View File

@@ -24,7 +24,7 @@
<tbody> <tbody>
<% @headings.each do |heading| %> <% @headings.each do |heading| %>
<tr id="<%= dom_id(heading) %>" class="heading"> <tr id="<%= dom_id(heading) %>" class="heading">
<td><%= link_to heading.name, edit_admin_budget_group_heading_path(@budget, @group, heading) %></td> <td><%= heading.name %></td>
<td><%= @budget.formatted_heading_price(heading) %></td> <td><%= @budget.formatted_heading_price(heading) %></td>
<% if @budget.approval_voting? %> <% if @budget.approval_voting? %>
<td><%= heading.max_ballot_lines %></td> <td><%= heading.max_ballot_lines %></td>

View File

@@ -16,9 +16,7 @@
<tbody> <tbody>
<% @officials.each do |official| %> <% @officials.each do |official| %>
<tr> <tr>
<td> <td><%= official.name %></td>
<%= link_to official.name, edit_admin_official_path(official) %>
</td>
<td> <td>
<span class="label level-<%= official.official_level %>"> <span class="label level-<%= official.official_level %>">
<%= official.official_position %> <%= official.official_position %>

View File

@@ -1,8 +1,6 @@
<tr id="<%= dom_id(poll) %>" class="poll"> <tr id="<%= dom_id(poll) %>" class="poll">
<td> <td>
<strong> <strong><%= poll.name %></strong>
<%= link_to poll.name, admin_poll_path(poll) %>
</strong>
</td> </td>
<td class="text-center"> <td class="text-center">
<%= l poll.starts_at.to_date %> <%= l poll.starts_at.to_date %>

View File

@@ -18,9 +18,7 @@
<% @poll.questions.each do |question| %> <% @poll.questions.each do |question| %>
<tr id="<%= dom_id(question) %>"> <tr id="<%= dom_id(question) %>">
<td> <td>
<strong> <strong><%= question.title %></strong>
<%= link_to question.title, admin_question_path(question) %>
</strong>
<% if question.proposal.present? %> <% if question.proposal.present? %>
<small> <small>
<%= link_to t("admin.polls.show.see_proposal"), <%= link_to t("admin.polls.show.see_proposal"),

View File

@@ -10,9 +10,7 @@
<tbody> <tbody>
<% @polls.each do |poll| %> <% @polls.each do |poll| %>
<tr id="<%= dom_id(poll) %>" class="poll"> <tr id="<%= dom_id(poll) %>" class="poll">
<td> <td><%= poll.name %></td>
<%= link_to poll.name, manage_admin_poll_booth_assignments_path(poll) %>
</td>
<td> <td>
<%= l poll.starts_at.to_date %> - <%= l poll.ends_at.to_date %> <%= l poll.starts_at.to_date %> - <%= l poll.ends_at.to_date %>
</td> </td>

View File

@@ -128,7 +128,7 @@ describe "Admin budget groups" do
click_button "Create new group" click_button "Create new group"
expect(page).to have_content "Group created successfully!" expect(page).to have_content "Group created successfully!"
expect(page).to have_link "All City" expect(page).to have_content "All City"
end end
scenario "Maximum number of headings in which a user can vote is set to 1 by default" do scenario "Maximum number of headings in which a user can vote is set to 1 by default" do

View File

@@ -148,7 +148,7 @@ describe "Admin budget headings" do
click_button "Create new heading" click_button "Create new heading"
expect(page).to have_content "Heading created successfully!" expect(page).to have_content "Heading created successfully!"
expect(page).to have_link "All City" expect(page).to have_content "All City"
expect(page).to have_content "€1,000" expect(page).to have_content "€1,000"
expect(page).to have_content "10000" expect(page).to have_content "10000"
expect(page).to have_content "Yes" expect(page).to have_content "Yes"

View File

@@ -19,7 +19,7 @@ describe "Admin officials" do
scenario "Edit an official" do scenario "Edit an official" do
visit admin_officials_path visit admin_officials_path
click_link official.name click_link "Edit official"
expect(page).to have_current_path(edit_admin_official_path(official)) expect(page).to have_current_path(edit_admin_official_path(official))

View File

@@ -16,7 +16,7 @@ describe "Admin booths assignments" do
visit booth_assignments_admin_polls_path visit booth_assignments_admin_polls_path
expect(page).to have_link(poll.name, href: manage_admin_poll_booth_assignments_path(poll)) expect(page).to have_link("Manage assignments", href: manage_admin_poll_booth_assignments_path(poll))
expect(page).to have_content(second_poll.name) expect(page).to have_content(second_poll.name)
within("#poll_#{second_poll.id}") do within("#poll_#{second_poll.id}") do

View File

@@ -58,7 +58,7 @@ describe "Admin polls" do
poll = create(:poll) poll = create(:poll)
visit admin_polls_path visit admin_polls_path
click_link poll.name click_link "Configure"
expect(page).to have_content poll.name expect(page).to have_content poll.name
end end

View File

@@ -52,7 +52,7 @@ describe "Admin poll questions" do
question = create(:poll_question, poll: poll) question = create(:poll_question, poll: poll)
visit admin_poll_path(poll) visit admin_poll_path(poll)
click_link question.title click_link "Edit answers"
expect(page).to have_content(question.title) expect(page).to have_content(question.title)
expect(page).to have_content(question.author.name) expect(page).to have_content(question.author.name)