summaryrefslogtreecommitdiff
path: root/app/views/projects/branches/_delete_branch_modal_button.html.haml
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/projects/branches/_delete_branch_modal_button.html.haml')
-rw-r--r--app/views/projects/branches/_delete_branch_modal_button.html.haml18
1 files changed, 18 insertions, 0 deletions
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) } }