sortable? -> sorted_by

This commit is contained in:
simon lehericey 2024-07-19 22:59:07 +02:00 committed by mfo
parent 14c5c26bb6
commit e19f1bd8c2
No known key found for this signature in database
GPG key ID: 7CE3E1F5B794A8EC
2 changed files with 5 additions and 5 deletions

View file

@ -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'

View file

@ -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