summaryrefslogtreecommitdiff
path: root/app/views/projects/branches/index.html.haml
blob: 96acd863a4cf2e200496aaf04e9e3611f5afa282 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
- page_title _('Branches')
- add_to_breadcrumbs(_('Repository'), project_tree_path(@project))

.top-area.gl-border-0
  = gl_tabs_nav({ class: 'gl-flex-grow-1 gl-border-b-0' }) do
    = gl_tab_link_to s_('Branches|Overview'), project_branches_path(@project), { item_active: @mode == 'overview', title: s_('Branches|Show overview of the branches') }
    = gl_tab_link_to s_('Branches|Active'), project_branches_filtered_path(@project, state: 'active'), { title: s_('Branches|Show active branches') }
    = gl_tab_link_to s_('Branches|Stale'), project_branches_filtered_path(@project, state: 'stale'), { title: s_('Branches|Show stale branches') }
    = gl_tab_link_to s_('Branches|All'), project_branches_filtered_path(@project, state: 'all'), { item_active: !%w[overview active stale].include?(@mode), title: s_('Branches|Show all branches') }

  .nav-controls
    #js-branches-sort-dropdown{ data: { project_branches_filtered_path: project_branches_path(@project, state: 'all'), sort_options: branches_sort_options_hash.to_json, mode: @mode } }

    - if can? current_user, :push_code, @project
      = link_to project_merged_branches_path(@project),
        class: 'gl-button btn btn-danger btn-danger-secondary has-tooltip qa-delete-merged-branches',
        title: s_("Branches|Delete all branches that are merged into '%{default_branch}'") % { default_branch: @project.repository.root_ref },
        method: :delete,
        aria: { label: s_('Branches|Delete merged branches') },
        data: { confirm: s_('Branches|Deleting the merged branches cannot be undone. Are you sure?'),
          confirm_btn_variant: 'danger',
          container: 'body' } do
        = s_('Branches|Delete merged branches')
      = link_to new_project_branch_path(@project), class: 'gl-button btn btn-confirm' do
        = s_('Branches|New branch')

= render_if_exists 'projects/commits/mirror_status'

.js-branch-list{ data: { diverging_counts_endpoint: diverging_commit_counts_namespace_project_branches_path(@project.namespace, @project, format: :json), default_branch: @project.default_branch } }
- if can?(current_user, :admin_project, @project)
  - project_settings_link = link_to s_('Branches|project settings'), project_protected_branches_path(@project)
  .row-content-block
    %h5
      = s_('Branches|Protected branches can be managed in %{project_settings_link}.').html_safe % { project_settings_link: project_settings_link }

- if @gitaly_unavailable
  = render 'shared/errors/gitaly_unavailable', reason: s_('Branches|Unable to load branches')

- elsif @mode == 'overview' && (@active_branches.any? || @stale_branches.any?)
  = render "projects/branches/panel", branches: @active_branches, state: 'active', panel_title: s_('Branches|Active branches'), show_more_text: s_('Branches|Show more active branches'), project: @project, overview_max_branches: @overview_max_branches
  = render "projects/branches/panel", branches: @stale_branches, state: 'stale', panel_title: s_('Branches|Stale branches'), show_more_text: s_('Branches|Show more stale branches'), project: @project, overview_max_branches: @overview_max_branches

- elsif @branches.any?
  %ul.content-list.all-branches
    - @branches.each do |branch|
      = render "projects/branches/branch", branch: branch, merged: @merged_branch_names.include?(branch.name), commit_status: @branch_pipeline_statuses[branch.name], show_commit_status: @branch_pipeline_statuses.any?
  - if Feature.enabled?(:branch_list_keyset_pagination, @project, default_enabled: :yaml)
    = render('kaminari/gitlab/without_count', previous_path: @prev_path, next_path: @next_path)
  - else
    = paginate @branches, theme: 'gitlab'
- else
  .nothing-here-block
    = s_('Branches|No branches to show')

- if can?(current_user, :push_code, @project)
  .js-delete-branch-modal