BigW Consortium Gitlab

sorting_helper.rb 2.78 KB
Newer Older
1
module SortingHelper
2 3 4 5 6 7 8 9 10
  def sort_options_hash
    {
      sort_value_name => sort_title_name,
      sort_value_recently_updated => sort_title_recently_updated,
      sort_value_oldest_updated => sort_title_oldest_updated,
      sort_value_recently_created => sort_title_recently_created,
      sort_value_oldest_created => sort_title_oldest_created,
      sort_value_milestone_soon => sort_title_milestone_soon,
      sort_value_milestone_later => sort_title_milestone_later,
11 12
      sort_value_due_date_soon => sort_title_due_date_soon,
      sort_value_due_date_later => sort_title_due_date_later,
13 14 15
      sort_value_largest_repo => sort_title_largest_repo,
      sort_value_recently_signin => sort_title_recently_signin,
      sort_value_oldest_signin => sort_title_oldest_signin,
16 17
      sort_value_downvotes => sort_title_downvotes,
      sort_value_upvotes => sort_title_upvotes
18 19 20
    }
  end

21 22 23 24 25 26 27 28 29 30
  def projects_sort_options_hash
    {
      sort_value_name => sort_title_name,
      sort_value_recently_updated => sort_title_recently_updated,
      sort_value_oldest_updated => sort_title_oldest_updated,
      sort_value_recently_created => sort_title_recently_created,
      sort_value_oldest_created => sort_title_oldest_created,
    }
  end

31 32 33 34 35
  def sort_title_oldest_updated
    'Oldest updated'
  end

  def sort_title_recently_updated
Jacob Schatz committed
36
    'Last updated'
37 38 39
  end

  def sort_title_oldest_created
40
    'Oldest created'
41 42 43
  end

  def sort_title_recently_created
Jacob Schatz committed
44
    'Last created'
45
  end
46 47 48 49 50 51 52 53 54

  def sort_title_milestone_soon
    'Milestone due soon'
  end

  def sort_title_milestone_later
    'Milestone due later'
  end

55
  def sort_title_due_date_soon
56
    'Due soon'
57 58 59
  end

  def sort_title_due_date_later
60
    'Due later'
61 62
  end

63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
  def sort_title_name
    'Name'
  end

  def sort_title_largest_repo
    'Largest repository'
  end

  def sort_title_recently_signin
    'Recent sign in'
  end

  def sort_title_oldest_signin
    'Oldest sign in'
  end

79 80 81 82 83 84 85 86
  def sort_title_downvotes
    'Least popular'
  end

  def sort_title_upvotes
    'Most popular'
  end

87 88 89 90 91 92 93 94 95
  def sort_value_oldest_updated
    'updated_asc'
  end

  def sort_value_recently_updated
    'updated_desc'
  end

  def sort_value_oldest_created
96
    'id_asc'
97 98 99
  end

  def sort_value_recently_created
100
    'id_desc'
101 102 103 104 105 106 107 108 109 110
  end

  def sort_value_milestone_soon
    'milestone_due_asc'
  end

  def sort_value_milestone_later
    'milestone_due_desc'
  end

111 112 113 114 115 116 117 118
  def sort_value_due_date_soon
    'due_date_asc'
  end

  def sort_value_due_date_later
    'due_date_desc'
  end

119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
  def sort_value_name
    'name_asc'
  end

  def sort_value_largest_repo
    'repository_size_desc'
  end

  def sort_value_recently_signin
    'recent_sign_in'
  end

  def sort_value_oldest_signin
    'oldest_sign_in'
  end
134 135 136 137 138 139 140 141

  def sort_value_downvotes
    'downvotes_desc'
  end

  def sort_value_upvotes
    'upvotes_desc'
  end
142
end