BigW Consortium Gitlab

_dropdown.html.haml 1.44 KB
Newer Older
1
- options_hash = local_assigns.fetch(:options_hash, groups_sort_options_hash)
2
- show_archive_options = local_assigns.fetch(:show_archive_options, false)
3 4 5 6 7 8 9 10 11
- if @sort.present?
  - default_sort_by = @sort
- else
  - if params[:sort]
    - default_sort_by = params[:sort]
  - else
    - default_sort_by = sort_value_recently_created

.dropdown.inline.js-group-filter-dropdown-wrap.append-right-10
12
  %button.dropdown-toggle{ type: 'button', 'data-toggle' => 'dropdown' }
13
    %span.dropdown-label
14
      = options_hash[default_sort_by]
15
    = icon('chevron-down')
16 17 18
  %ul.dropdown-menu.dropdown-menu-align-right.dropdown-menu-selectable
    %li.dropdown-header
      = _("Sort by")
19
    - options_hash.each do |value, title|
20 21
      %li.js-filter-sort-order
        = link_to filter_groups_path(sort: value), class: ("is-active" if default_sort_by == value) do
22
          = title
23 24 25
    - if show_archive_options
      %li.divider
      %li.js-filter-archived-projects
26
        = link_to filter_groups_path(archived: nil), class: ("is-active" unless params[:archived].present?) do
27 28
          Hide archived projects
      %li.js-filter-archived-projects
29
        = link_to filter_groups_path(archived: true), class: ("is-active" if Gitlab::Utils.to_boolean(params[:archived])) do
30 31
          Show archived projects
      %li.js-filter-archived-projects
32
        = link_to filter_groups_path(archived: 'only'), class: ("is-active" if params[:archived] == 'only') do
33
          Show archived projects only