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.haml39
-rw-r--r--app/views/projects/branches/_delete_branch_modal_button.html.haml18
-rw-r--r--app/views/projects/branches/_delete_protected_modal.html.haml2
-rw-r--r--app/views/projects/branches/index.html.haml7
4 files changed, 46 insertions, 20 deletions
diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml
index a5414ce7ef2..60cb06f71ba 100644
--- a/app/views/projects/branches/_branch.html.haml
+++ b/app/views/projects/branches/_branch.html.haml
@@ -46,35 +46,40 @@
title: s_('Branches|Compare') do
= s_('Branches|Compare')
- = render 'projects/buttons/download', project: @project, ref: branch.name, pipeline: @refs_pipelines[branch.name]
+ = render 'projects/buttons/download', project: @project, ref: branch.name, pipeline: @refs_pipelines[branch.name], class: 'gl-vertical-align-top'
- - if can?(current_user, :push_code, @project)
+ - 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.has-tooltip{ title: delete_default_branch_tooltip }
- %button{ class: "gl-button btn btn-danger disabled", disabled: true, 'aria-label' => delete_default_branch_tooltip }
- = sprite_icon("remove")
+ %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)
- %button{ class: "gl-button btn btn-danger has-tooltip",
- title: s_('Branches|Delete protected branch'),
- data: { toggle: "modal",
- target: "#modal-delete-branch",
+ - 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")
+ is_merged: ('true' if merged) } }
+ = sprite_icon('remove', css_class: 'gl-button-icon gl-icon')
- else
- - delete_protected_branch_tooltip = s_('Branches|Only a project maintainer or owner can delete a protected branch')
- %span.has-tooltip{ title: delete_protected_branch_tooltip }
- %button{ class: "gl-button btn btn-danger disabled", disabled: true, 'aria-label' => delete_protected_branch_tooltip }
- = sprite_icon("remove")
+ - 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-danger js-remove-row qa-remove-btn js-ajax-loading-spinner has-tooltip",
+ 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")
+ = sprite_icon('remove', css_class: 'gl-button-icon gl-icon')
diff --git a/app/views/projects/branches/_delete_branch_modal_button.html.haml b/app/views/projects/branches/_delete_branch_modal_button.html.haml
new file mode 100644
index 00000000000..829a459ad2c
--- /dev/null
+++ b/app/views/projects/branches/_delete_branch_modal_button.html.haml
@@ -0,0 +1,18 @@
+- if branch.name == @project.repository.root_ref
+ .js-delete-branch-button{ data: { tooltip: s_('Branches|The default branch cannot be deleted'),
+ disabled: true.to_s } }
+- elsif protected_branch?(@project, branch)
+ - if can?(current_user, :push_to_delete_protected_branch, @project)
+ .js-delete-branch-button{ data: { branch_name: branch.name,
+ is_protected_branch: true.to_s,
+ merged: merged.to_s,
+ default_branch_name: @project.repository.root_ref,
+ delete_path: project_branch_path(@project, branch.name) } }
+ - else
+ .js-delete-branch-button{ data: { is_protected_branch: true.to_s,
+ disabled: true.to_s } }
+- else
+ .js-delete-branch-button{ data: { branch_name: branch.name,
+ merged: merged.to_s,
+ default_branch_name: @project.repository.root_ref,
+ delete_path: project_branch_path(@project, branch.name) } }
diff --git a/app/views/projects/branches/_delete_protected_modal.html.haml b/app/views/projects/branches/_delete_protected_modal.html.haml
index 5c5653401fb..2b45b4eddcc 100644
--- a/app/views/projects/branches/_delete_protected_modal.html.haml
+++ b/app/views/projects/branches/_delete_protected_modal.html.haml
@@ -7,7 +7,7 @@
%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 } ×
+ %span{ "aria-hidden": "true" } ×
.modal-body
%p
diff --git a/app/views/projects/branches/index.html.haml b/app/views/projects/branches/index.html.haml
index 129b207a26f..b1d465d0e75 100644
--- a/app/views/projects/branches/index.html.haml
+++ b/app/views/projects/branches/index.html.haml
@@ -46,7 +46,7 @@
%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?(:branches_pagination_without_count, @project, default_enabled: true)
+ - if Feature.enabled?(:branches_pagination_without_count, @project, default_enabled: :yaml)
= render('kaminari/gitlab/without_count', previous_path: @prev_path, next_path: @next_path)
- else
= paginate @branches, theme: 'gitlab'
@@ -54,4 +54,7 @@
.nothing-here-block
= s_('Branches|No branches to show')
-= render 'projects/branches/delete_protected_modal'
+- if Feature.enabled?(:delete_branch_confirmation_modals, @project, default_enabled: :yaml) && can?(current_user, :push_code, @project)
+ .js-delete-branch-modal
+- elsif can?(current_user, :push_code, @project)
+ = render 'projects/branches/delete_protected_modal'