sortable? -> sorted_by
This commit is contained in:
parent
14c5c26bb6
commit
e19f1bd8c2
2 changed files with 5 additions and 5 deletions
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue