- @no_container = true
- page_title "Branches"
= render "projects/commits/head"

%div{ class: container_class }
  .top-area
    .nav-text
      Protected branches can be managed in project settings

    .nav-controls
      = form_tag(filter_branches_path, method: :get) do
        = search_field_tag :search, params[:search], { placeholder: 'Filter by branch name', id: 'branch-search', class: 'form-control search-text-input input-short', spellcheck: false }

      .dropdown.inline
        %button.dropdown-toggle{type: 'button', 'data-toggle' => 'dropdown'}
          %span.light
            = projects_sort_options_hash[@sort]
          = icon('chevron-down')
        %ul.dropdown-menu.dropdown-menu-align-right
          %li
            = link_to filter_branches_path(sort: sort_value_name) do
              = sort_title_name
            = link_to filter_branches_path(sort: sort_value_recently_updated) do
              = sort_title_recently_updated
            = link_to filter_branches_path(sort: sort_value_oldest_updated) do
              = sort_title_oldest_updated

      - if can? current_user, :push_code, @project
        = link_to namespace_project_merged_branches_path(@project.namespace, @project), class: 'btn btn-inverted btn-remove has-tooltip', title: "Delete all branches that are merged into '#{@project.repository.root_ref}'", method: :delete, data: { confirm: "Deleting the merged branches cannot be undone. Are you sure?", container: 'body' } do
          Delete merged branches
        = link_to new_namespace_project_branch_path(@project.namespace, @project), class: 'btn btn-create' do
          New branch

  - if @branches.any?
    %ul.content-list.all-branches
      - @branches.each do |branch|
        = render "projects/branches/branch", branch: branch
    = paginate @branches, theme: 'gitlab'
  - else
    .nothing-here-block No branches to show
