Use order links in legislation proposals admin
As mentioned in the previous commits, a `<select>` field which submits its form on change causes many accessibility and usability issues, so we're replacing it with the order links we use everywhere else. Since the links "Id" and "Title" by themselves don't have enough information to let users know they're used to sort by ID or title, we have to update them somehow. We could add a "Sort by:" prefix before the list of links (and associate it with the `aria-labelledby` attribute); however, we don't do this anywhere else and might look weird depending on the screen size. So we're simply adding "Sort by" before each link. Now that we don't use the `wide_order_selector` partial anymore, we can remove it alongside the styles for the `select-order` class.
This commit is contained in:
@@ -340,10 +340,6 @@ $table-header: #ecf1f6;
|
|||||||
.is-featured {
|
.is-featured {
|
||||||
margin-top: rem-calc(36);
|
margin-top: rem-calc(36);
|
||||||
}
|
}
|
||||||
|
|
||||||
.select-order {
|
|
||||||
min-width: rem-calc(160);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.for-print-only {
|
.for-print-only {
|
||||||
|
|||||||
@@ -2039,25 +2039,6 @@ table {
|
|||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wide-order-selector {
|
|
||||||
float: none;
|
|
||||||
margin-top: 0;
|
|
||||||
|
|
||||||
@include breakpoint(medium) {
|
|
||||||
float: right;
|
|
||||||
margin-top: rem-calc(-24);
|
|
||||||
}
|
|
||||||
|
|
||||||
label {
|
|
||||||
padding-right: $line-height / 2;
|
|
||||||
float: none;
|
|
||||||
|
|
||||||
@include breakpoint(medium) {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.comment-form {
|
.comment-form {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -44,18 +44,6 @@ input[type="submit"] { display: none !important; }
|
|||||||
|
|
||||||
.admin h2 { font-size: 20px !important; line-height: 20px !important; }
|
.admin h2 { font-size: 20px !important; line-height: 20px !important; }
|
||||||
|
|
||||||
.select-order {
|
|
||||||
border: 0 !important;
|
|
||||||
font-size: 20px !important;
|
|
||||||
font-weight: bold !important;
|
|
||||||
line-height: 20px !important;
|
|
||||||
margin-left: 10px !important;
|
|
||||||
margin-top: 0 !important;
|
|
||||||
margin-bottom: 0 !important;
|
|
||||||
margin-right: 0 !important;
|
|
||||||
padding: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.proposal-info { margin-left: -6px; }
|
p.proposal-info { margin-left: -6px; }
|
||||||
|
|
||||||
a { text-decoration: none !important; }
|
a { text-decoration: none !important; }
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<% if proposals.any? %>
|
<% if proposals.any? %>
|
||||||
<h3><%= page_entries_info proposals %></h3>
|
<h3><%= page_entries_info proposals %></h3>
|
||||||
|
|
||||||
<%= render "shared/wide_order_selector", i18n_namespace: "admin.legislation.processes.proposals" %>
|
<%= render "shared/order_links", i18n_namespace: "admin.legislation.processes.proposals" %>
|
||||||
|
|
||||||
<table class="stack" id="legislation_proposals_list">
|
<table class="stack" id="legislation_proposals_list">
|
||||||
<thead>
|
<thead>
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
<% # Params:
|
|
||||||
#
|
|
||||||
# i18n_namespace: for example "moderation.debates.index" %>
|
|
||||||
|
|
||||||
<% if @valid_orders.present? && @valid_orders.count > 1 %>
|
|
||||||
<div class="wide-order-selector small-12 medium-8">
|
|
||||||
<form>
|
|
||||||
<div class="small-12 medium-6 float-left">
|
|
||||||
<label for="order-selector-participation">
|
|
||||||
<%= t("#{i18n_namespace}.select_order") %>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="small-12 medium-6 float-left">
|
|
||||||
<select class="js-location-changer js-order-selector select-order"
|
|
||||||
data-order="<%= @current_order %>" name="order-selector"
|
|
||||||
id="order-selector-participation">
|
|
||||||
<% @valid_orders.each do |order| %>
|
|
||||||
<% value = current_path_with_query_params(order: order, page: 1) %>
|
|
||||||
<option value="<%= value %>" <%= "selected" if order == @current_order %>>
|
|
||||||
<%= t("#{i18n_namespace}.orders.#{order}") %>
|
|
||||||
</option>
|
|
||||||
<% end %>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
@@ -157,7 +157,6 @@ ignore_unused:
|
|||||||
- "admin.legislation.processes.index.filter*"
|
- "admin.legislation.processes.index.filter*"
|
||||||
- "admin.legislation.processes.*.submit_button"
|
- "admin.legislation.processes.*.submit_button"
|
||||||
- "admin.legislation.processes.proposals.orders.*"
|
- "admin.legislation.processes.proposals.orders.*"
|
||||||
- "admin.legislation.processes.proposals.select_order"
|
|
||||||
- "admin.legislation.draft_versions.*.submit_button"
|
- "admin.legislation.draft_versions.*.submit_button"
|
||||||
- "admin.legislation.questions.*.submit_button"
|
- "admin.legislation.questions.*.submit_button"
|
||||||
- "admin.hidden_comments.index.hidden_*"
|
- "admin.hidden_comments.index.hidden_*"
|
||||||
|
|||||||
@@ -584,11 +584,10 @@ en:
|
|||||||
title: Create new collaborative legislation process
|
title: Create new collaborative legislation process
|
||||||
submit_button: Create process
|
submit_button: Create process
|
||||||
proposals:
|
proposals:
|
||||||
select_order: Sort by
|
|
||||||
orders:
|
orders:
|
||||||
id: Id
|
id: "Sort by ID"
|
||||||
title: Title
|
title: "Sort by title"
|
||||||
supports: Total supports
|
supports: "Sort by total supports"
|
||||||
process:
|
process:
|
||||||
title: Process
|
title: Process
|
||||||
comments: Comments
|
comments: Comments
|
||||||
|
|||||||
@@ -584,11 +584,10 @@ es:
|
|||||||
title: Crear nuevo proceso de legislación colaborativa
|
title: Crear nuevo proceso de legislación colaborativa
|
||||||
submit_button: Crear proceso
|
submit_button: Crear proceso
|
||||||
proposals:
|
proposals:
|
||||||
select_order: Ordenar por
|
|
||||||
orders:
|
orders:
|
||||||
id: Id
|
id: "Ordenar por ID"
|
||||||
title: Título
|
title: "Ordenar por título"
|
||||||
supports: Apoyos totales
|
supports: "Ordenar por apoyos totales"
|
||||||
process:
|
process:
|
||||||
title: Proceso
|
title: Proceso
|
||||||
comments: Comentarios
|
comments: Comentarios
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ describe "Admin collaborative legislation", :admin do
|
|||||||
create(:legislation_proposal, title: "cccc", legislation_process_id: process.id)
|
create(:legislation_proposal, title: "cccc", legislation_process_id: process.id)
|
||||||
|
|
||||||
visit admin_legislation_process_proposals_path(process.id)
|
visit admin_legislation_process_proposals_path(process.id)
|
||||||
select "Title", from: "order-selector-participation"
|
click_link "Sort by title"
|
||||||
|
|
||||||
within("#legislation_proposals_list") do
|
within("#legislation_proposals_list") do
|
||||||
within all(".legislation_proposal")[0] { expect(page).to have_content("aaaa") }
|
within all(".legislation_proposal")[0] { expect(page).to have_content("aaaa") }
|
||||||
@@ -49,7 +49,7 @@ describe "Admin collaborative legislation", :admin do
|
|||||||
create(:legislation_proposal, cached_votes_score: 20, legislation_process_id: process.id)
|
create(:legislation_proposal, cached_votes_score: 20, legislation_process_id: process.id)
|
||||||
|
|
||||||
visit admin_legislation_process_proposals_path(process.id)
|
visit admin_legislation_process_proposals_path(process.id)
|
||||||
select "Total supports", from: "order-selector-participation"
|
click_link "Sort by total supports"
|
||||||
|
|
||||||
within("#legislation_proposals_list") do
|
within("#legislation_proposals_list") do
|
||||||
within all(".legislation_proposal")[0] { expect(page).to have_content("30") }
|
within all(".legislation_proposal")[0] { expect(page).to have_content("30") }
|
||||||
@@ -65,7 +65,7 @@ describe "Admin collaborative legislation", :admin do
|
|||||||
proposal3 = create(:legislation_proposal, title: "cccc", legislation_process_id: process.id)
|
proposal3 = create(:legislation_proposal, title: "cccc", legislation_process_id: process.id)
|
||||||
|
|
||||||
visit admin_legislation_process_proposals_path(process.id, order: :title)
|
visit admin_legislation_process_proposals_path(process.id, order: :title)
|
||||||
select "Id", from: "order-selector-participation"
|
click_link "Sort by ID"
|
||||||
|
|
||||||
within("#legislation_proposals_list") do
|
within("#legislation_proposals_list") do
|
||||||
within all(".legislation_proposal")[0] { expect(page).to have_content(proposal1.id) }
|
within all(".legislation_proposal")[0] { expect(page).to have_content(proposal1.id) }
|
||||||
|
|||||||
Reference in New Issue
Block a user