Don't mix links and actions in an admin table
In some tables, we had "actions", and some columns were also links
pointing to some places. Having both of them at the same time is
confusing, particularly since traditionally the links in the columns
pointed to the same place as some of the actions (although that's not
the case since commit 48db31cd).
We're still keeping links in tables which don't have an action column.
For instance, the proposals table has a "select" button which would be
harder to use if we had action buttons next to it.
This commit is contained in:
@@ -27,16 +27,12 @@
|
||||
<tbody>
|
||||
<% @processes.each do |process| %>
|
||||
<tr id="<%= dom_id(process) %>">
|
||||
<td class="small-12 medium-6 large-4">
|
||||
<%= link_to process.title, edit_admin_legislation_process_path(process) %>
|
||||
</td>
|
||||
<td class="small-12 medium-6 large-4"><%= process.title %></td>
|
||||
<td><%= t("admin.legislation.processes.process.status_#{process.status}") %></td>
|
||||
<td class="text-center"><%= I18n.l process.start_date %></td>
|
||||
<td class="text-center"><%= I18n.l process.end_date %></td>
|
||||
<td class="text-center"><%= process.total_comments %></td>
|
||||
<td>
|
||||
<%= render Admin::TableActionsComponent.new(process, actions: [:destroy]) %>
|
||||
</td>
|
||||
<td><%= render Admin::TableActionsComponent.new(process) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
||||
@@ -30,9 +30,7 @@
|
||||
<% milestoneable.milestones.order_by_publication_date.each do |milestone| %>
|
||||
<tr id="<%= dom_id(milestone) %>" class="milestone">
|
||||
<td class="text-center"><%= milestone.id %></td>
|
||||
<td>
|
||||
<%= link_to milestone.title, admin_polymorphic_path(milestone, action: :edit) %>
|
||||
</td>
|
||||
<td><%= milestone.title %></td>
|
||||
<td class="small small-5"><%= milestone.description %></td>
|
||||
<td class="small">
|
||||
<%= l(milestone.publication_date.to_date) if milestone.publication_date.present? %>
|
||||
@@ -57,7 +55,6 @@
|
||||
</td>
|
||||
<td class="small-2">
|
||||
<%= render Admin::TableActionsComponent.new(milestone,
|
||||
actions: [:destroy],
|
||||
destroy_text: t("admin.milestones.index.delete")
|
||||
) %>
|
||||
</td>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<tbody>
|
||||
<% @questions.each do |question| %>
|
||||
<tr id="<%= dom_id(question) %>">
|
||||
<td><%= link_to question.title, admin_question_path(question) %></td>
|
||||
<td><%= question.title %></td>
|
||||
<td>
|
||||
<% if question.poll.present? %>
|
||||
<%= question.poll.name %>
|
||||
@@ -27,7 +27,10 @@
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<%= render Admin::TableActionsComponent.new(question) %>
|
||||
<%= render Admin::TableActionsComponent.new(question) do |actions| %>
|
||||
<%= actions.link_to t("admin.polls.show.edit_answers"), admin_question_path(question),
|
||||
class: "button hollow" %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
@@ -9,13 +9,14 @@
|
||||
<% @proposals.each do |proposal| %>
|
||||
<tr id="<%= dom_id(proposal) %>">
|
||||
<td>
|
||||
<%= link_to proposal.title, proposal_path(proposal) %>
|
||||
<%= proposal.title %>
|
||||
<p>
|
||||
<%= proposal.summary %><br>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<%= render Admin::TableActionsComponent.new(actions: []) do |actions| %>
|
||||
<%= actions.link_to t("admin.shared.view"), proposal_path(proposal), class: "button hollow" %>
|
||||
<%= actions.link_to t("admin.questions.index.create_question"),
|
||||
new_admin_question_path(proposal_id: proposal.id),
|
||||
class: "button hollow" %>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
<tr>
|
||||
<th><%= t("admin.site_customization.pages.page.title") %></th>
|
||||
<th><%= t("admin.site_customization.pages.page.slug") %></th>
|
||||
<th><%= t("admin.site_customization.pages.page.cards_title") %></th>
|
||||
<th><%= t("admin.site_customization.pages.page.created_at") %></th>
|
||||
<th><%= t("admin.site_customization.pages.page.updated_at") %></th>
|
||||
<th><%= t("admin.site_customization.pages.page.status") %></th>
|
||||
@@ -23,22 +22,17 @@
|
||||
<tbody>
|
||||
<% @pages.each do |page| %>
|
||||
<tr id="<%= dom_id(page) %>">
|
||||
<td>
|
||||
<%= link_to page.title, edit_admin_site_customization_page_path(page) %>
|
||||
</td>
|
||||
<td><%= page.title %></td>
|
||||
<td><%= page.slug %></td>
|
||||
<td>
|
||||
<%= link_to t("admin.site_customization.pages.page.see_cards"), admin_site_customization_page_cards_path(page),
|
||||
class: "button hollow expanded" %>
|
||||
</td>
|
||||
<td><%= I18n.l page.created_at, format: :short %></td>
|
||||
<td><%= I18n.l page.created_at, format: :short %></td>
|
||||
<td><%= t("admin.site_customization.pages.page.status_#{page.status}") %></td>
|
||||
<td>
|
||||
<%= render Admin::TableActionsComponent.new(page,
|
||||
actions: [:destroy],
|
||||
destroy_text: t("admin.site_customization.pages.index.delete")
|
||||
) do |actions| %>
|
||||
<%= render Admin::TableActionsComponent.new(page) do |actions| %>
|
||||
<%= actions.link_to t("admin.site_customization.pages.page.see_cards"),
|
||||
admin_site_customization_page_cards_path(page),
|
||||
class: "button hollow expanded" %>
|
||||
|
||||
<% if page.status == "published" %>
|
||||
<%= actions.link_to t("admin.site_customization.pages.index.see_page"),
|
||||
page.url,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<tr>
|
||||
<td><%= link_to valuator.name, admin_valuator_path(valuator) %></td>
|
||||
<td><%= valuator.name %></td>
|
||||
<td><%= valuator.email %></td>
|
||||
<td>
|
||||
<% if valuator.description.present? %>
|
||||
@@ -19,6 +19,10 @@
|
||||
<%= valuator_abilities(valuator) %>
|
||||
</td>
|
||||
<td>
|
||||
<%= render Admin::TableActionsComponent.new(valuator) %>
|
||||
<%= render Admin::TableActionsComponent.new(valuator) do |actions| %>
|
||||
<%= actions.link_to t("admin.shared.view"),
|
||||
admin_valuator_path(valuator),
|
||||
class: "button hollow" %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1512,7 +1512,6 @@ en:
|
||||
updated_at: Updated at
|
||||
title: Title
|
||||
slug: Slug
|
||||
cards_title: Cards
|
||||
see_cards: See Cards
|
||||
cards:
|
||||
cards_title: cards
|
||||
|
||||
@@ -1511,7 +1511,6 @@ es:
|
||||
updated_at: Última actualización
|
||||
title: Título
|
||||
slug: Slug
|
||||
cards_title: Tarjetas
|
||||
see_cards: Ver tarjetas
|
||||
cards:
|
||||
cards_title: tarjetas
|
||||
|
||||
@@ -90,7 +90,7 @@ shared_examples "admin_milestoneable" do |factory_name, path_name|
|
||||
visit path
|
||||
expect(page).to have_link document.title
|
||||
|
||||
click_link milestone.title
|
||||
within("tr", text: milestone.title) { click_link "Edit" }
|
||||
|
||||
expect(page).to have_css("img[alt='#{milestone.image.title}']")
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ describe "Admin legislation draft versions" do
|
||||
|
||||
visit admin_legislation_processes_path(filter: "all")
|
||||
|
||||
click_link "An example legislation process"
|
||||
within("tr", text: "An example legislation process") { click_link "Edit" }
|
||||
click_link "Drafting"
|
||||
click_link "Version 1"
|
||||
|
||||
@@ -41,10 +41,7 @@ describe "Admin legislation draft versions" do
|
||||
end
|
||||
|
||||
click_link "All"
|
||||
|
||||
expect(page).to have_content "An example legislation process"
|
||||
|
||||
click_link "An example legislation process"
|
||||
within("tr", text: "An example legislation process") { click_link "Edit" }
|
||||
click_link "Drafting"
|
||||
|
||||
click_link "Create version"
|
||||
@@ -77,7 +74,7 @@ describe "Admin legislation draft versions" do
|
||||
|
||||
expect(page).not_to have_link "All"
|
||||
|
||||
click_link "An example legislation process"
|
||||
within("tr", text: "An example legislation process") { click_link "Edit" }
|
||||
click_link "Drafting"
|
||||
|
||||
click_link "Version 1"
|
||||
|
||||
@@ -201,7 +201,7 @@ describe "Admin collaborative legislation" do
|
||||
click_link "Collaborative Legislation"
|
||||
end
|
||||
|
||||
click_link "An example legislation process"
|
||||
within("tr", text: "An example legislation process") { click_link "Edit" }
|
||||
|
||||
expect(page).to have_selector("h2", text: "An example legislation process")
|
||||
expect(find("#legislation_process_debate_phase_enabled")).to be_checked
|
||||
@@ -224,7 +224,7 @@ describe "Admin collaborative legislation" do
|
||||
click_link "Collaborative Legislation"
|
||||
end
|
||||
|
||||
click_link "An example legislation process"
|
||||
within("tr", text: "An example legislation process") { click_link "Edit" }
|
||||
|
||||
expect(find("#legislation_process_draft_publication_enabled")).to be_checked
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ describe "Admin legislation questions" do
|
||||
|
||||
visit admin_legislation_processes_path(filter: "all")
|
||||
|
||||
click_link "An example legislation process"
|
||||
within("tr", text: "An example legislation process") { click_link "Edit" }
|
||||
click_link "Debate"
|
||||
|
||||
expect(page).to have_content("Question 1")
|
||||
@@ -43,9 +43,7 @@ describe "Admin legislation questions" do
|
||||
|
||||
click_link "All"
|
||||
|
||||
expect(page).to have_content "An example legislation process"
|
||||
|
||||
click_link "An example legislation process"
|
||||
within("tr", text: "An example legislation process") { click_link "Edit" }
|
||||
click_link "Debate"
|
||||
|
||||
click_link "Create question"
|
||||
@@ -71,9 +69,8 @@ describe "Admin legislation questions" do
|
||||
|
||||
expect(page).not_to have_link "All"
|
||||
|
||||
click_link "An example legislation process"
|
||||
within("tr", text: "An example legislation process") { click_link "Edit" }
|
||||
click_link "Debate"
|
||||
|
||||
click_link "Question 2"
|
||||
|
||||
fill_in "Question", with: "Question 2b"
|
||||
|
||||
@@ -70,7 +70,7 @@ describe "Admin custom pages" do
|
||||
click_link "Custom pages"
|
||||
end
|
||||
|
||||
click_link "An example custom page"
|
||||
within("tr", text: "An example custom page") { click_link "Edit" }
|
||||
|
||||
expect(page).to have_selector("h2", text: "An example custom page")
|
||||
expect(page).to have_selector("input[value='custom-example-page']")
|
||||
|
||||
Reference in New Issue
Block a user