Project

General

Profile

Feature #18735 » RM_18735_Issues_list_css_tags_to_get_sort_orders_sort_2_and_3_V2.6.0.diff

Jérôme BATAILLE, 2015-01-02 19:10

View differences:

app/helpers/sort_helper.rb (copie de travail)
114 114
      @criteria.first && @criteria.first.last
115 115
    end
116 116

  
117
    def second_key
118
      return nil if @criteria.size < 2
119
      @criteria[1] && @criteria[1].first
120
    end
121

  
122
    def second_asc?
123
      return false if @criteria.size < 2
124
      @criteria[1] && @criteria[1].last
125
    end
126

  
127
    def third_key
128
      return nil if @criteria.size < 3
129
      @criteria[2] && @criteria[2].first
130
    end
131

  
132
    def third_asc?
133
      return false if @criteria.size < 3
134
      @criteria[2] && @criteria[2].last
135
    end
136

  
117 137
    def empty?
118 138
      @criteria.empty?
119 139
    end
......
247 267
  #   sort_css_classes
248 268
  #   # => "sort-by-created-on sort-desc"
249 269
  def sort_css_classes
270
    sort_css_cls = ''
250 271
    if @sort_criteria.first_key
251
      "sort-by-#{@sort_criteria.first_key.to_s.dasherize} sort-#{@sort_criteria.first_asc? ? 'asc' : 'desc'}"
272
      sort_css_cls << "sort-by-#{@sort_criteria.first_key.to_s.dasherize} sort-#{@sort_criteria.first_asc? ? 'asc' : 'desc'}"
252 273
    end
274

  
275
    if @sort_criteria.second_key
276
      sort_css_cls << ' ' if sort_css_cls != ''
277
      sort_css_cls << "sort2-by-#{@sort_criteria.second_key.to_s.dasherize} sort2-#{@sort_criteria.second_asc? ? 'asc' : 'desc'}"
278
    end
279

  
280
    if @sort_criteria.third_key
281
      sort_css_cls << ' ' if sort_css_cls != ''
282
      sort_css_cls << "sort3-by-#{@sort_criteria.third_key.to_s.dasherize} sort3-#{@sort_criteria.third_asc? ? 'asc' : 'desc'}"
283
    end
284

  
285
    sort_css_cls
253 286
  end
254 287
end
255 288

  
(1-1/6)