BigW Consortium Gitlab

sorting_helper.rb 5.93 KB
Newer Older
1
module SortingHelper
2 3 4
  def sort_options_hash
    {
      sort_value_name => sort_title_name,
5
      sort_value_name_desc => sort_title_name_desc,
6 7 8 9 10 11
      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,
12 13
      sort_value_due_date_soon => sort_title_due_date_soon,
      sort_value_due_date_later => sort_title_due_date_later,
14
      sort_value_largest_repo => sort_title_largest_repo,
15
      sort_value_largest_group => sort_title_largest_group,
16 17
      sort_value_recently_signin => sort_title_recently_signin,
      sort_value_oldest_signin => sort_title_oldest_signin,
18
      sort_value_downvotes => sort_title_downvotes,
Thijs Wouters committed
19
      sort_value_upvotes => sort_title_upvotes,
20 21
      sort_value_priority => sort_title_priority,
      sort_value_label_priority => sort_title_label_priority
22 23 24
    }
  end

25
  def projects_sort_options_hash
26
    options = {
27
      sort_value_name => sort_title_name,
28 29
      sort_value_latest_activity => sort_title_latest_activity,
      sort_value_oldest_activity => sort_title_oldest_activity,
30
      sort_value_recently_created => sort_title_recently_created,
31
      sort_value_oldest_created => sort_title_oldest_created
32
    }
33 34

    if current_controller?('admin/projects')
35
      options[sort_value_largest_repo] = sort_title_largest_repo
36 37 38
    end

    options
39 40
  end

41 42
  def member_sort_options_hash
    {
43 44
      sort_value_access_level_asc => sort_title_access_level_asc,
      sort_value_access_level_desc => sort_title_access_level_desc,
45 46 47 48 49 50 51 52 53
      sort_value_last_joined => sort_title_last_joined,
      sort_value_oldest_joined => sort_title_oldest_joined,
      sort_value_name => sort_title_name_asc,
      sort_value_name_desc => sort_title_name_desc,
      sort_value_recently_signin => sort_title_recently_signin,
      sort_value_oldest_signin => sort_title_oldest_signin
    }
  end

54 55 56 57 58 59 60
  def milestone_sort_options_hash
    {
      sort_value_name => sort_title_name_asc,
      sort_value_name_desc => sort_title_name_desc,
      sort_value_due_date_soon => sort_title_due_date_soon,
      sort_value_due_date_later => sort_title_due_date_later,
      sort_value_start_date_soon => sort_title_start_date_soon,
61
      sort_value_start_date_later => sort_title_start_date_later
62 63 64
    }
  end

65 66 67 68 69 70 71 72
  def branches_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
    }
  end

73 74 75 76 77 78 79 80
  def tags_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
    }
  end

Thijs Wouters committed
81
  def sort_title_priority
82 83 84 85
    'Priority'
  end

  def sort_title_label_priority
86
    'Label priority'
Thijs Wouters committed
87 88
  end

89 90 91 92 93
  def sort_title_oldest_updated
    'Oldest updated'
  end

  def sort_title_recently_updated
Jacob Schatz committed
94
    'Last updated'
95 96
  end

97 98 99 100 101 102 103 104
  def sort_title_oldest_activity
    'Oldest updated'
  end

  def sort_title_latest_activity
    'Last updated'
  end

105
  def sort_title_oldest_created
106
    'Oldest created'
107 108 109
  end

  def sort_title_recently_created
Jacob Schatz committed
110
    'Last created'
111
  end
112 113 114 115 116 117 118 119 120

  def sort_title_milestone_soon
    'Milestone due soon'
  end

  def sort_title_milestone_later
    'Milestone due later'
  end

121
  def sort_title_due_date_soon
122
    'Due soon'
123 124 125
  end

  def sort_title_due_date_later
126
    'Due later'
127 128
  end

129 130 131 132 133 134 135 136
  def sort_title_start_date_soon
    'Start soon'
  end

  def sort_title_start_date_later
    'Start later'
  end

137 138 139 140 141 142 143 144
  def sort_title_name
    'Name'
  end

  def sort_title_largest_repo
    'Largest repository'
  end

145 146 147 148
  def sort_title_largest_group
    'Largest group'
  end

149 150 151 152 153 154 155 156
  def sort_title_recently_signin
    'Recent sign in'
  end

  def sort_title_oldest_signin
    'Oldest sign in'
  end

157 158 159 160 161 162 163 164
  def sort_title_downvotes
    'Least popular'
  end

  def sort_title_upvotes
    'Most popular'
  end

165 166 167 168 169 170 171 172
  def sort_title_last_joined
    'Last joined'
  end

  def sort_title_oldest_joined
    'Oldest joined'
  end

173 174 175 176 177 178 179 180
  def sort_title_access_level_asc
    'Access level, ascending'
  end

  def sort_title_access_level_desc
    'Access level, descending'
  end

181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
  def sort_title_name_asc
    'Name, ascending'
  end

  def sort_title_name_desc
    'Name, descending'
  end

  def sort_value_last_joined
    'last_joined'
  end

  def sort_value_oldest_joined
    'oldest_joined'
  end

197 198 199 200 201 202 203 204
  def sort_value_access_level_asc
    'access_level_asc'
  end

  def sort_value_access_level_desc
    'access_level_desc'
  end

205 206 207 208
  def sort_value_name_desc
    'name_desc'
  end

Thijs Wouters committed
209 210 211 212
  def sort_value_priority
    'priority'
  end

213 214 215 216
  def sort_value_label_priority
    'label_priority'
  end

217 218 219 220 221 222 223 224
  def sort_value_oldest_updated
    'updated_asc'
  end

  def sort_value_recently_updated
    'updated_desc'
  end

225 226 227 228 229 230 231 232
  def sort_value_oldest_activity
    'latest_activity_asc'
  end

  def sort_value_latest_activity
    'latest_activity_desc'
  end

233
  def sort_value_oldest_created
234
    'created_asc'
235 236 237
  end

  def sort_value_recently_created
238
    'created_desc'
239 240 241 242 243 244 245 246 247 248
  end

  def sort_value_milestone_soon
    'milestone_due_asc'
  end

  def sort_value_milestone_later
    'milestone_due_desc'
  end

249 250 251 252 253 254 255 256
  def sort_value_due_date_soon
    'due_date_asc'
  end

  def sort_value_due_date_later
    'due_date_desc'
  end

257 258 259 260 261 262 263 264
  def sort_value_start_date_soon
    'start_date_asc'
  end

  def sort_value_start_date_later
    'start_date_desc'
  end

265 266 267 268 269
  def sort_value_name
    'name_asc'
  end

  def sort_value_largest_repo
270 271 272 273 274
    'storage_size_desc'
  end

  def sort_value_largest_group
    'storage_size_desc'
275 276 277 278 279 280 281 282 283
  end

  def sort_value_recently_signin
    'recent_sign_in'
  end

  def sort_value_oldest_signin
    'oldest_sign_in'
  end
284 285 286 287 288 289 290 291

  def sort_value_downvotes
    'downvotes_desc'
  end

  def sort_value_upvotes
    'upvotes_desc'
  end
292
end