diff --git a/app/models/procedure_presentation.rb b/app/models/procedure_presentation.rb index 07b8437a5..fb1c1d87c 100644 --- a/app/models/procedure_presentation.rb +++ b/app/models/procedure_presentation.rb @@ -161,13 +161,13 @@ class ProcedurePresentation < ApplicationRecord slice(:filters, :sort, :displayed_fields) end - def sortable?(field) - sort['table'] == field.table && - sort['column'] == field.column + def sorted_by?(facet) + sort['table'] == facet.table && + sort['column'] == facet.column end def aria_sort(order, field) - if sortable?(field) + if sorted_by?(field) if order == 'asc' { "aria-sort": "ascending" } elsif order == 'desc' diff --git a/app/views/instructeurs/procedures/_header_field.html.haml b/app/views/instructeurs/procedures/_header_field.html.haml index e66d2f683..2d46b77b5 100644 --- a/app/views/instructeurs/procedures/_header_field.html.haml +++ b/app/views/instructeurs/procedures/_header_field.html.haml @@ -1,6 +1,6 @@ %th{ @procedure_presentation.aria_sort(@procedure_presentation.sort['order'], field), scope: "col", class: field.classname } = link_to update_sort_instructeur_procedure_path(@procedure, table: field.table, column: field.column, order: @procedure_presentation.opposite_order_for(field.table, field.column)) do - - if @procedure_presentation.sortable?(field) + - if @procedure_presentation.sorted_by?(field) - if @procedure_presentation.sort['order'] == 'asc' #{field.label} ↑ - else