BigW Consortium Gitlab

sorting_helper.rb 2.93 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
      sort_value_downvotes => sort_title_downvotes,
Thijs Wouters committed
17 18
      sort_value_upvotes => sort_title_upvotes,
      sort_value_priority => sort_title_priority
19 20 21
    }
  end

22 23 24 25 26 27 28 29 30 31
  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

Thijs Wouters committed
32 33 34 35
  def sort_title_priority
    'Priority'
  end

36 37 38 39 40
  def sort_title_oldest_updated
    'Oldest updated'
  end

  def sort_title_recently_updated
Jacob Schatz committed
41
    'Last updated'
42 43 44
  end

  def sort_title_oldest_created
45
    'Oldest created'
46 47 48
  end

  def sort_title_recently_created
Jacob Schatz committed
49
    'Last created'
50
  end
51 52 53 54 55 56 57 58 59

  def sort_title_milestone_soon
    'Milestone due soon'
  end

  def sort_title_milestone_later
    'Milestone due later'
  end

60
  def sort_title_due_date_soon
61
    'Due soon'
62 63 64
  end

  def sort_title_due_date_later
65
    'Due later'
66 67
  end

68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
  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

84 85 86 87 88 89 90 91
  def sort_title_downvotes
    'Least popular'
  end

  def sort_title_upvotes
    'Most popular'
  end

Thijs Wouters committed
92 93 94 95
  def sort_value_priority
    'priority'
  end

96 97 98 99 100 101 102 103 104
  def sort_value_oldest_updated
    'updated_asc'
  end

  def sort_value_recently_updated
    'updated_desc'
  end

  def sort_value_oldest_created
105
    'id_asc'
106 107 108
  end

  def sort_value_recently_created
109
    'id_desc'
110 111 112 113 114 115 116 117 118 119
  end

  def sort_value_milestone_soon
    'milestone_due_asc'
  end

  def sort_value_milestone_later
    'milestone_due_desc'
  end

120 121 122 123 124 125 126 127
  def sort_value_due_date_soon
    'due_date_asc'
  end

  def sort_value_due_date_later
    'due_date_desc'
  end

128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
  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
143 144 145 146 147 148 149 150

  def sort_value_downvotes
    'downvotes_desc'
  end

  def sort_value_upvotes
    'upvotes_desc'
  end
151
end