summaryrefslogtreecommitdiff
path: root/app/views/projects/branches
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/projects/branches')
-rw-r--r--app/views/projects/branches/_branch.html.haml45
-rw-r--r--app/views/projects/branches/_delete_protected_modal.html.haml42
-rw-r--r--app/views/projects/branches/index.html.haml4
3 files changed, 5 insertions, 86 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
diff --git a/app/views/projects/branches/_delete_protected_modal.html.haml b/app/views/projects/branches/_delete_protected_modal.html.haml
deleted file mode 100644
index 2b45b4eddcc..00000000000
--- a/app/views/projects/branches/_delete_protected_modal.html.haml
+++ /dev/null
@@ -1,42 +0,0 @@
-#modal-delete-branch.modal{ tabindex: -1 }
- .modal-dialog
- .modal-content
- .modal-header
- %h3.page-title
- - title_branch_name = capture do
- %span.js-branch-name.ref-name>[branch name]
- = s_("Branches|Delete protected branch '%{branch_name}'?").html_safe % { branch_name: title_branch_name }
- %button.close{ type: "button", "data-dismiss": "modal", "aria-label" => _('Close') }
- %span{ "aria-hidden": "true" } ×
-
- .modal-body
- %p
- - branch_name = capture do
- %strong.js-branch-name.ref-name>[branch name]
- = s_('Branches|You’re about to permanently delete the protected branch %{branch_name}.').html_safe % { branch_name: branch_name }
- %p.js-not-merged
- - default_branch = capture do
- %span.ref-name= @repository.root_ref
- = s_('Branches|This branch hasn’t been merged into %{default_branch}.').html_safe % { default_branch: default_branch }
- = s_('Branches|To avoid data loss, consider merging this branch before deleting it.')
- %p
- - delete_protected_branch = capture do
- %strong
- = s_('Branches|Delete protected branch')
- = s_('Branches|Once you confirm and press %{delete_protected_branch}, it cannot be undone or recovered.').html_safe % { delete_protected_branch: delete_protected_branch }
- %p
- - branch_name_confirmation = capture do
- %kbd.js-branch-name [branch name]
- %strong
- = s_('Branches|To confirm, type %{branch_name_confirmation}:').html_safe % { branch_name_confirmation: branch_name_confirmation }
-
- .form-group
- = text_field_tag 'delete_branch_input', '', class: 'form-control js-delete-branch-input'
-
- .modal-footer
- %button.gl-button.btn.btn-default{ data: { dismiss: 'modal' } } Cancel
- = link_to s_('Branches|Delete protected branch'), '',
- class: "gl-button btn btn-danger js-delete-branch",
- title: s_('Branches|Delete branch'),
- method: :delete,
- 'aria-label' => s_('Branches|Delete branch')
diff --git a/app/views/projects/branches/index.html.haml b/app/views/projects/branches/index.html.haml
index 1c543d47ecf..2121d15643c 100644
--- a/app/views/projects/branches/index.html.haml
+++ b/app/views/projects/branches/index.html.haml
@@ -50,7 +50,5 @@
.nothing-here-block
= s_('Branches|No branches to show')
-- if Feature.enabled?(:delete_branch_confirmation_modals, @project, default_enabled: :yaml) && can?(current_user, :push_code, @project)
+- if can?(current_user, :push_code, @project)
.js-delete-branch-modal
-- elsif can?(current_user, :push_code, @project)
- = render 'projects/branches/delete_protected_modal'