- if params[:label_name].present?
  = hidden_field_tag(:label_name, params[:label_name])
.dropdown
  %button.dropdown-menu-toggle.js-label-select.js-filter-submit.js-extra-options{type: "button", data: {toggle: "dropdown", field_name: "label_name", show_no: "true", show_any: "true", selected: params[:label_name], project_id: @project.try(:id), labels: labels_filter_path, default_label: "Label"}}
    %span.dropdown-toggle-text
      = h(params[:label_name].presence || "Label")
    = icon('chevron-down')
  .dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
    .dropdown-page-one
      = dropdown_title("Filter by label")
      = dropdown_filter("Search labels")
      = dropdown_content
      - if @project
        = dropdown_footer do
          %ul.dropdown-footer-list
            - if can? current_user, :admin_label, @project
              %li
                %a.dropdown-toggle-page{href: "#"}
                  Create new
            %li
              = link_to namespace_project_labels_path(@project.namespace, @project) do
                - if can? current_user, :admin_label, @project
                  Manage labels
                - else
                  View labels
    - if can? current_user, :admin_label, @project and @project
      .dropdown-page-two.dropdown-new-label
        = dropdown_title("Create new label", back: true)
        = dropdown_content do
          .dropdown-labels-error.js-label-error
          %input#new_label_name.dropdown-input-field{type: "text", placeholder: "Name new label"}
          .suggest-colors.suggest-colors-dropdown
            - suggested_colors.each do |color|
              = link_to '#', style: "background-color: #{color}", data: { color: color } do
                &nbsp
          .dropdown-label-color-input
            .dropdown-label-color-preview.js-dropdown-label-color-preview
            %input#new_label_color.dropdown-input-field{ type: "text" }
          .clearfix
            %button.btn.btn-primary.pull-left.js-new-label-btn{type: "button"}
              Create
            %button.btn.btn-default.pull-right.js-cancel-label-btn{type: "button"}
              Cancel
    = dropdown_loading
