- viewing_issues = controller.controller_name == 'issues' || controller.action_name == 'issues'

.dropdown.inline.prepend-left-10
  %button.dropdown-toggle{ type: 'button', data: {toggle: 'dropdown' } }
    - if @sort.present?
      = sort_options_hash[@sort]
    - else
      = sort_title_recently_created
    = icon('chevron-down')
  %ul.dropdown-menu.dropdown-menu-align-right.dropdown-menu-sort
    %li
      = link_to page_filter_path(sort: sort_value_priority, label: true) do
        = sort_title_priority
      = link_to page_filter_path(sort: sort_value_label_priority, label: true) do
        = sort_title_label_priority
      = link_to page_filter_path(sort: sort_value_recently_created, label: true) do
        = sort_title_recently_created
      = link_to page_filter_path(sort: sort_value_oldest_created, label: true) do
        = sort_title_oldest_created
      = link_to page_filter_path(sort: sort_value_recently_updated, label: true) do
        = sort_title_recently_updated
      = link_to page_filter_path(sort: sort_value_oldest_updated, label: true) do
        = sort_title_oldest_updated
      = link_to page_filter_path(sort: sort_value_milestone_soon, label: true) do
        = sort_title_milestone_soon
      = link_to page_filter_path(sort: sort_value_milestone_later, label: true) do
        = sort_title_milestone_later
      - if viewing_issues
        = link_to page_filter_path(sort: sort_value_due_date_soon, label: true) do
          = sort_title_due_date_soon
        = link_to page_filter_path(sort: sort_value_due_date_later, label: true) do
          = sort_title_due_date_later
      = link_to page_filter_path(sort: sort_value_upvotes, label: true) do
        = sort_title_upvotes
      = link_to page_filter_path(sort: sort_value_downvotes, label: true) do
        = sort_title_downvotes
