summaryrefslogtreecommitdiff
path: root/app/views/projects/branches/_branch.html.haml
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/projects/branches/_branch.html.haml')
-rw-r--r--app/views/projects/branches/_branch.html.haml45
1 files changed, 4 insertions, 41 deletions
diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml
index be6efa310b9..f5e61c010cc 100644
--- a/app/views/projects/branches/_branch.html.haml
+++ b/app/views/projects/branches/_branch.html.haml
@@ -8,14 +8,11 @@
= link_to project_tree_path(@project, branch.name), class: 'item-title str-truncated-100 ref-name gl-ml-3 qa-branch-name' do
= branch.name
- if branch.name == @repository.root_ref
- %span.badge.gl-badge.sm.badge-pill.badge-primary.gl-ml-2 default
+ = gl_badge_tag s_('DefaultBranchLabel|default'), { variant: :info, size: :sm }, { class: 'gl-ml-2' }
- elsif merged
- %span.badge.gl-badge.sm.badge-pill.badge-info.has-tooltip.gl-ml-2{ title: s_('Branches|Merged into %{default_branch}') % { default_branch: @repository.root_ref } }
- = s_('Branches|merged')
-
+ = gl_badge_tag s_('Branches|merged'), { variant: :info, size: :sm }, { class: 'gl-ml-2', title: s_('Branches|Merged into %{default_branch}') % { default_branch: @repository.root_ref }, data: { toggle: 'tooltip', container: 'body' } }
- if protected_branch?(@project, branch)
- %span.badge.gl-badge.sm.badge-pill.badge-success.gl-ml-2
- = s_('Branches|protected')
+ = gl_badge_tag s_('Branches|protected'), { variant: :success, size: :sm }, { class: 'gl-ml-2' }
= render_if_exists 'projects/branches/diverged_from_upstream', branch: branch
@@ -48,38 +45,4 @@
= render 'projects/buttons/download', project: @project, ref: branch.name, pipeline: @refs_pipelines[branch.name], class: 'gl-vertical-align-top'
- - if Feature.enabled?(:delete_branch_confirmation_modals, @project, default_enabled: :yaml)
- = render 'projects/branches/delete_branch_modal_button', project: @project, branch: branch, merged: merged
-
- - elsif can?(current_user, :push_code, @project)
- - if branch.name == @project.repository.root_ref
- - delete_default_branch_tooltip = s_('Branches|The default branch cannot be deleted')
- %span.gl-display-inline-block.has-tooltip{ title: delete_default_branch_tooltip }
- %button{ class: 'gl-button btn btn-default btn-icon disabled', disabled: true, 'aria-label' => delete_default_branch_tooltip }
- = sprite_icon('remove', css_class: 'gl-button-icon gl-icon')
- - elsif protected_branch?(@project, branch)
- - if can?(current_user, :push_to_delete_protected_branch, @project)
- - delete_protected_branch_tooltip = s_('Branches|Delete protected branch')
- %button{ class: 'gl-button btn btn-default btn-icon has-tooltip',
- title: delete_protected_branch_tooltip,
- 'aria-label' => delete_protected_branch_tooltip,
- data: { toggle: 'modal',
- target: '#modal-delete-branch',
- delete_path: project_branch_path(@project, branch.name),
- branch_name: branch.name,
- is_merged: ('true' if merged) } }
- = sprite_icon('remove', css_class: 'gl-button-icon gl-icon')
- - else
- - delete_protected_branch_disabled_tooltip = s_('Branches|Only a project maintainer or owner can delete a protected branch')
- %span.has-tooltip{ title: delete_protected_branch_disabled_tooltip }
- %button{ class: 'gl-button btn btn-default btn-icon disabled', disabled: true, 'aria-label' => delete_protected_branch_disabled_tooltip, data: { testid: 'remove-protected-branch' } }
- = sprite_icon('remove', css_class: 'gl-button-icon gl-icon')
- - else
- = link_to project_branch_path(@project, branch.name),
- class: 'gl-button btn btn-default btn-icon js-remove-row qa-remove-btn js-ajax-loading-spinner has-tooltip',
- title: s_('Branches|Delete branch'),
- method: :delete,
- data: { confirm: s_("Branches|Deleting the '%{branch_name}' branch cannot be undone. Are you sure?") % { branch_name: branch.name } },
- remote: true,
- 'aria-label' => s_('Branches|Delete branch') do
- = sprite_icon('remove', css_class: 'gl-button-icon gl-icon')
+ = render 'projects/branches/delete_branch_modal_button', project: @project, branch: branch, merged: merged