.issues-filters
  .issues-state-filters
    %ul.nav.nav-tabs
      %li{class: ("active" if params[:state] == 'opened')}
        = link_to page_filter_path(state: 'opened') do
          %i.fa.fa-exclamation-circle
          #{state_filters_text_for(:opened, @project)}
      %li{class: ("active" if params[:state] == 'closed')}
        = link_to page_filter_path(state: 'closed') do
          %i.fa.fa-check-circle
          #{state_filters_text_for(:closed, @project)}
      %li{class: ("active" if params[:state] == 'all')}
        = link_to page_filter_path(state: 'all') do
          %i.fa.fa-compass
          #{state_filters_text_for(:all, @project)}

  .issues-details-filters
    = form_tag page_filter_path(without: [:assignee_id, :author_id, :milestone_title, :label_name]), method: :get, class: 'filter-form' do
      - if controller.controller_name == 'issues'
        .check-all-holder
          = check_box_tag "check_all_issues", nil, false,
            class: "check_all_issues left",
            disabled: !can?(current_user, :modify_issue, @project)
      .issues-other-filters
        .filter-item.inline
          = users_select_tag(:assignee_id, selected: params[:assignee_id],
            placeholder: 'Assignee', class: 'trigger-submit', any_user: true, null_user: true, first_user: true)

        .filter-item.inline
          = users_select_tag(:author_id, selected: params[:author_id],
            placeholder: 'Author', class: 'trigger-submit', any_user: true, first_user: true)

        .filter-item.inline.milestone-filter
          = select_tag('milestone_title', projects_milestones_options, class: "select2 trigger-submit", prompt: 'Milestone')

        - if @project
          .filter-item.inline.labels-filter
            = select_tag('label_name', project_labels_options(@project), class: "select2 trigger-submit", prompt: 'Label')

        .pull-right
          = render 'shared/sort_dropdown'

    - if controller.controller_name == 'issues'
      .issues_bulk_update.hide
        = form_tag bulk_update_namespace_project_issues_path(@project.namespace, @project), method: :post  do
          = select_tag('update[state_event]', options_for_select([['Open', 'reopen'], ['Closed', 'close']]), prompt: "Status", class: 'form-control')
          = users_select_tag('update[assignee_id]', placeholder: 'Assignee', null_user: true)
          = select_tag('update[milestone_id]', bulk_update_milestone_options, prompt: "Milestone")
          = hidden_field_tag 'update[issues_ids]', []
          = hidden_field_tag :state_event, params[:state_event]
          = button_tag "Update issues", class: "btn update_selected_issues btn-save"

:coffeescript
  $('form.filter-form').on 'submit', (event) ->
    event.preventDefault()
    Turbolinks.visit @.action + '&' + $(@).serialize()
