diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-18 01:32:00 -0200 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-19 14:58:27 -0200 |
commit | 4c9241075dc1b2f1cda5648cf9ad1f553db3d03b (patch) | |
tree | 48cf8c9870b515d4b870710ceeb44d71ee3b6e2b | |
parent | 007267ef8b927646bab0932b5704ff0f3720253f (diff) | |
download | gitlab-ce-4c9241075dc1b2f1cda5648cf9ad1f553db3d03b.tar.gz |
Warn user deleting a group label affect all projects within the group
-rw-r--r-- | app/helpers/labels_helper.rb | 7 | ||||
-rw-r--r-- | app/views/shared/_label.html.haml | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb index a1d7713b45f..d7cfd24c918 100644 --- a/app/helpers/labels_helper.rb +++ b/app/helpers/labels_helper.rb @@ -155,6 +155,13 @@ module LabelsHelper label.subscribed?(current_user) ? 'Unsubscribe' : 'Subscribe' end + def label_deletion_confirm_text(label) + case label + when GroupLabel then 'Remove this label? This will affect all projects within the group. Are you sure?' + when ProjectLabel then 'Remove this label? Are you sure?' + end + end + # Required for Banzai::Filter::LabelReferenceFilter module_function :render_colored_label, :render_colored_cross_project_label, :text_color_for_bg, :escape_once diff --git a/app/views/shared/_label.html.haml b/app/views/shared/_label.html.haml index ba8a3efccda..5cdd18d24f0 100644 --- a/app/views/shared/_label.html.haml +++ b/app/views/shared/_label.html.haml @@ -44,7 +44,7 @@ = link_to edit_label_path(label), title: "Edit", class: 'btn btn-transparent btn-action', data: {toggle: "tooltip"} do %span.sr-only Edit = icon('pencil-square-o') - = link_to destroy_label_path(label), title: "Delete", class: 'btn btn-transparent btn-action remove-row', method: :delete, remote: true, data: {confirm: "Remove this label? Are you sure?", toggle: "tooltip"} do + = link_to destroy_label_path(label), title: "Delete", class: 'btn btn-transparent btn-action remove-row', method: :delete, remote: true, data: {confirm: label_deletion_confirm_text(label), toggle: "tooltip"} do %span.sr-only Delete = icon('trash-o') |