Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-28 18:10:28 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-28 18:10:28 +0300
commitfcfd395a4b4d60f017a4512418a3a9e12cdc5e3a (patch)
tree6fe7879f93d1cbe3b93007911787caec92a90cde /app/views/projects/branches
parent0d8df625a2ee3562cf1b2bdac46a429f69b06daf (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/views/projects/branches')
-rw-r--r--app/views/projects/branches/_branch.html.haml5
-rw-r--r--app/views/projects/branches/_delete_branch_modal_button.html.haml18
-rw-r--r--app/views/projects/branches/index.html.haml5
3 files changed, 26 insertions, 2 deletions
diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml
index 548fdc10bd4..60cb06f71ba 100644
--- a/app/views/projects/branches/_branch.html.haml
+++ b/app/views/projects/branches/_branch.html.haml
@@ -48,7 +48,10 @@
= 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.gl-display-inline-block.has-tooltip{ title: delete_default_branch_tooltip }
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/index.html.haml b/app/views/projects/branches/index.html.haml
index 129b207a26f..7cfe7d9d914 100644
--- a/app/views/projects/branches/index.html.haml
+++ b/app/views/projects/branches/index.html.haml
@@ -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'