File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414
1515 <%= render 'shared/sorting' , default_order : @default_sort_order ,
1616 default_type : @default_sort_type ,
17- types : %w[ age handled ] %>
17+ types : [ ' age' , { type : ' handled' , title : 'time handled' } ] %>
1818</ div >
1919
2020<% @flags . each do |flag | %>
Original file line number Diff line number Diff line change 1919 <% end %>
2020 </ div >
2121
22+ <% sorting_types = current_page? ( escalated_flags_path ) ?
23+ [ 'age' , { type : 'escalated' , title : 'time escalated' } ] :
24+ %w[ age ] %>
25+
2226 <%= render 'shared/sorting' , default_order : @default_sort_order ,
2327 default_type : @default_sort_type ,
24- types : current_page? ( escalated_flags_path ) ? %w[ age escalated ] : %w[ age ] %>
28+ types : sorting_types %>
2529</ div >
2630
2731<% @flags . each do |flag | %>
Original file line number Diff line number Diff line change 22 "Renders a sorting widget
33
44 Variables:
5- types : Array<String> of available sorting types
5+ types : list of available sorting types
66 ? default_order : Defualt sorting order, if any
77 ? default_type : Default sorting type, if any
88"%>
1616
1717 <div class ="button-list is-gutterless ">
1818
19- <% types . each do |type | %>
19+ <% types . each do |option | %>
20+ <% type = option . is_a? ( String ) ? option : option [ :type ] %>
21+ <% title = "Sort by #{ option . is_a? ( String ) ? option . humanize . downcase : option [ :title ] } " %>
2022 <% is_active = params [ :sort ] == type || ( params [ :sort ] . nil? && default_type . to_s == type ) %>
2123 <%= link_to request . params . merge ( sort : type , order : is_active ? reverse_order : nil ) ,
2224 class : "button is-muted is-outlined #{ 'is-active' if is_active } " ,
2325 role : 'button' ,
24- title : "Sort by #{ type . humanize . downcase } " ,
25- aria : { label : "Sort by #{ type . humanize . downcase } " } do %>
26+ title : title ,
27+ aria : { label : title } do %>
2628 <% if is_active %>
2729 < i class ="has-margin-right-1 fa fa-caret- <%= order == :asc ? 'up' : 'down' %> "> </ i > <%= type . humanize %>
2830 <% else %>
You can’t perform that action at this time.
0 commit comments