diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/sort_helper.rb | 12 | ||||
-rw-r--r-- | app/views/issues/_list.html.erb | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/app/helpers/sort_helper.rb b/app/helpers/sort_helper.rb index 13beed3c2..cbdc41883 100644 --- a/app/helpers/sort_helper.rb +++ b/app/helpers/sort_helper.rb @@ -239,5 +239,17 @@ module SortHelper options[:title] = l(:label_sort_by, "\"#{caption}\"") unless options[:title] content_tag('th', sort_link(column, caption, default_order), options) end + + # Returns the css classes for the current sort order + # + # Example: + # + # sort_css_classes + # # => "sort-by-created-on sort-desc" + def sort_css_classes + if @sort_criteria.first_key + "sort-by-#{@sort_criteria.first_key.to_s.dasherize} sort-#{@sort_criteria.first_asc? ? 'asc' : 'desc'}" + end + end end diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb index 17bf99623..fb190d42b 100644 --- a/app/views/issues/_list.html.erb +++ b/app/views/issues/_list.html.erb @@ -1,7 +1,7 @@ <%= form_tag({}) do -%> <%= hidden_field_tag 'back_url', url_for(params), :id => nil %> <div class="autoscroll"> -<table class="list issues"> +<table class="list issues <%= sort_css_classes %>"> <thead> <tr> <th class="checkbox hide-when-print"> |